mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 16:30:44 +00:00
Fix NativeOp code generation, especially in PPC_REENTRANT_JIT mode
This commit is contained in:
parent
f376933138
commit
05bd5f40b4
@ -469,21 +469,24 @@ int sheepshaver_cpu::compile1(codegen_context_t & cg_context)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Could we fully translate this NativeOp?
|
// Could we fully translate this NativeOp?
|
||||||
if (FN_field::test(opcode)) {
|
if (status == COMPILE_CODE_OK) {
|
||||||
if (status != COMPILE_FAILURE) {
|
if (!FN_field::test(opcode))
|
||||||
|
cg_context.done_compile = false;
|
||||||
|
else {
|
||||||
dg.gen_load_A0_LR();
|
dg.gen_load_A0_LR();
|
||||||
dg.gen_set_PC_A0();
|
dg.gen_set_PC_A0();
|
||||||
}
|
|
||||||
cg_context.done_compile = true;
|
cg_context.done_compile = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if (status != COMPILE_FAILURE) {
|
|
||||||
cg_context.done_compile = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if PPC_REENTRANT_JIT
|
#if PPC_REENTRANT_JIT
|
||||||
// Try to execute NativeOp trampoline
|
// Try to execute NativeOp trampoline
|
||||||
|
if (!FN_field::test(opcode))
|
||||||
dg.gen_set_PC_im(cg_context.pc + 4);
|
dg.gen_set_PC_im(cg_context.pc + 4);
|
||||||
|
else {
|
||||||
|
dg.gen_load_A0_LR();
|
||||||
|
dg.gen_set_PC_A0();
|
||||||
|
}
|
||||||
dg.gen_mov_32_T0_im(selector);
|
dg.gen_mov_32_T0_im(selector);
|
||||||
dg.gen_jmp(native_op_trampoline);
|
dg.gen_jmp(native_op_trampoline);
|
||||||
cg_context.done_compile = true;
|
cg_context.done_compile = true;
|
||||||
@ -491,11 +494,15 @@ int sheepshaver_cpu::compile1(codegen_context_t & cg_context)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
// Invoke NativeOp handler
|
// Invoke NativeOp handler
|
||||||
|
if (!FN_field::test(opcode)) {
|
||||||
typedef void (*func_t)(dyngen_cpu_base, uint32);
|
typedef void (*func_t)(dyngen_cpu_base, uint32);
|
||||||
func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_native_op).ptr();
|
func_t func = (func_t)nv_mem_fun(&sheepshaver_cpu::execute_native_op).ptr();
|
||||||
dg.gen_invoke_CPU_im(func, selector);
|
dg.gen_invoke_CPU_im(func, selector);
|
||||||
cg_context.done_compile = false;
|
cg_context.done_compile = false;
|
||||||
status = COMPILE_CODE_OK;
|
status = COMPILE_CODE_OK;
|
||||||
|
}
|
||||||
|
// Otherwise, let it generate a call to execute_sheep() which
|
||||||
|
// will cause necessary updates to the program counter
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user