summaryrefslogtreecommitdiff
path: root/m68k_to_x86.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2014-06-23 11:46:56 -0400
committerMike Pavone <pavone@retrodev.com>2014-06-23 11:46:56 -0400
commitf1a97be9f7d1a939b3b1920c1764bf872edef10f (patch)
tree258883ae2b432dad49d3096329e0e0b78f4c8bf9 /m68k_to_x86.c
parent85cfa2bb7834854e587f466cb877b4bf5ed7966e (diff)
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
Diffstat (limited to 'm68k_to_x86.c')
-rw-r--r--m68k_to_x86.c6
1 files changed, 6 insertions, 0 deletions
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);