From patchwork Wed Aug 18 08:44:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 120114 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 o7I8lEjG021077 for ; Wed, 18 Aug 2010 08:47:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534Ab0HRIrF (ORCPT ); Wed, 18 Aug 2010 04:47:05 -0400 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 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 5A5C4170028; Wed, 18 Aug 2010 16:47:02 +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 o7I8hnxg019577; Wed, 18 Aug 2010 16:43:49 +0800 Received: from [10.167.141.76] (unknown [10.167.141.76]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 85AD414C01C; Wed, 18 Aug 2010 16:48:04 +0800 (CST) Message-ID: <4C6B9D7A.70301@cn.fujitsu.com> Date: Wed, 18 Aug 2010 16:44:42 +0800 From: Wei Yongjun User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100528 Thunderbird/3.0.5 MIME-Version: 1.0 To: Avi Kivity , kvm@vger.kernel.org Subject: [PATCH] test: Add real mode test for cbw/cwde instruction References: <4C6B9D21.1090103@cn.fujitsu.com> In-Reply-To: <4C6B9D21.1090103@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]); Wed, 18 Aug 2010 08:47:14 +0000 (UTC) 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); }