MemoryUtil: get executable pages near static data

and clean up a bit.
This commit is contained in:
Tillmann Karras
2015-05-02 11:57:17 +02:00
parent a0597f0d62
commit d4538c762f
9 changed files with 33 additions and 114 deletions

View File

@ -40,7 +40,7 @@ void Jit64AsmRoutineManager::Generate()
// Two statically allocated registers.
//MOV(64, R(RMEM), Imm64((u64)Memory::physical_base));
MOV(64, R(RPPCSTATE), Imm64((u64)&PowerPC::ppcState + 0x80));
MOV(64, R(RPPCSTATE), ImmPtr(PPCSTATE_BASE));
const u8* outerLoop = GetCodePtr();
ABI_PushRegistersAndAdjustStack({}, 0);

View File

@ -34,7 +34,7 @@ public:
m_stack_top = stack_top;
// NOTE: When making large additions to the AsmCommon code, you might
// want to ensure this number is big enough.
AllocCodeSpace(16384);
AllocCodeSpace(16384, PPCSTATE_BASE);
Generate();
WriteProtect();
}

View File

@ -250,7 +250,7 @@ void JitIL::Init()
UpdateMemoryOptions();
trampolines.Init(jo.memcheck ? TRAMPOLINE_CODE_SIZE_MMU : TRAMPOLINE_CODE_SIZE);
AllocCodeSpace(CODE_SIZE);
AllocCodeSpace(CODE_SIZE, PPCSTATE_BASE);
blocks.Init();
asm_routines.Init(nullptr);

View File

@ -9,15 +9,15 @@
#include "Common/BitSet.h"
#include "Common/CPUDetect.h"
#include "Common/x64Emitter.h"
#include "Core/PowerPC/PowerPC.h"
namespace MMIO { class Mapping; }
// We offset by 0x80 because the range of one byte memory offsets is
// -0x80..0x7f.
#define PPCSTATE_OFS(x) ((u8*)(x) - (u8*)&PowerPC::ppcState - 0x80)
#define PPCSTATE_BASE ((u8*)&PowerPC::ppcState + 0x80)
#define PPCSTATE_OFS(x) ((u8*)(x) - PPCSTATE_BASE)
#define PPCSTATE(x) MDisp(RPPCSTATE, PPCSTATE_OFS(&PowerPC::ppcState.x))
// In case you want to disable the ppcstate register:
// #define PPCSTATE(x) M(&PowerPC::ppcState.x)
#define PPCSTATE_LR PPCSTATE(spr[SPR_LR])
#define PPCSTATE_CTR PPCSTATE(spr[SPR_CTR])
#define PPCSTATE_SRR0 PPCSTATE(spr[SPR_SRR0])
@ -31,7 +31,7 @@ private:
bool m_enabled = false;
public:
bool Enabled() { return m_enabled; }
void Init(int size) { AllocCodeSpace(size); m_enabled = true; }
void Init(int size) { AllocCodeSpace(size, PPCSTATE_BASE); m_enabled = true; }
void Shutdown() { FreeCodeSpace(); m_enabled = false; }
};

View File

@ -22,7 +22,7 @@ using namespace Gen;
void TrampolineCache::Init(int size)
{
AllocCodeSpace(size);
AllocCodeSpace(size, PPCSTATE_BASE);
}
void TrampolineCache::ClearCodeSpace()