Recompiler Ops: Jal to use relative address
This commit is contained in:
parent
3e2b93203b
commit
196b8ee100
Source/Project64/N64 System/Recompiler
|
@ -1352,9 +1352,10 @@ void CRecompilerOps::J (void) {
|
||||||
void CRecompilerOps::JAL (void) {
|
void CRecompilerOps::JAL (void) {
|
||||||
if ( m_NextInstruction == NORMAL ) {
|
if ( m_NextInstruction == NORMAL ) {
|
||||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||||
UnMap_GPR( 31, FALSE);
|
Map_GPR_32bit(31,true,-1);
|
||||||
m_RegWorkingSet.SetMipsRegLo(31,m_CompilePC + 8);
|
MoveVariableToX86reg(_PROGRAM_COUNTER,"_PROGRAM_COUNTER",GetMipsRegMapLo(31));
|
||||||
m_RegWorkingSet.SetMipsRegState(31,CRegInfo::STATE_CONST_32);
|
AndConstToX86Reg(GetMipsRegMapLo(31), 0xF0000000);
|
||||||
|
AddConstToX86Reg(GetMipsRegMapLo(31),(m_CompilePC + 8) & ~0xF0000000);
|
||||||
if ((m_CompilePC & 0xFFC) == 0xFFC)
|
if ((m_CompilePC & 0xFFC) == 0xFFC)
|
||||||
{
|
{
|
||||||
MoveConstToVariable((m_CompilePC & 0xF0000000) + (m_Opcode.target << 2),&R4300iOp::m_JumpToLocation,"R4300iOp::m_JumpToLocation");
|
MoveConstToVariable((m_CompilePC & 0xF0000000) + (m_Opcode.target << 2),&R4300iOp::m_JumpToLocation,"R4300iOp::m_JumpToLocation");
|
||||||
|
@ -1378,14 +1379,22 @@ void CRecompilerOps::JAL (void) {
|
||||||
m_Section->m_Jump.RegSet = m_RegWorkingSet;
|
m_Section->m_Jump.RegSet = m_RegWorkingSet;
|
||||||
m_Section->GenerateSectionLinkage();
|
m_Section->GenerateSectionLinkage();
|
||||||
} else {
|
} else {
|
||||||
|
m_RegWorkingSet.WriteBackRegisters();
|
||||||
|
|
||||||
|
x86Reg pc_reg = Map_TempReg(x86_Any,-1,false);
|
||||||
|
MoveVariableToX86reg(_PROGRAM_COUNTER,"_PROGRAM_COUNTER",pc_reg);
|
||||||
|
AndConstToX86Reg(pc_reg, 0xF0000000);
|
||||||
|
AddConstToX86Reg(pc_reg,(m_Opcode.target << 2));
|
||||||
|
MoveX86regToVariable(pc_reg,_PROGRAM_COUNTER,"_PROGRAM_COUNTER");
|
||||||
|
|
||||||
DWORD TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
|
DWORD TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
|
||||||
m_Section->CompileExit(m_CompilePC,TargetPC,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL);
|
UpdateCounters(m_RegWorkingSet,TargetPC <= m_CompilePC, true);
|
||||||
|
|
||||||
|
m_Section->CompileExit((DWORD)-1, (DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL);
|
||||||
}
|
}
|
||||||
m_NextInstruction = END_BLOCK;
|
m_NextInstruction = END_BLOCK;
|
||||||
} else {
|
} else {
|
||||||
#ifndef EXTERNAL_RELEASE
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
g_Notify->DisplayError("WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue