[PATCH kvm-unit-tests 3/5] x86: Test btcq with operand larger than 64

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

 



Previously, KVM did not calculate the offset for bit-operations correctly when
quad-word operands were used.  This test checks btcq when operand is larger
than 64 in order to check this scenario.

Signed-off-by: Nadav Amit <namit@xxxxxxxxxxxxxxxxx>
---
 x86/emulator.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/x86/emulator.c b/x86/emulator.c
index bf8a873..460949f 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -496,7 +496,7 @@ void test_btc(void *mem)
 {
 	unsigned int *a = mem;
 
-	memset(mem, 0, 3 * sizeof(unsigned int));
+	memset(mem, 0, 4 * sizeof(unsigned int));
 
 	asm ("btcl $32, %0" :: "m"(a[0]) : "memory");
 	asm ("btcl $1, %0" :: "m"(a[1]) : "memory");
@@ -505,6 +505,10 @@ void test_btc(void *mem)
 
 	asm ("btcl %1, %0" :: "m"(a[3]), "r"(-1) : "memory");
 	report("btcl reg, r/m", a[0] == 1 && a[1] == 2 && a[2] == 0x80000004);
+
+	asm ("btcq %1, %0" : : "m"(a[2]), "r"(-1l) : "memory");
+	report("btcq reg, r/m", a[0] == 1 && a[1] == 0x80000002 &&
+		a[2] == 0x80000004 && a[3] == 0);
 }
 
 void test_bsfbsr(void *mem)
-- 
1.9.1

--
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