From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yongjun Subject: [PATCH] test: Add real mode test for cbw/cwde instruction Date: Wed, 18 Aug 2010 16:44:42 +0800 Message-ID: <4C6B9D7A.70301@cn.fujitsu.com> References: <4C6B9D21.1090103@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit To: Avi Kivity , kvm@vger.kernel.org Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:49778 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752532Ab0HRIrE (ORCPT ); Wed, 18 Aug 2010 04:47:04 -0400 In-Reply-To: <4C6B9D21.1090103@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Wei Yongjun --- x86/realmode.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index bedd175..ce8fb18 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1236,6 +1236,32 @@ void test_loopcc(void) print_serial("LOOPcc short Test 3: PASS\n"); } +void test_cbw(void) +{ + struct regs inregs = { 0 }, outregs; + + MK_INSN(cbw, "mov $0xFE, %eax \n\t" + "cbw\n\t"); + MK_INSN(cwde, "mov $0xFFFE, %eax \n\t" + "cwde\n\t"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_cbw, + insn_cbw_end - insn_cbw); + if (outregs.eax != 0xFFFE) + print_serial("cbw test1: FAIL\n"); + else + print_serial("cbw test 1: PASS\n"); + + exec_in_big_real_mode(&inregs, &outregs, + insn_cwde, + insn_cwde_end - insn_cwde); + if (outregs.eax != 0xFFFFFFFE) + print_serial("cwde test1: FAIL\n"); + else + print_serial("cwde test 1: PASS\n"); +} + void realmode_start(void) { test_null(); @@ -1264,6 +1290,7 @@ void realmode_start(void) test_div(); test_idiv(); test_loopcc(); + test_cbw(); exit(0); } -- 1.7.0.4