# HG changeset patch # User Mike Pavone # Date 1403538416 14400 # Node ID 666adeba5a6184c179f3a56dbbc21bd504e7fc66 # Parent f9431cb3a39c065dc3c5669ac6921eb0e0218ccb Save and restore guest address in the write function for a code memory chunk in the "slow" path for inconvenient host addresses. This fixes an intermittent crash on OSX in the code that checks whether the memory written may contain code diff -r f9431cb3a39c -r 666adeba5a61 m68k_to_x86.c --- a/m68k_to_x86.c Mon Jun 23 11:05:55 2014 -0400 +++ b/m68k_to_x86.c Mon Jun 23 11:46:56 2014 -0400 @@ -4492,11 +4492,17 @@ } } else { if (is_write) { + if (memmap[chunk].flags & MMAP_CODE) { + dst = push_r(dst, SCRATCH2); + } dst = push_r(dst, SCRATCH1); dst = mov_ir(dst, (intptr_t)memmap[chunk].buffer, SCRATCH1, SZ_PTR); dst = add_rr(dst, SCRATCH1, SCRATCH2, SZ_PTR); dst = pop_r(dst, SCRATCH1); dst = mov_rrind(dst, SCRATCH1, SCRATCH2, tmp_size); + if (memmap[chunk].flags & MMAP_CODE) { + dst = pop_r(dst, SCRATCH2); + } } else { dst = mov_ir(dst, (intptr_t)memmap[chunk].buffer, SCRATCH2, SZ_PTR); dst = mov_rindexr(dst, SCRATCH2, SCRATCH1, 0, SCRATCH1, tmp_size);