summaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorBoris Figovsky <boris.figovsky@ravellosystems.com>2011-08-30 10:00:55 +0300
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-09-02 11:08:44 +0100
commitc6bfc164e8f929e1e6a79f7b5a3cf096b22ef5f3 (patch)
treecdef47e029336ea1cd56178c2e9ce192404352a9 /target-i386
parent6f9faa91f5fb3a866f5bf592207c9498a017740d (diff)
downloadqemu-c6bfc164e8f929e1e6a79f7b5a3cf096b22ef5f3.tar.gz
x86: fix daa opcode for al register values higher than 0xf9
The second if statement should consider the original al register value, and not the new one. Signed-off-by: Boris Figovsky <boris.figovksy@ravellosystems.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/op_helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 1bbc3b56dc..1fc248fa17 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -1970,20 +1970,20 @@ void helper_aas(void)
void helper_daa(void)
{
- int al, af, cf;
+ int old_al, al, af, cf;
int eflags;
eflags = helper_cc_compute_all(CC_OP);
cf = eflags & CC_C;
af = eflags & CC_A;
- al = EAX & 0xff;
+ old_al = al = EAX & 0xff;
eflags = 0;
if (((al & 0x0f) > 9 ) || af) {
al = (al + 6) & 0xff;
eflags |= CC_A;
}
- if ((al > 0x9f) || cf) {
+ if ((old_al > 0x99) || cf) {
al = (al + 0x60) & 0xff;
eflags |= CC_C;
}