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"); +} + void realmode_start(void) { test_null(); @@ -886,6 +908,7 @@ void realmode_start(void) /* long jmp test uses call near so test it after testing call */ test_long_jmp(); test_xchg(); + test_iret(); exit(0); } -- 1.7.0.4 -- 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