diff options
Diffstat (limited to 'src/emu/cpu/drcbex64.c')
-rw-r--r-- | src/emu/cpu/drcbex64.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index 1d24a46ab50..ddaccadc70f 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -273,7 +273,7 @@ struct _drcbe_state x86code * exit; /* exit point */ x86code * nocode; /* nocode handler */ - x86code * mame_debug_hook; /* debugger callback */ + x86code * debug_cpu_instruction_hook;/* debugger callback */ x86code * debug_log_hashjmp; /* hashjmp debugging */ x86code * drcmap_get_value; /* map lookup helper */ data_accessors accessors[ADDRESS_SPACES];/* memory accessors */ @@ -713,9 +713,7 @@ static drcbe_state *drcbex64_alloc(drcuml_state *drcuml, drccache *cache, UINT32 drcbe->absmask64[0] = drcbe->absmask64[1] = U64(0x7fffffffffffffff); /* get pointers to C functions we need to call */ -#ifdef ENABLE_DEBUGGER - drcbe->mame_debug_hook = (x86code *)mame_debug_hook; -#endif + drcbe->debug_cpu_instruction_hook = (x86code *)debug_cpu_instruction_hook; #if LOG_HASHJMPS drcbe->debug_log_hashjmp = (x86code *)debug_log_hashjmp; #endif @@ -3083,24 +3081,32 @@ static x86code *op_nop(drcbe_state *drcbe, x86code *dst, const drcuml_instructio static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) { + emit_link skip = { 0 }; + /* validate instruction */ assert(inst->size == 4); assert_no_condition(inst); assert_no_flags(inst); -#ifdef ENABLE_DEBUGGER - if (Machine->debug_mode) + if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { drcuml_parameter pcp; /* normalize parameters */ param_normalize_1(drcbe, inst, &pcp, PTYPE_MRI); + /* test and branch */ + emit_mov_r64_imm(&dst, REG_PARAM1, (FPTR)Machine); // mov param1,pcp + emit_test_m32_imm(&dst, MBD(REG_PARAM1, offsetof(running_machine, debug_flags)), DEBUG_FLAG_CALL_HOOK); + // test [Machine->debug_flags],DEBUG_FLAG_CALL_HOOK + emit_jcc_short_link(&dst, COND_Z, &skip); // jz skip + /* push the parameter */ - emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &pcp); // mov param1,pcp - emit_smart_call_m64(drcbe, &dst, &drcbe->mame_debug_hook); // call mame_debug_hook + emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &pcp); // mov param1,pcp + emit_smart_call_m64(drcbe, &dst, &drcbe->debug_cpu_instruction_hook); // call debug_cpu_instruction_hook + + resolve_link(&dst, &skip); // skip: } -#endif return dst; } |