mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 06:29:00 +01:00
Core/DSP/Jit: Fix instruction size retrieval in Branch emitters.
Reading the instruction from memory at the given address and using that as index in the opTable leads to more correct results than using the address as index into opTable. Also assert when trying to execute a bad instruction instead of crashing without warning. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7384 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
215baff4c8
commit
010a60c56a
@ -109,6 +109,7 @@ void DSPEmitter::Default(UDSPInstruction inst)
|
||||
|
||||
// Fall back to interpreter
|
||||
gpr.pushRegs();
|
||||
_assert_msg_(DSPLLE, opTable[inst]->intFunc, "No function for %04x",inst);
|
||||
ABI_CallFunctionC16((void*)opTable[inst]->intFunc, inst);
|
||||
gpr.popRegs();
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void r_ifcc(const UDSPInstruction opc, DSPEmitter& emitter)
|
||||
// NOTE: Cannot use Default(opc) here because of the need to write branch exit
|
||||
void DSPEmitter::ifcc(const UDSPInstruction opc)
|
||||
{
|
||||
MOV(16, M(&g_dsp.pc), Imm16((compilePC + 1) + opTable[compilePC + 1]->size));
|
||||
MOV(16, M(&g_dsp.pc), Imm16((compilePC + 1) + opTable[dsp_imem_read(compilePC + 1)]->size));
|
||||
ReJitConditional<r_ifcc>(opc, *this);
|
||||
WriteBranchExit(*this);
|
||||
}
|
||||
@ -382,7 +382,7 @@ void DSPEmitter::loop(const UDSPInstruction opc)
|
||||
|
||||
SetJumpTarget(cnt);
|
||||
// dsp_skip_inst();
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[loop_pc]->size));
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[dsp_imem_read(loop_pc)]->size));
|
||||
WriteBranchExit(*this);
|
||||
gpr.flushRegs(c,false);
|
||||
SetJumpTarget(exit);
|
||||
@ -415,7 +415,7 @@ void DSPEmitter::loopi(const UDSPInstruction opc)
|
||||
else
|
||||
{
|
||||
// dsp_skip_inst();
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[loop_pc]->size));
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[dsp_imem_read(loop_pc)]->size));
|
||||
WriteBranchExit(*this);
|
||||
}
|
||||
}
|
||||
@ -452,7 +452,7 @@ void DSPEmitter::bloop(const UDSPInstruction opc)
|
||||
SetJumpTarget(cnt);
|
||||
// g_dsp.pc = loop_pc;
|
||||
// dsp_skip_inst();
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[loop_pc]->size));
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[dsp_imem_read(loop_pc)]->size));
|
||||
WriteBranchExit(*this);
|
||||
gpr.flushRegs(c,false);
|
||||
SetJumpTarget(exit);
|
||||
@ -488,7 +488,7 @@ void DSPEmitter::bloopi(const UDSPInstruction opc)
|
||||
{
|
||||
// g_dsp.pc = loop_pc;
|
||||
// dsp_skip_inst();
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[loop_pc]->size));
|
||||
MOV(16, M(&g_dsp.pc), Imm16(loop_pc + opTable[dsp_imem_read(loop_pc)]->size));
|
||||
WriteBranchExit(*this);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user