From patchwork Sun Aug 8 18:13:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 118290 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o78IDrx7017230 for ; Sun, 8 Aug 2010 18:13:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753922Ab0HHSNv (ORCPT ); Sun, 8 Aug 2010 14:13:51 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:58294 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753641Ab0HHSNu (ORCPT ); Sun, 8 Aug 2010 14:13:50 -0400 Received: by wwj40 with SMTP id 40so10846162wwj.1 for ; Sun, 08 Aug 2010 11:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=QspNAIfT12wYQaIpDkEeu9nkL2x1++CiNWxeTqzQy/k=; b=lxGwOeGopNOZVOTOjBCRh62DUwendNdALu640oXUMYN1Kagioksl9MNUqiGtykBqCj YijZhVCU7gi3B2FiHtxeSHkc2Wj9lpC4t+wH6SS3644j/+ta3qfBZE4wTnzy+UNiR+xd rrjUzsyzayF89MA0fRszfmFPozLZ7ZXIceqGA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=Mwg/gIyVMRvzYJPGkiTTG/kRb2DB6tO8d4G+Rf2Hz/3ovNgSQRKPoXAC7UMUm824dL OzGiJWQRngdcSbu0oMJypPaHgn19cGh3Y6MRqOti70q3D50tgTUV/t7cT/po29Kly8Mp 3tFpzwv7ImHdKOfTOwicrSe0DYteZFXRrCyAs= Received: by 10.216.22.203 with SMTP id t53mr7683101wet.37.1281291229434; Sun, 08 Aug 2010 11:13:49 -0700 (PDT) Received: from localhost.localdomain ([188.48.101.98]) by mx.google.com with ESMTPS id w14sm2096726weq.9.2010.08.08.11.13.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 08 Aug 2010 11:13:49 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH v2 2/3] test: Add real mode test for mul instruction Date: Sun, 8 Aug 2010 21:13:32 +0300 Message-Id: <1281291213-4691-2-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1281291213-4691-1-git-send-email-m.gamal005@gmail.com> References: <1281291213-4691-1-git-send-email-m.gamal005@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 08 Aug 2010 18:13:54 +0000 (UTC) diff --git a/x86/realmode.c b/x86/realmode.c index 5878396..582d0be 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1060,6 +1060,50 @@ void test_imul() print_serial("imul Test 6: PASS\n"); } +void test_mul() +{ + struct regs inregs = { 0 }, outregs; + + MK_INSN(mul8, "mov $2, %al\n\t" + "mov $4, %cx\n\t" + "imul %cl\n\t"); + + MK_INSN(mul16, "mov $2, %ax\n\t" + "mov $4, %cx\n\t" + "imul %cx\n\t"); + + MK_INSN(mul32, "mov $2, %eax\n\t" + "mov $4, %ecx\n\t" + "imul %ecx\n\t"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_mul8, + insn_mul8_end - insn_mul8); + + if (!regs_equal(&inregs, &outregs, R_AX | R_CX | R_DX) || (outregs.eax & 0xff) != 8) + print_serial("mul Test 1: FAIL\n"); + else + print_serial("mul Test 1: PASS\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_mul16, + insn_mul16_end - insn_mul16); + + if (!regs_equal(&inregs, &outregs, R_AX | R_CX | R_DX) || outregs.eax != 8) + print_serial("mul Test 2: FAIL\n"); + else + print_serial("mul Test 2: PASS\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_mul32, + insn_mul32_end - insn_mul32); + + if (!regs_equal(&inregs, &outregs, R_AX | R_CX | R_DX) || outregs.eax != 8) + print_serial("mul Test 3: FAIL\n"); + else + print_serial("mul Test 3: PASS\n"); +} + void realmode_start(void) { test_null(); @@ -1084,6 +1128,7 @@ void realmode_start(void) test_iret(); test_int(); test_imul(); + test_mul(); exit(0); }