Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 34390bf

Browse files
authored
Merge pull request #1797 from reicast/skmp/fix-imm-readms
JIT: Correctly pass context to immm reads that become static calls
2 parents 67019c6 + a424ce3 commit 34390bf

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

libswirl/jit/backend/arm32/rec_arm.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ void ngen_compile_opcode(RuntimeBlockInfo* block, shil_opcode* op, bool staging,
863863
}
864864
else
865865
{
866-
MOV32(r0,op->rs1._imm);
866+
MOV32(r0, (uintptr_t)sh4_cpu);
867+
MOV32(r1,op->rs1._imm);
867868

868869
switch(optp)
869870
{

libswirl/jit/backend/arm64/rec_arm64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,8 @@ class Arm64Assembler : public MacroAssembler
10771077
else
10781078
{
10791079
// Not RAM
1080-
Mov(w0, op.rs1._imm);
1080+
Mov(x0, (uintptr_t)sh4_cpu);
1081+
Mov(w1, op.rs1._imm);
10811082

10821083
switch(size)
10831084
{

libswirl/jit/backend/x64/rec_x64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ class BlockCompiler : public Xbyak::CodeGenerator
867867
else
868868
{
869869
// Not RAM: the returned pointer is a memory handler
870-
mov(call_regs[0], op.rs1._imm);
870+
mov(call_regs[0].cvt64(), (uintptr_t)sh4_cpu);
871+
mov(call_regs[1], op.rs1._imm);
871872

872873
switch(size) {
873874
case 2:

libswirl/jit/backend/x86/rec_x86_il.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ void ngen_opcode(RuntimeBlockInfo* block, shil_opcode* op,x86_block* x86e, bool
304304
#ifdef PROF2
305305
x86e->Emit(op_add32,&srmls,1);
306306
#endif
307-
x86e->Emit(op_mov32,ECX,op->rs1._imm);
307+
x86e->Emit(op_mov32,ECX, (uintptr_t)(sh4_cpu));
308+
x86e->Emit(op_mov32,EDX,op->rs1._imm);
308309
fuct=ptr;
309310
}
310311
}

0 commit comments

Comments
 (0)