comparison backend_x86.c @ 1107:fc125af5e4f1

Fix to the fix of handling of self modifying code. Was ORing the base address with the wrong register before calling the modified code handler
author Michael Pavone <pavone@retrodev.com>
date Mon, 12 Dec 2016 19:21:22 -0800
parents f0a1e0a2263c
children 4bc27caa6e20
comparison
equal deleted inserted replaced
1106:cacbd3f18f03 1107:fc125af5e4f1
229 ram_flags_off += (memmap[chunk].mask + 1) / (1 << opts->ram_flags_shift) / 8;; 229 ram_flags_off += (memmap[chunk].mask + 1) / (1 << opts->ram_flags_shift) / 8;;
230 } 230 }
231 code_ptr not_code = code->cur + 1; 231 code_ptr not_code = code->cur + 1;
232 jcc(code, CC_NC, code->cur + 2); 232 jcc(code, CC_NC, code->cur + 2);
233 if (memmap[chunk].mask != opts->address_mask) { 233 if (memmap[chunk].mask != opts->address_mask) {
234 or_ir(code, memmap[chunk].start, opts->scratch1, opts->address_size); 234 or_ir(code, memmap[chunk].start, opts->scratch2, opts->address_size);
235 } 235 }
236 call(code, opts->save_context); 236 call(code, opts->save_context);
237 call_args(code, opts->handle_code_write, 2, opts->scratch2, opts->context_reg); 237 call_args(code, opts->handle_code_write, 2, opts->scratch2, opts->context_reg);
238 mov_rr(code, RAX, opts->context_reg, SZ_PTR); 238 mov_rr(code, RAX, opts->context_reg, SZ_PTR);
239 jmp(code, opts->load_context); 239 jmp(code, opts->load_context);