some SH3/4 recompiler changes that got lost at some point (nw) (#2767)

This commit is contained in:
David Haywood 2017-11-01 18:02:20 +00:00 committed by hap
parent 4c1a07b26a
commit b66a551f42

View File

@ -2597,8 +2597,6 @@ static void cfunc_CHECKIRQ(void *param) { ((sh34_base_device *)param)->func_CHEC
void sh34_base_device::generate_update_cycles(drcuml_block *block, compiler_state *compiler, uml::parameter param, bool allow_exception)
{
/* TODO: this is likely wrong? - I've not seen it called when compiler->checkints is true */
/* check full interrupts if pending */
if (compiler->checkints)
{
@ -2606,7 +2604,7 @@ void sh34_base_device::generate_update_cycles(drcuml_block *block, compiler_stat
/* param is pc + 2 (the opcode after the current one)
as we're calling from opcode handlers here that will point to the current opcode instead
but I believe the exception functoin requires it to point to the next one so update the
but I believe the exception function requires it to point to the next one so update the
local copy of the PC variable here for that? */
UML_MOV(block, mem(&m_sh2_state->pc), param);
@ -3028,7 +3026,7 @@ bool sh34_base_device::generate_group_0_STCDBR(drcuml_block *block, compiler_sta
}
void sh34_base_device::func_RTE() { RTE(); }
static void cfunc_RTE(void *param) { ((sh34_base_device *)param)->func_RTE(); };
static void cfunc_RTE(void *param) { ((sh34_base_device *)param)->func_RTE(); };
bool sh34_base_device::generate_group_0_RTE(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, uint16_t opcode, int in_delay_slot, uint32_t ovrpc)
{
@ -3036,6 +3034,9 @@ bool sh34_base_device::generate_group_0_RTE(drcuml_block *block, compiler_state
save_fast_iregs(block);
UML_CALLC(block, cfunc_RTE, this);
load_fast_iregs(block);
compiler->checkints = true;
UML_MOV(block, mem(&m_sh2_state->pc), mem(&m_sh2_state->m_delay));
generate_update_cycles(block, compiler, mem(&m_sh2_state->ea), true); // <subtract cycles>
UML_HASHJMP(block, 0, mem(&m_sh2_state->pc), *m_nocode); // and jump to the "resume PC"
@ -3065,6 +3066,9 @@ bool sh34_base_device::generate_group_4_LDCSR(drcuml_block *block, compiler_stat
UML_MOV(block, mem(&m_sh2_state->arg0), desc->opptr.w[0]);
UML_CALLC(block, cfunc_LDCSR, this);
load_fast_iregs(block);
compiler->checkints = true;
return true;
}
@ -3077,6 +3081,11 @@ bool sh34_base_device::generate_group_4_LDCMSR(drcuml_block *block, compiler_sta
UML_MOV(block, mem(&m_sh2_state->arg0), desc->opptr.w[0]);
UML_CALLC(block, cfunc_LDCMSR, this);
load_fast_iregs(block);
compiler->checkints = true;
if (!in_delay_slot)
generate_update_cycles(block, compiler, desc->pc + 2, true);
return true;
}