Mercurial > repos > blastem
diff z80_to_x86.c @ 390:561fe3ea3fc8
Use a call instruction to figure out the original native address when retranslating so that it does not get lost when the byte transforms from a instruction word to extension word
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 08 Jun 2013 11:31:52 -0700 |
parents | 3815ad1e684e |
children | d5f1840273b5 |
line wrap: on
line diff
--- a/z80_to_x86.c Thu Jun 06 08:45:54 2013 -0700 +++ b/z80_to_x86.c Sat Jun 08 11:31:52 2013 -0700 @@ -1742,7 +1742,7 @@ uint8_t * dst = z80_get_native_address(context, inst_start); dprintf("patching code at %p for Z80 instruction at %X due to write to %X\n", dst, inst_start, address); dst = mov_ir(dst, inst_start, SCRATCH1, SZ_D); - dst = jmp(dst, (uint8_t *)z80_retrans_stub); + dst = call(dst, (uint8_t *)z80_retrans_stub); } return context; } @@ -1769,12 +1769,11 @@ } } -void * z80_retranslate_inst(uint32_t address, z80_context * context) +void * z80_retranslate_inst(uint32_t address, z80_context * context, uint8_t * orig_start) { char disbuf[80]; x86_z80_options * opts = context->options; uint8_t orig_size = z80_get_native_inst_size(opts, address); - uint8_t * orig_start = z80_get_native_address(context, address); uint32_t orig = address; address &= 0x1FFF; uint8_t * dst = opts->cur_code;