Skip to contentSkip to conversation

kvm: testsuite: Add test for 'call near absolute'

PATCH Applied Mohammed Gamal 2 participants 2 messages Sep 9, 2008 – Sep 10, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: testsuite: Add test for 'call near absolute'

Adds 'call near absolute' to the real mode test harness

---
 user/test/x86/realmode.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
user/test/x86/realmode.c +21 -0
index 5f0ca0f..7da22a9 100644
@@ -5,6 +5,14 @@ typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
 
+void test_function(void);
+
+asm(
+	"test_function: \n\t"
+	"mov $0x1234, %eax \n\t"
+	"ret"
+   );
+
 static int strlen(const char *str)
 {
 	int n;
@@ -279,6 +287,18 @@ void test_io(struct regs *inregs, struct regs *outregs)
 
 }
 
+void test_call(struct regs *inregs, struct regs *outregs)
+{
+	MK_INSN(call1, "mov $test_function, %eax \n\t"
+		       "call *%eax\n\t");
+
+	exec_in_big_real_mode(inregs, outregs,
+		   	      insn_call1,
+			      insn_call1_end - insn_call1);
+	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x1234)
+		print_serial("Call Test 1: FAIL\n");
+}
+
 void start(void)
 {
 	struct regs inregs = { 0 }, outregs;
@@ -287,6 +307,7 @@ void start(void)
 	exec_in_big_real_mode(&inregs, &outregs, 0, 0);
 	if (!regs_equal(&inregs, &outregs, 0))
 		print_serial("null test: FAIL\n");
+	test_call(&inregs, &outregs);
 	test_mov_imm(&inregs, &outregs);
 	test_io(&inregs, &outregs);
 	test_eflags_insn(&inregs, &outregs);
Signature · 1 line
1.5.4.3
Applied
#1 lore raw
Quoted 2 lines · Mohammed Gamal

Adds 'call near absolute' to the real mode test harness

Applied, thanks.

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