From e9348e64584c3fdc88bc6de533216f09b679126d Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Fri, 28 Dec 2012 17:59:41 -0800 Subject: Defer the correct address for pc relative jsr/jmp --- m68k_to_x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'm68k_to_x86.c') diff --git a/m68k_to_x86.c b/m68k_to_x86.c index 06d0e63..f83165c 100644 --- a/m68k_to_x86.c +++ b/m68k_to_x86.c @@ -1449,7 +1449,7 @@ uint8_t * translate_m68k_jmp(uint8_t * dst, m68kinst * inst, x86_68k_options * o dst = cycles(dst, 10); dest_addr = get_native_address(opts->native_code_map, inst->src.params.regs.displacement + inst->address + 2); if (!dest_addr) { - opts->deferred = defer_address(opts->deferred, inst->src.params.immed, dst + 1); + opts->deferred = defer_address(opts->deferred, inst->src.params.regs.displacement + inst->address + 2, dst + 1); //dummy address to be replaced later, make sure it generates a 4-byte displacement dest_addr = dst + 256; } @@ -1557,7 +1557,7 @@ uint8_t * translate_m68k_jsr(uint8_t * dst, m68kinst * inst, x86_68k_options * o dst = call(dst, (char *)m68k_write_long_highfirst); dest_addr = get_native_address(opts->native_code_map, inst->src.params.regs.displacement + inst->address + 2); if (!dest_addr) { - opts->deferred = defer_address(opts->deferred, inst->src.params.immed, dst + 1); + opts->deferred = defer_address(opts->deferred, inst->src.params.regs.displacement + inst->address + 2, dst + 1); //dummy address to be replaced later, make sure it generates a 4-byte displacement dest_addr = dst + 5; } -- cgit v1.2.3