summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/sh/sh4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/sh/sh4.cpp')
-rw-r--r--src/devices/cpu/sh/sh4.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/devices/cpu/sh/sh4.cpp b/src/devices/cpu/sh/sh4.cpp
index 37f989eae56..3f48939f116 100644
--- a/src/devices/cpu/sh/sh4.cpp
+++ b/src/devices/cpu/sh/sh4.cpp
@@ -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;
}