From f1a97be9f7d1a939b3b1920c1764bf872edef10f Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Mon, 23 Jun 2014 11:46:56 -0400 Subject: 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 --- m68k_to_x86.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'm68k_to_x86.c') diff --git a/m68k_to_x86.c b/m68k_to_x86.c index 886cc08..b46a5c3 100644 --- a/m68k_to_x86.c +++ b/m68k_to_x86.c @@ -4492,11 +4492,17 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk * memmap, uint32_t num_chu } } 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); -- cgit v1.2.3