From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yongjun Subject: [PATCH] test: add test for pusha and popa instructions Date: Tue, 15 Jun 2010 10:10:15 +0800 Message-ID: <4C16E107.8010007@cn.fujitsu.com> References: <4C16D0A0.2090203@cn.fujitsu.com> <4C16D165.8020406@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Avi Kivity , Marcelo Tosatti Return-path: 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 In-Reply-To: <4C16D165.8020406@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: This patch add test for pusha and popa instructions. Signed-off-by: Wei Yongjun --- kvm/test/x86/realmode.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) 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(); -- 1.7.0.4