[PATCH] test: Add real mode test for cbw/cwde instruction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Wei Yongjun <yjwei@xxxxxxxxxxxxxx>
---
 x86/realmode.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/x86/realmode.c b/x86/realmode.c
index bedd175..ce8fb18 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1236,6 +1236,32 @@ void test_loopcc(void)
 		print_serial("LOOPcc short Test 3: PASS\n");
 }
 
+void test_cbw(void)
+{
+	struct regs inregs = { 0 }, outregs;
+
+	MK_INSN(cbw, "mov $0xFE, %eax \n\t"
+		     "cbw\n\t");
+	MK_INSN(cwde, "mov $0xFFFE, %eax \n\t"
+		      "cwde\n\t");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_cbw,
+			      insn_cbw_end - insn_cbw);
+	if (outregs.eax != 0xFFFE)
+		print_serial("cbw test1: FAIL\n");
+	else
+		print_serial("cbw test 1: PASS\n");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_cwde,
+			      insn_cwde_end - insn_cwde);
+	if (outregs.eax != 0xFFFFFFFE)
+		print_serial("cwde test1: FAIL\n");
+	else
+		print_serial("cwde test 1: PASS\n");
+}
+
 void realmode_start(void)
 {
 	test_null();
@@ -1264,6 +1290,7 @@ void realmode_start(void)
 	test_div();
 	test_idiv();
 	test_loopcc();
+	test_cbw();
 
 	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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux