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 <na...@cs.technion.ac.il>
---
 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 linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to