diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-04-26 00:07:15 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-04-26 00:07:15 -0700 |
commit | 042768acd31ac2a59049db55e31b647c2eb51818 (patch) | |
tree | e8f9eb1e0b9098c558aa9ff0f7bee7ace8c6fc27 | |
parent | f648307598ab5c06261ef7bd9b27308cda8f1a4e (diff) |
Implement illegal instruction trap
-rw-r--r-- | m68k_core.c | 11 | ||||
-rw-r--r-- | m68k_core_x86.c | 22 | ||||
-rw-r--r-- | m68k_internal.h | 2 |
3 files changed, 10 insertions, 25 deletions
diff --git a/m68k_core.c b/m68k_core.c index bbc5abd..b687045 100644 --- a/m68k_core.c +++ b/m68k_core.c @@ -339,6 +339,15 @@ void translate_m68k_trap(m68k_options *opts, m68kinst *inst) jmp(code, opts->trap); } +void translate_m68k_illegal(m68k_options *opts, m68kinst *inst) +{ + code_info *code = &opts->gen.code; + cycles(&opts->gen, BUS); + ldi_native(opts, VECTOR_ILLEGAL_INST, opts->gen.scratch2); + ldi_native(opts, inst->address, opts->gen.scratch1); + jmp(code, opts->trap); +} + void translate_m68k_move_usp(m68k_options *opts, m68kinst *inst) { cycles(&opts->gen, BUS); @@ -800,7 +809,7 @@ impl_info m68k_impls[] = { RAW_IMPL(M68K_TRAP, translate_m68k_trap), RAW_IMPL(M68K_TRAPV, translate_m68k_trapv), RAW_IMPL(M68K_ILLEGAL, translate_m68k_illegal), - RAW_IMPL(M68K_INVALID, translate_m68k_invalid), + RAW_IMPL(M68K_INVALID, translate_m68k_illegal), //misc RAW_IMPL(M68K_NOP, translate_m68k_nop), diff --git a/m68k_core_x86.c b/m68k_core_x86.c index cec7df4..48d245b 100644 --- a/m68k_core_x86.c +++ b/m68k_core_x86.c @@ -1388,21 +1388,6 @@ void translate_m68k_unary(m68k_options *opts, m68kinst *inst, uint32_t flag_mask m68k_save_result(inst, opts); } -void translate_m68k_invalid(m68k_options *opts, m68kinst *inst) -{ - code_info *code = &opts->gen.code; - if (inst->src.params.immed == 0x7100) { - retn(code); - return; - } - mov_ir(code, (int64_t)stderr, RDI, SZ_PTR); - mov_ir(code, (int64_t)"Invalid instruction at %X\n", RSI, SZ_PTR); - mov_ir(code, inst->address, RDX, SZ_D); - call_args_abi(code, (code_ptr)fprintf, 3, RDI, RSI, RDX); - mov_ir(code, 1, RDI, SZ_D); - call_args(code, (code_ptr)exit, 1, RDI); -} - void translate_m68k_abcd_sbcd(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op) { code_info *code = &opts->gen.code; @@ -1983,13 +1968,6 @@ void translate_m68k_rot(m68k_options *opts, m68kinst *inst, host_ea *src_op, hos } } -void translate_m68k_illegal(m68k_options *opts, m68kinst *inst) -{ - code_info *code = &opts->gen.code; - call(code, opts->gen.save_context); - call_args(code, (code_ptr)print_regs_exit, 1, opts->gen.context_reg); -} - #define BIT_SUPERVISOR 5 void translate_m68k_andi_ori_ccr_sr(m68k_options *opts, m68kinst *inst) diff --git a/m68k_internal.h b/m68k_internal.h index 8b891bd..dbfc0df 100644 --- a/m68k_internal.h +++ b/m68k_internal.h @@ -66,7 +66,6 @@ void translate_m68k_move(m68k_options * opts, m68kinst * inst); void translate_m68k_movep(m68k_options * opts, m68kinst * inst); void translate_m68k_arith(m68k_options *opts, m68kinst * inst, uint32_t flag_mask, host_ea *src_op, host_ea *dst_op); void translate_m68k_unary(m68k_options *opts, m68kinst *inst, uint32_t flag_mask, host_ea *dst_op); -void translate_m68k_invalid(m68k_options *opts, m68kinst *inst); void translate_m68k_cmp(m68k_options * opts, m68kinst * inst); void translate_m68k_tas(m68k_options * opts, m68kinst * inst); void translate_m68k_clr(m68k_options * opts, m68kinst * inst); @@ -82,7 +81,6 @@ void translate_m68k_exg(m68k_options *opts, m68kinst *inst, host_ea *src_op, hos void translate_m68k_mul(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op); void translate_m68k_negx(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op); void translate_m68k_rot(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op); -void translate_m68k_illegal(m68k_options *opts, m68kinst *inst); void translate_m68k_andi_ori_ccr_sr(m68k_options *opts, m68kinst *inst); void translate_m68k_eori_ccr_sr(m68k_options *opts, m68kinst *inst); void translate_m68k_move_ccr_sr(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op); |