Re: [PATCH] test: Add emulator test for iret instruction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 28, 2010 at 11:28:05PM +0300, Mohammed Gamal wrote:
> On Wed, Jul 28, 2010 at 10:55 PM, Marcelo Tosatti <mtosatti@xxxxxxxxxx> wrote:
> > On Wed, Jul 28, 2010 at 12:39:01PM +0300, Mohammed Gamal wrote:
> >> This adds a unit test for real mode emulation of the iret instruction
> >>
> >> Signed-off-by: Mohammed Gamal <m.gamal005@xxxxxxxxx>
> >>
> >> ---
> >> Changes from v1:
> >> - Added test for 16-bit iret
> >> - Added tests for returned eflags
> >> ---
> >>  kvm/test/x86/realmode.c |   79 +++++++++++++++++++++++++++++++++++++++++++++++
> >>  1 files changed, 79 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/kvm/test/x86/realmode.c b/kvm/test/x86/realmode.c
> >> index bd79348..74456c3 100644
> >> --- a/kvm/test/x86/realmode.c
> >> +++ b/kvm/test/x86/realmode.c
> >> @@ -865,6 +865,84 @@ void test_pusha_popa()
> >>               print_serial("Pusha/Popa Test2: PASS\n");
> >>  }
> >>
> >> +void test_iret()
> >> +{
> >> +     struct regs inregs = { 0 }, outregs;
> >> +
> >> +     MK_INSN(iret32, "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"
> >> +                  );
> >> +
> >> +     MK_INSN(iret16, "pushfw\n\t"
> >> +                     "pushw %cs\n\t"
> >> +                     "callw 1f\n\t"
> >> +                     "jmp 2f\n\t"
> >> +                     "1: iretw\n\t"
> >> +                     "2:\n\t");
> >
> > Unless iret causes a task switch, it will not cause an exit.
> >
> >
> The test covers only the real mode case, we won't have a task switch there, no?

No. And there is no vmexit for iret, so it does not go through the
emulator.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux