test: Add emulator test for iret instruction
PATCH 1/1 test: Add emulator test for iret instruction
This adds a unit test for real mode emulation of the iret instruction
Signed-off-by Mohammed Gamal <[email protected]>
--- kvm/test/x86/realmode.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
kvm/test/x86/realmode.c +23 -0
@@ -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,R_AX )) +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 ); }
Signature · 1 line
1.7.0.4