Skip to content

Commit bd1b785

Browse files
Merge pull request #707 from wheremyfoodat/fix_bcond
Fix REGIMM in interpreter
2 parents 64032e7 + d625cae commit bd1b785

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

src/core/ix86/iR3000A.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,14 +2861,14 @@ const func_t DynaRecCPU::m_recSPC[64] = {
28612861
};
28622862

28632863
const func_t DynaRecCPU::m_recREG[32] = {
2864-
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 00
2865-
&DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 04
2866-
&DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 08
2867-
&DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 0c
2868-
&DynaRecCPU::recBLTZAL, &DynaRecCPU::recBGEZAL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 10
2869-
&DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 14
2870-
&DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 18
2871-
&DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, &DynaRecCPU::recNULL, // 1c
2864+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 00
2865+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 04
2866+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 08
2867+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 0c
2868+
&DynaRecCPU::recBLTZAL, &DynaRecCPU::recBGEZAL, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 10
2869+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 14
2870+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, // 18
2871+
&DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ, &DynaRecCPU::recBLTZ, &DynaRecCPU::recBGEZ // 1c
28722872
};
28732873

28742874
const func_t DynaRecCPU::m_recCP0[32] = {

src/core/psxinterpreter.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,15 +1188,18 @@ const InterpretedCPU::intFunc_t InterpretedCPU::s_psxSPC[64] = {
11881188
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 3c
11891189
};
11901190

1191+
// The REGIMM instruction is actually valid for every single value that the rt field might have
1192+
// If the lowest bit of the rt field is 1 then the instruction is a BGEZ, otherwise it's a BLTZ.
1193+
// If ((_Rt_ >> 4) & 0xF) == 0x8 then the instruction should link the return address to $ra, otherwise not.
11911194
const InterpretedCPU::intFunc_t InterpretedCPU::s_psxREG[32] = {
1192-
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 00
1193-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 04
1194-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 08
1195-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 0c
1196-
&InterpretedCPU::psxBLTZAL, &InterpretedCPU::psxBGEZAL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 10
1197-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 14
1198-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 18
1199-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 1c
1195+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 00
1196+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 04
1197+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 08
1198+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 0c
1199+
&InterpretedCPU::psxBLTZAL, &InterpretedCPU::psxBGEZAL, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 10
1200+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 14
1201+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 18
1202+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ // 1c
12001203
};
12011204

12021205
const InterpretedCPU::intFunc_t InterpretedCPU::s_psxCP0[32] = {

0 commit comments

Comments
 (0)