From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] test: Add emulator test for iret instruction Date: Wed, 28 Jul 2010 07:21:51 +0300 Message-ID: <4C4FB05F.7060301@redhat.com> References: <1280272922-1997-1-git-send-email-m.gamal005@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx1.redhat.com ([209.132.183.28]:18770 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757Ab0G1EV5 (ORCPT ); Wed, 28 Jul 2010 00:21:57 -0400 In-Reply-To: <1280272922-1997-1-git-send-email-m.gamal005@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/28/2010 02:22 AM, Mohammed Gamal wrote: > This adds a unit test for real mode emulation of the iret instruction > > Signed-off-by: Mohammed Gamal > --- > kvm/test/x86/realmode.c | 23 +++++++++++++++++++++++ > 1 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/kvm/test/x86/realmode.c b/kvm/test/x86/realmode.c > index bd79348..16716cc 100644 > --- a/kvm/test/x86/realmode.c > +++ b/kvm/test/x86/realmode.c > @@ -865,6 +865,28 @@ void test_pusha_popa() > print_serial("Pusha/Popa Test2: PASS\n"); > } > > +void test_iret() > +{ > + struct regs inregs = { 0 }, outregs; > + > + MK_INSN(iret, "pushf\n\t" > + "pushl %cs\n\t" > + "call 1f\n\t" /* a near call will push eip onto the stack */ > + "jmp 2f\n\t" > + "1:iret\n\t" > + "2:\n\t" > + ); > + > + exec_in_big_real_mode(&inregs,&outregs, > + insn_iret, > + insn_iret_end - insn_iret); > + > + if (!regs_equal(&inregs,&outregs, 0)) > + print_serial("iret Test 1: FAIL\n"); > + else > + print_serial("iret Test 1: PASS\n"); > +} > + This tests 32-bit iret, please test 16-bit iret as well (pushfw, pushw cs, callw, iretw). -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.