From 85a13fa44481d4dafd548ed0e92654a9d6aea62f Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 27 Jun 2015 13:18:55 -0700 Subject: Preserve scratch2 when using it as a temporary in memory read functions. This fixes a bunch of issues with the Z80 core and possibly some issues with the 68K core as well --- backend_x86.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backend_x86.c') diff --git a/backend_x86.c b/backend_x86.c index 3e804b2..f9128ef 100644 --- a/backend_x86.c +++ b/backend_x86.c @@ -171,8 +171,10 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n pop_r(code, opts->scratch1); mov_rrind(code, opts->scratch1, opts->scratch2, tmp_size); } else { + push_r(code, opts->scratch2); mov_ir(code, (intptr_t)memmap[chunk].buffer, opts->scratch2, SZ_PTR); mov_rindexr(code, opts->scratch2, opts->scratch1, 1, opts->scratch1, tmp_size); + pop_r(code, opts->scratch2); } } if (size != tmp_size && !is_write) { -- cgit v1.2.3