summaryrefslogtreecommitdiff
path: root/m68k_core.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-05-04 21:06:35 -0700
committerMichael Pavone <pavone@retrodev.com>2017-05-04 21:06:35 -0700
commit88f286ec0fe45cc08fb801cb609faa1a808c9be9 (patch)
tree835ae122b1f82c705bce57702c300903655609a0 /m68k_core.c
parent274dececcc084ba86026d8ac3f18edf915f79f24 (diff)
Fix intermittent crash due to an inadvertent executable memory allocation in m68k instruction retranslation
Diffstat (limited to 'm68k_core.c')
-rw-r--r--m68k_core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/m68k_core.c b/m68k_core.c
index a3a3c32..1faa3c0 100644
--- a/m68k_core.c
+++ b/m68k_core.c
@@ -1095,10 +1095,12 @@ void * m68k_retranslate_inst(uint32_t address, m68k_context * context)
code_ptr native_end = code->cur;
code->cur = native_start + MAX_NATIVE_SIZE;
code_ptr rest = get_native_address_trans(context, orig + (after-inst)*2);
- code_ptr tmp = code->cur;
- code->cur = native_end;
- jmp(code, rest);
- code->cur = tmp;
+ code_info tmp_code = {
+ .cur = native_end,
+ .last = native_start + MAX_NATIVE_SIZE,
+ .stack_off = code->stack_off
+ };
+ jmp(&tmp_code, rest);
} else {
code->cur = native_start + MAX_NATIVE_SIZE;
}