Skip to content

Commit 2994a4e

Browse files
committed
execute delay slot instruction during RTE
1 parent d6aa958 commit 2994a4e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/jit/frontend/sh4/sh4_instr.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,19 @@ INSTR(PREF) {
13621362
INSTR(RTE) {
13631363
I32 ssr = LOAD_SSR_I32();
13641364
I32 spc = LOAD_SPC_I32();
1365+
1366+
/* in an RTE delay slot, status register bits are referenced as follows. for
1367+
instruction access, the MD bit is used before modification, and for data
1368+
access, the MD bit is accessed after modification. for the instruction
1369+
execution, the other bits (S, T, M, Q, FD, BL, and RB) are used after
1370+
modification. the STC and STC.L SR instructions access all SR bits after
1371+
modification
1372+
1373+
note, since the MD bit isn't actually emulated, the SR is just set before
1374+
executing the delay slot */
13651375
STORE_SR_I32(ssr);
1376+
DELAY_INSTR();
1377+
13661378
BRANCH_I32(spc);
13671379
}
13681380

0 commit comments

Comments
 (0)