# HG changeset patch # User Michael Pavone # Date 1485245727 28800 # Node ID e0fc8967d380456cd993419bac4edde7c44461d1 # Parent 8dc50e50ced6b1ad2a17ad5feb1869bbf0d582b0 Inefficient fix for overlapping instruction problem that was causing issues with Outrunners diff -r 8dc50e50ced6 -r e0fc8967d380 m68k_core_x86.c --- a/m68k_core_x86.c Tue Jan 24 00:02:03 2017 -0800 +++ b/m68k_core_x86.c Tue Jan 24 00:15:27 2017 -0800 @@ -2263,11 +2263,13 @@ } } +#define M68K_MAX_INST_SIZE (2*(1+2+2)) + m68k_context * m68k_handle_code_write(uint32_t address, m68k_context * context) { m68k_options * options = context->options; uint32_t inst_start = get_instruction_start(options, address); - if (inst_start) { + while (inst_start && (address - inst_start) < M68K_MAX_INST_SIZE) { code_info *code = &options->gen.code; code_ptr dst = get_native_address(context->options, inst_start); code_info orig = {dst, dst + 128, 0}; @@ -2284,6 +2286,7 @@ jmp_r(code, options->gen.scratch1); } jmp(&orig, options->retrans_stub); + inst_start = get_instruction_start(options, inst_start - 2); } return context; }