diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-10-06 09:34:31 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-10-06 09:34:31 -0700 |
commit | 986b3641a1110e7dd1994c76ecb592420877f8f5 (patch) | |
tree | c6079b2fcbe228e3957dc435bad7d6e92e8a3c63 /m68k_core_x86.c | |
parent | 9b16317e1842af9b71837a43ffba04ca45689dcc (diff) |
Add support for specifying a reset handler in the M68K core. Adjust memory map initialization to handle extra field. Improved handling of out of bounds execution.
Diffstat (limited to 'm68k_core_x86.c')
-rw-r--r-- | m68k_core_x86.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/m68k_core_x86.c b/m68k_core_x86.c index c07760b..6ad305d 100644 --- a/m68k_core_x86.c +++ b/m68k_core_x86.c @@ -1156,6 +1156,21 @@ void translate_shift(m68k_options * opts, m68kinst * inst, host_ea *src_op, host } } +void translate_m68k_reset(m68k_options *opts, m68kinst *inst) +{ + code_info *code = &opts->gen.code; + cycles(&opts->gen, BUS); + mov_rdispr(code, opts->gen.context_reg, offsetof(m68k_context, reset_handler), opts->gen.scratch1, SZ_PTR); + cmp_ir(code, 0, opts->gen.scratch1, SZ_PTR); + code_ptr no_reset_handler = code->cur + 1; + jcc(code, CC_Z, code->cur+2); + call(code, opts->gen.save_context); + call_args_r(code, opts->gen.scratch1, 1, opts->gen.context_reg); + mov_rr(code, RAX, opts->gen.context_reg, SZ_PTR); + call(code, opts->gen.load_context); + *no_reset_handler = code->cur - (no_reset_handler + 1); +} + void op_ir(code_info *code, m68kinst *inst, int32_t val, uint8_t dst, uint8_t size) { switch (inst->op) @@ -2220,10 +2235,16 @@ void translate_m68k_move_from_sr(m68k_options *opts, m68kinst *inst, host_ea *sr m68k_save_result(inst, opts); } -void translate_out_of_bounds(code_info *code) +void m68k_out_of_bounds_execution(uint32_t address) +{ + fatal_error("M68K attempted to execute code at unmapped or I/O address %X\n", address); +} + +void translate_out_of_bounds(m68k_options *opts, uint32_t address) { - xor_rr(code, RDI, RDI, SZ_D); - call_args(code, (code_ptr)exit, 1, RDI); + code_info *code = &opts->gen.code; + mov_ir(code, address, opts->gen.scratch1, SZ_D); + call_args(code, (code_ptr)m68k_out_of_bounds_execution, 1, opts->gen.scratch1); } void m68k_set_last_prefetch(m68k_options *opts, uint32_t address) |