Skip to contentSkip to conversation

test: Add real mode int n instruction test

PATCH Applied Mohammed Gamal 2 participants 2 messages Aug 4, 2010 – Aug 5, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: Add real mode int n instruction test

This adds a test for int n (opcode 0xcd) instruction in the real mode test harness

---
 x86/realmode.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
x86/realmode.c +20 -0
index bb161ac..7534da5 100644
@@ -947,6 +947,25 @@ void test_iret()
 		print_serial("iret Test 4: PASS\n");
 }
 
+void test_int()
+{
+	struct regs inregs = { 0 }, outregs;
+	
+	*(u32 *)(0x11 * 4) = 0x1000; /* Store a pointer to address 0x1000 in IDT entry 0x11 */
+	*(u8 *)(0x1000) = 0xcf; /* 0x1000 contains an IRET instruction */
+
+	MK_INSN(int11, "int $0x11\n\t");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_int11,
+			      insn_int11_end - insn_int11);
+
+	if (!regs_equal(&inregs, &outregs, 0))
+		print_serial("int Test 1: FAIL\n");
+	else
+		print_serial("int Test 1: PASS\n");
+}
+
 void realmode_start(void)
 {
 	test_null();
@@ -969,6 +988,7 @@ void realmode_start(void)
 	test_long_jmp();
 	test_xchg();
 	test_iret();
+	test_int();
 
 	exit(0);
 }
Signature · 1 line
1.7.0.4
Applied
#1 lore raw
Quoted 2 lines · Mohammed Gamal

This adds a test for int n (opcode 0xcd) instruction in the real mode test harness

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function