From patchwork Fri Sep 2 10:12:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 113097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4948AB6F7F for ; Fri, 2 Sep 2011 20:13:14 +1000 (EST) Received: from localhost ([::1]:53206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQkH-0002Ei-8i for incoming@patchwork.ozlabs.org; Fri, 02 Sep 2011 06:13:09 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQk9-000225-O0 for qemu-devel@nongnu.org; Fri, 02 Sep 2011 06:13:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzQk8-0006Ul-Jo for qemu-devel@nongnu.org; Fri, 02 Sep 2011 06:13:01 -0400 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:58426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzQk8-0006Uc-Bn for qemu-devel@nongnu.org; Fri, 02 Sep 2011 06:13:00 -0400 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p82ACwRP023543 for ; Fri, 2 Sep 2011 10:12:58 GMT Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p82ACwka2396278 for ; Fri, 2 Sep 2011 11:12:58 +0100 Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p82ACsWQ032017 for ; Fri, 2 Sep 2011 04:12:54 -0600 Received: from stefanha-thinkpad.manchester-maybrook.uk.ibm.com (dyn-9-174-219-30.manchester-maybrook.uk.ibm.com [9.174.219.30]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p82ACrA9031991; Fri, 2 Sep 2011 04:12:54 -0600 From: Stefan Hajnoczi To: Date: Fri, 2 Sep 2011 11:12:51 +0100 Message-Id: <1314958372-23513-3-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1314958372-23513-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1314958372-23513-1-git-send-email-stefanha@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.162 Cc: Boris Figovsky , Anthony Liguori , Boris Figovsky , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 2/3] x86: fix daa opcode for al register values higher than 0xf9 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Boris Figovsky The second if statement should consider the original al register value, and not the new one. Signed-off-by: Boris Figovsky Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- target-i386/op_helper.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 1bbc3b5..1fc248f 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; }