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

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

 



 On 07/28/2010 07:21 AM, Avi Kivity wrote:
 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<m.gamal005@xxxxxxxxx>
---
  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).


Also add tests that set bits that must be zero (and checks that IRET clears them in eflags) or clears bit 1 and sees that IRET sets it.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
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