Jit64: turn 32 bit addresses into offsets

This commit is contained in:
Tillmann Karras
2015-04-20 20:47:51 +02:00
parent 9f15054358
commit a0597f0d62
11 changed files with 82 additions and 74 deletions

View File

@ -43,6 +43,18 @@
// to address as much as possible in a one-byte offset form.
#define RPPCSTATE RBP
namespace Gen
{
inline OpArg MPIC(const void* address, X64Reg scale_reg, int scale = SCALE_1)
{
ptrdiff_t offset = PPCSTATE_OFS(address);
_dbg_assert_(DYNA_REC, FitsInS32(offset));
return MComplex(RPPCSTATE, scale_reg, scale, offset);
}
}
// Use these to control the instruction selection
// #define INSTRUCTION_START FallBackToInterpreter(inst); return;
// #define INSTRUCTION_START PPCTables::CountInstruction(inst);

View File

@ -173,11 +173,11 @@ private:
u32 all_ones = (1ULL << sbits) - 1;
if ((all_ones & mask) == all_ones)
{
MoveOpArgToReg(sbits, MDisp(RSCRATCH, 0));
MoveOpArgToReg(sbits, MatR(RSCRATCH));
}
else
{
m_code->MOVZX(32, sbits, m_dst_reg, MDisp(RSCRATCH, 0));
m_code->MOVZX(32, sbits, m_dst_reg, MatR(RSCRATCH));
m_code->AND(32, R(m_dst_reg), Imm32(mask));
if (m_sign_extend)
m_code->MOVSX(32, sbits, m_dst_reg, R(m_dst_reg));

View File

@ -14,8 +14,8 @@ namespace MMIO { class Mapping; }
// We offset by 0x80 because the range of one byte memory offsets is
// -0x80..0x7f.
#define PPCSTATE(x) MDisp(RPPCSTATE, \
(int) ((char *) &PowerPC::ppcState.x - (char *) &PowerPC::ppcState) - 0x80)
#define PPCSTATE_OFS(x) ((u8*)(x) - (u8*)&PowerPC::ppcState - 0x80)
#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])