From patchwork Sun Aug 8 02:28:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 118213 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 o782Smut011950 for ; Sun, 8 Aug 2010 02:28:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751879Ab0HHC2q (ORCPT ); Sat, 7 Aug 2010 22:28:46 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:43582 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750699Ab0HHC2p (ORCPT ); Sat, 7 Aug 2010 22:28:45 -0400 Received: by mail-ww0-f44.google.com with SMTP id 40so10473934wwj.1 for ; Sat, 07 Aug 2010 19:28:45 -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=mfQgJ1YdY4bGE1elPjamwcb0CEOOWtxX7R+WVTRk6fY=; b=ItmdASINBKd/RXhniKoCsefIynIk4NKNRYu1u8qNWTorCIp64cQCl+V4YYFLWFsEac +Q3DZvyISzSRDbWqxuCbMASlJJsInNlEi/BhcqlW542kltEutqV42CzbTNkc+kegBKlc 36Wjt+lXN4D8o/u/xUFtkS5PKgesVhyynCSf4= 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=fLtmoM/NSG4+i4r6Y5GtWe70RktbBChuL+04IdciLlpAM19mNL48oslEBl3Wd7pHqO aukEngcdskNjht23ZSHA6hVBRqqz1GOCdqABDEAysRJOjuuaRopkkxWnr9/pdeEIL4nJ VnyPaIeicdlAwXenHgDV966/GmnL//imZKZkk= Received: by 10.227.133.18 with SMTP id d18mr12414898wbt.33.1281234524945; Sat, 07 Aug 2010 19:28:44 -0700 (PDT) Received: from localhost.localdomain ([188.53.16.202]) by mx.google.com with ESMTPS id b18sm2888499wbb.13.2010.08.07.19.28.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 07 Aug 2010 19:28:44 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH 2/3] test: Add real mode test for mul instruction Date: Sun, 8 Aug 2010 05:28:26 +0300 Message-Id: <1281234507-9281-2-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1281234507-9281-1-git-send-email-m.gamal005@gmail.com> References: <1281234507-9281-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 02:28:48 +0000 (UTC) diff --git a/x86/realmode.c b/x86/realmode.c index 439324f..2ca2831 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1059,6 +1059,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(); @@ -1083,6 +1127,7 @@ void realmode_start(void) test_iret(); test_int(); test_imul(); + test_mul(); exit(0); }