From patchwork Wed May 12 14:00:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 99008 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CE1511030234 for ; Wed, 12 May 2010 14:01:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755802Ab0ELOBD (ORCPT ); Wed, 12 May 2010 10:01:03 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:63254 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755633Ab0ELOBB (ORCPT ); Wed, 12 May 2010 10:01:01 -0400 Received: by mail-ww0-f46.google.com with SMTP id 18so2314wwi.19 for ; Wed, 12 May 2010 07:01:00 -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=18+HOvQRwNL//hOsVE3kdWRFcAjk+0W2iTFMLkUJlb4=; b=fHDFfXalmnPNt31/T9uN9uTVDSGNonG0wQQLSXNaKxToXyrSAvNw+nbLbN4R6oWwrW hvxRgD9qWonlr+zD5dVZuyfe7tKglFptIekUmukvxFeRUBQjjQXOukd4D3j51AIQVFNG V3beBJJyNUIZnyL2IZ4/fiIFvqCW8Xb+Dwisc= 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=ZBd8B2n5Jex4SHQmctWLJGR1T04VoNejqD9IXdBPETZdfUxu5uJ9M22zAfQ+P+PgUk 9KvIx8VLoUdLiCxfaCtxucdmmFTXeHAwBsM1/N/yb5v9NPwBnhtJTejkTDY3Ixj9is7D hMKu3bsUl5k0Hw/x6RZqIOUVVb3zxsRdLQJDs= Received: by 10.216.91.15 with SMTP id g15mr3403035wef.15.1273672860794; Wed, 12 May 2010 07:01:00 -0700 (PDT) Received: from localhost ([41.237.143.60]) by mx.google.com with ESMTPS id v59sm145808wec.15.2010.05.12.07.00.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 12 May 2010 07:00:58 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH 2/2] test: Add test for xor acc, imm Date: Wed, 12 May 2010 17:00:44 +0300 Message-Id: <1273672844-14607-2-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1273672844-14607-1-git-send-email-m.gamal005@gmail.com> References: <1273672844-14607-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]); Wed, 12 May 2010 14:01:06 +0000 (UTC) diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c index 41e2aea..70a1e05 100644 --- a/kvm/user/test/x86/realmode.c +++ b/kvm/user/test/x86/realmode.c @@ -350,6 +350,50 @@ void test_sub_imm(void) print_serial("sub test 4: PASS\n"); } + +void test_xor_imm(void) +{ + struct regs inregs = { 0 }, outregs; + MK_INSN(xor_r32_imm_1, "mov $1234567890, %eax\n\t" "xor $1234567890, %eax\n\t"); + MK_INSN(xor_r16_imm_1, "mov $1234, %ax\n\t" "xor $1234, %ax\n\t"); + MK_INSN(xor_r8_imm_1, "mov $0x12, %ah\n\t" "xor $0x12, %ah\n\t"); + MK_INSN(xor_r8_imm_2, "mov $0x34, %al\n\t" "xor $0x34, %al\n\t"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_xor_r16_imm_1, + insn_xor_r16_imm_1_end - insn_xor_r16_imm_1); + if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0) + print_serial("xor test 1: FAIL\n"); + else + print_serial("xor test 1: PASS\n"); + + /* test mov $imm, %eax */ + exec_in_big_real_mode(&inregs, &outregs, + insn_xor_r32_imm_1, + insn_xor_r32_imm_1_end - insn_xor_r32_imm_1); + if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0) + print_serial("xor test 2: FAIL\n"); + else + print_serial("xor test 2: PASS\n"); + + /* test mov $imm, %al/%ah */ + exec_in_big_real_mode(&inregs, &outregs, + insn_xor_r8_imm_1, + insn_xor_r8_imm_1_end - insn_xor_r8_imm_1); + if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0) + print_serial("xor test 3: FAIL\n"); + else + print_serial("xor test 3: PASS\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_xor_r8_imm_2, + insn_xor_r8_imm_2_end - insn_xor_r8_imm_2); + if (!regs_equal(&inregs, &outregs, R_AX) || outregs.eax != 0) + print_serial("xor test 4: FAIL\n"); + else + print_serial("xor test 4: PASS\n"); +} + void test_cmp_imm(void) { struct regs inregs = { 0 }, outregs; @@ -786,6 +830,7 @@ void realmode_start(void) test_cmp_imm(); test_add_imm(); test_sub_imm(); + test_xor_imm(); test_io(); test_eflags_insn(); test_jcc_short();