aboutsummaryrefslogtreecommitdiff
path: root/target-i386/translate.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-23 18:21:26 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-23 18:21:26 +0000
commitb6d7c3db4fd7b375e649b35c2d0722ef00f8fb35 (patch)
treeca23adb627b9c568cc223a3c2f7456cd6894fbe8 /target-i386/translate.c
parente034e2c39aee1800101812045690e0575abb428b (diff)
Fix division by zero handling, by Joris van Rantwijk.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3012 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/translate.c')
-rw-r--r--target-i386/translate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 96e72c9dd8..393db0d65e 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5327,8 +5327,12 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
if (CODE64(s))
goto illegal_op;
val = ldub_code(s->pc++);
- gen_op_aam(val);
- s->cc_op = CC_OP_LOGICB;
+ if (val == 0) {
+ gen_exception(s, EXCP00_DIVZ, pc_start - s->cs_base);
+ } else {
+ gen_op_aam(val);
+ s->cc_op = CC_OP_LOGICB;
+ }
break;
case 0xd5: /* aad */
if (CODE64(s))