summaryrefslogtreecommitdiff
path: root/m68k_core_x86.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-05-25 13:21:24 -0700
committerMichael Pavone <pavone@retrodev.com>2015-05-25 13:21:24 -0700
commitf76857783001f197067e6a8728e76046da8b9e6f (patch)
tree6cd85611b7e4e7fb0b40bcaa3ac55cc7a1b6ae4d /m68k_core_x86.c
parent64a79c95cbbb23079d0da1eca89c3a676725dfae (diff)
Fix div instruction when dest is d0 in 32-bit build
Diffstat (limited to 'm68k_core_x86.c')
-rw-r--r--m68k_core_x86.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/m68k_core_x86.c b/m68k_core_x86.c
index 5c459b0..ed0265b 100644
--- a/m68k_core_x86.c
+++ b/m68k_core_x86.c
@@ -1698,8 +1698,13 @@ void translate_m68k_div(m68k_options *opts, m68kinst *inst, host_ea *src_op, hos
}
cmp_ir(code, 0, RAX, SZ_W);
pop_r(code, RAX);
- pop_r(code, RDX);
- update_flags(opts, V0|Z|N);
+ if (dst_op->base == RDX) {
+ update_flags(opts, V0|Z|N);
+ add_ir(code, sizeof(void *), RSP, SZ_D);
+ } else {
+ pop_r(code, RDX);
+ update_flags(opts, V0|Z|N);
+ }
code_ptr end_off = code->cur + 1;
jmp(code, code->cur + 2);
*norm_off = code->cur - (norm_off + 1);