[PATCH kvm-unit-test]: test fninit/fnstsw/fnstcw instructions emulation

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

 



Add test for fninit/fnstsw/fnstcw instructions emulation. This exact
code sequence is executed by Linux kernel during boot and sometimes gets
emulated by KVM.

Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
diff --git a/x86/realmode.c b/x86/realmode.c
index 549b36a..f5426e0 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1384,6 +1384,18 @@ static void test_aad(void)
     report("aad", R_AX, outregs.eax == 0x123400d4);
 }
 
+static void test_fninit(void)
+{
+	u16 fcw = -1, fsw = -1;
+	MK_INSN(fninit, "fninit ; fnstsw (%eax) ; fnstcw (%ebx)");
+
+	inregs.eax = (u32)&fsw;
+	inregs.ebx = (u32)&fcw;
+
+	exec_in_big_real_mode(&insn_fninit);
+	report("fninit", 0, fsw == 0 && (fcw & 0x103f) == 0x003f);
+}
+
 void realmode_start(void)
 {
 	test_null();
@@ -1424,6 +1436,7 @@ void realmode_start(void)
 	test_movzx_movsx();
 	test_bswap();
 	test_aad();
+	test_fninit();
 
 	exit(0);
 }
--
			Gleb.
--
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