From patchwork Tue Jun 15 02:10:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 106098 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 o5F2D5S5031278 for ; Tue, 15 Jun 2010 02:13:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757278Ab0FOCMf (ORCPT ); Mon, 14 Jun 2010 22:12:35 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:52007 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752902Ab0FOCMT (ORCPT ); Mon, 14 Jun 2010 22:12:19 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 008C9170135; Tue, 15 Jun 2010 10:12:17 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o5F29tPG000815; Tue, 15 Jun 2010 10:09:55 +0800 Received: from [10.167.141.76] (unknown [10.167.141.76]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 5D11C10C0DB; Tue, 15 Jun 2010 10:12:04 +0800 (CST) Message-ID: <4C16E107.8010007@cn.fujitsu.com> Date: Tue, 15 Jun 2010 10:10:15 +0800 From: Wei Yongjun User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti CC: kvm@vger.kernel.org Subject: [PATCH] test: add test for pusha and popa instructions References: <4C16D0A0.2090203@cn.fujitsu.com> <4C16D165.8020406@cn.fujitsu.com> In-Reply-To: <4C16D165.8020406@cn.fujitsu.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]); Tue, 15 Jun 2010 02:13:06 +0000 (UTC) diff --git a/kvm/test/x86/realmode.c b/kvm/test/x86/realmode.c index 70a1e05..bd79348 100644 --- a/kvm/test/x86/realmode.c +++ b/kvm/test/x86/realmode.c @@ -820,12 +820,58 @@ void test_null(void) print_serial("null test: PASS\n"); } +void test_pusha_popa() +{ + struct regs inregs = { .eax = 0, .ebx = 1, .ecx = 2, .edx = 3, .esi = 4, .edi = 5, .ebp = 6, .esp = 7}, outregs; + + MK_INSN(pusha, "pusha\n\t" + "pop %edi\n\t" + "pop %esi\n\t" + "pop %ebp\n\t" + "pop %eax\n\t" + "pop %ebx\n\t" + "pop %edx\n\t" + "pop %ecx\n\t" + "pop %esp\n\t" + "xchg %esp, %eax\n\t" + ); + + MK_INSN(popa, "push %eax\n\t" + "push %ecx\n\t" + "push %edx\n\t" + "push %ebx\n\t" + "push %esp\n\t" + "push %ebp\n\t" + "push %esi\n\t" + "push %edi\n\t" + "popa\n\t" + ); + + exec_in_big_real_mode(&inregs, &outregs, + insn_pusha, + insn_pusha_end - insn_pusha); + + if (!regs_equal(&inregs, &outregs, 0)) + print_serial("Pusha/Popa Test1: FAIL\n"); + else + print_serial("Pusha/Popa Test1: PASS\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_popa, + insn_popa_end - insn_popa); + if (!regs_equal(&inregs, &outregs, 0)) + print_serial("Pusha/Popa Test2: FAIL\n"); + else + print_serial("Pusha/Popa Test2: PASS\n"); +} + void realmode_start(void) { test_null(); test_shld(); test_push_pop(); + test_pusha_popa(); test_mov_imm(); test_cmp_imm(); test_add_imm();