From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] Add realmode test for jcxz instruction Date: Thu, 19 Aug 2010 16:05:42 +0300 Message-ID: <4C6D2C26.7030604@redhat.com> References: <4C6CCE6C.4010502@cn.fujitsu.com> <4C6CCEF7.9040404@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Wei Yongjun Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57264 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927Ab0HSNFv (ORCPT ); Thu, 19 Aug 2010 09:05:51 -0400 In-Reply-To: <4C6CCEF7.9040404@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/19/2010 09:28 AM, Wei Yongjun wrote: > Signed-off-by: Wei Yongjun > > diff --git a/x86/realmode.c b/x86/realmode.c > index ce8fb18..0caf388 100644 > --- a/x86/realmode.c > +++ b/x86/realmode.c > @@ -1262,6 +1262,32 @@ void test_cbw(void) > print_serial("cwde test 1: PASS\n"); > } > > +void test_jcxz(void) > +{ > + struct regs inregs = { 0 }, outregs; > + > + MK_INSN(jcxz, "jcxz 1f\n\t" > + "mov $0x1234, %eax\n\t" > + "1:\n\t"); > + MK_INSN(jecxz, "jecxz 1f\n\t" > + "mov $0x1234, %eax\n\t" > + "1:\n\t"); > + > + exec_in_big_real_mode(&inregs, &outregs, > + insn_jcxz, insn_jcxz_end - insn_jcxz); > + if(!regs_equal(&inregs, &outregs, 0)) > + print_serial("JCXZ short Test 1: FAIL\n"); > + else > + print_serial("JCXZ short Test 1: PASS\n"); > + > + exec_in_big_real_mode(&inregs, &outregs, > + insn_jecxz, insn_jecxz_end - insn_jecxz); > + if(!regs_equal(&inregs, &outregs, 0)) > + print_serial("JECXZ short Test 1: FAIL\n"); > + else > + print_serial("JECXZ short Test 1: PASS\n"); > +} > + What about tests for jump-not-taken? As a bonus, check jcxz with ecx=0x10000 and jecxz with ecx=0x10000. -- error compiling committee.c: too many arguments to function