From f0d831f2b1e343592d0987dffdb5eb1064bd83ae Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Wed, 26 Dec 2012 18:20:23 -0800 Subject: RTE doesn't crash the emulator anymore --- m68k_to_x86.c | 3 +++ m68k_to_x86.h | 2 +- runtime.S | 12 +++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/m68k_to_x86.c b/m68k_to_x86.c index d53f98b..7a7a90c 100644 --- a/m68k_to_x86.c +++ b/m68k_to_x86.c @@ -479,6 +479,9 @@ uint8_t * m68k_save_result(m68kinst * inst, uint8_t * out, x86_68k_options * opt uint8_t * get_native_address(native_map_slot * native_code_map, uint32_t address) { address &= 0xFFFFFF; + if (address > 0x400000) { + printf("get_native_address: %X\n", address); + } uint32_t chunk = address / NATIVE_CHUNK_SIZE; if (!native_code_map[chunk].base) { return NULL; diff --git a/m68k_to_x86.h b/m68k_to_x86.h index 12d4f8b..a066f39 100644 --- a/m68k_to_x86.h +++ b/m68k_to_x86.h @@ -2,7 +2,7 @@ #include "68kinst.h" #define NUM_MEM_AREAS 4 -#define NATIVE_MAP_CHUNKS (32*1024) +#define NATIVE_MAP_CHUNKS (64*1024) #define NATIVE_CHUNK_SIZE ((16 * 1024 * 1024 / NATIVE_MAP_CHUNKS)/2) #define INVALID_OFFSET 0xFFFFFFFF diff --git a/runtime.S b/runtime.S index 9237ac9..bf7e06d 100644 --- a/runtime.S +++ b/runtime.S @@ -268,10 +268,12 @@ vdp_psg_wb: .global m68k_write_long_lowfirst m68k_write_long_lowfirst: push %rdi + push %rcx add $2, %edi call m68k_write_word - shr $16, %ecx + pop %rcx pop %rdi + shr $16, %ecx jmp m68k_write_word .global m68k_write_long_highfirst @@ -391,8 +393,8 @@ m68k_modified_ret_addr: dyn_addr_msg: .asciz "Program needs dynamically calculated native address\n" - .global m68k_native_addr -m68k_native_addr: + .global m68k_native_addr_and_sync +m68k_native_addr_and_sync: call m68k_save_context push %rcx mov %rsi, %rdi @@ -406,8 +408,8 @@ m68k_native_addr: call m68k_load_context ret - .global m68k_native_addr_and_sync -m68k_native_addr_and_sync: + .global m68k_native_addr +m68k_native_addr: call m68k_save_context push %rsi mov 144(%rsi), %rdi -- cgit v1.2.3