changeset 561:666adeba5a61

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
author Mike Pavone <pavone@retrodev.com>
date Mon, 23 Jun 2014 11:46:56 -0400
parents f9431cb3a39c
children e13f4fd9cf6d
files m68k_to_x86.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);