* [PATCH] kvm: testsuite: Add test for in/out instructions
@ 2008-09-06 14:18 Mohammed Gamal
2008-09-07 7:27 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Mohammed Gamal @ 2008-09-06 14:18 UTC (permalink / raw)
To: kvm; +Cc: avi
Add in/out instruction test in real mode test harness
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
user/test/x86/realmode.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/user/test/x86/realmode.c b/user/test/x86/realmode.c
index 4627529..5f0ca0f 100644
--- a/user/test/x86/realmode.c
+++ b/user/test/x86/realmode.c
@@ -211,6 +211,74 @@ void test_eflags_insn(struct regs *inregs, struct regs *outregs)
print_serial("std test: FAIL\n");
}
+void test_io(struct regs *inregs, struct regs *outregs)
+{
+ MK_INSN(io_test1, "mov $0xff, %al \n\t"
+ "out %al, $0x10 \n\t"
+ "in $0x10, %al \n\t");
+ MK_INSN(io_test2, "mov $0xffff, %ax \n\t"
+ "out %ax, $0x10 \n\t"
+ "in $0x10, %ax \n\t");
+ MK_INSN(io_test3, "mov $0xffffffff, %eax \n\t"
+ "out %eax, $0x10 \n\t"
+ "in $0x10, %eax \n\t");
+ MK_INSN(io_test4, "mov $0x10, %dx \n\t"
+ "mov $0xff, %al \n\t"
+ "out %al, %dx \n\t"
+ "in %dx, %al \n\t");
+ MK_INSN(io_test5, "mov $0x10, %dx \n\t"
+ "mov $0xffff, %ax \n\t"
+ "out %ax, %dx \n\t"
+ "in %dx, %ax \n\t");
+ MK_INSN(io_test6, "mov $0x10, %dx \n\t"
+ "mov $0xffffffff, %eax \n\t"
+ "out %eax, %dx \n\t"
+ "in %dx, %eax \n\t");
+
+ exec_in_big_real_mode(inregs, outregs,
+ insn_io_test1,
+ insn_io_test1_end - insn_io_test1);
+
+ if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0xff)
+ print_serial("I/O test 1: FAIL\n");
+
+ exec_in_big_real_mode(inregs, outregs,
+ insn_io_test2,
+ insn_io_test2_end - insn_io_test2);
+
+ if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0xffff)
+ print_serial("I/O test 2: FAIL\n");
+
+ exec_in_big_real_mode(inregs, outregs,
+ insn_io_test3,
+ insn_io_test3_end - insn_io_test3);
+
+ if (!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0xffffffff)
+ print_serial("I/O test 3: FAIL\n");
+
+ exec_in_big_real_mode(inregs, outregs,
+ insn_io_test4,
+ insn_io_test4_end - insn_io_test4);
+
+ if (!regs_equal(inregs, outregs, R_AX|R_DX) || outregs->eax != 0xff)
+ print_serial("I/O test 4: FAIL\n");
+
+ exec_in_big_real_mode(inregs, outregs,
+ insn_io_test5,
+ insn_io_test5_end - insn_io_test5);
+
+ if (!regs_equal(inregs, outregs, R_AX|R_DX) || outregs->eax != 0xffff)
+ print_serial("I/O test 5: FAIL\n");
+
+ exec_in_big_real_mode(inregs, outregs,
+ insn_io_test6,
+ insn_io_test6_end - insn_io_test6);
+
+ if (!regs_equal(inregs, outregs, R_AX|R_DX) || outregs->eax != 0xffffffff)
+ print_serial("I/O test 6: FAIL\n");
+
+}
+
void start(void)
{
struct regs inregs = { 0 }, outregs;
@@ -220,6 +288,7 @@ void start(void)
if (!regs_equal(&inregs, &outregs, 0))
print_serial("null test: FAIL\n");
test_mov_imm(&inregs, &outregs);
+ test_io(&inregs, &outregs);
test_eflags_insn(&inregs, &outregs);
exit(0);
}
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-07 7:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-06 14:18 [PATCH] kvm: testsuite: Add test for in/out instructions Mohammed Gamal
2008-09-07 7:27 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox