public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: emulator tests: fix msr test
@ 2010-04-13 14:26 Naphtali Sprei
  2010-04-14 17:28 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Naphtali Sprei @ 2010-04-13 14:26 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity, Marcelo Tosatti


use correct 64 bit mode inline assembly constraints
use a canonical form address when writing to the MSR_KERNEL_GS_BASE MSR

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
---
 kvm/user/test/x86/msr.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/kvm/user/test/x86/msr.c b/kvm/user/test/x86/msr.c
index 92102fa..0d6f286 100644
--- a/kvm/user/test/x86/msr.c
+++ b/kvm/user/test/x86/msr.c
@@ -17,23 +17,25 @@ static void report(const char *name, int passed)
 
 static void wrmsr(unsigned index, unsigned long long value)
 {
-	asm volatile ("wrmsr" : : "c"(index), "A"(value));
+	unsigned a = value, d = value >> 32;
+
+	asm volatile("wrmsr" : : "a"(a), "d"(d), "c"(index));
 }
 
 static unsigned long long rdmsr(unsigned index)
 {
-	unsigned long long value;
-
-	asm volatile ("rdmsr" : "=A"(value) : "c"(index));
+	unsigned a, d;
 
-	return value;
+	asm volatile("rdmsr" : "=a"(a), "=d"(d) : "c"(index));
+	return ((unsigned long long)d << 32) | a;
 }
+
 #endif
 
 static void test_kernel_gs_base(void)
 {
 #ifdef __x86_64__
-	unsigned long long v1 = 0x123456789abcdef, v2;
+	unsigned long long v1 = 0x0000123456789abc, v2;
 
 	wrmsr(MSR_KERNEL_GS_BASE, v1);
 	v2 = rdmsr(MSR_KERNEL_GS_BASE);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-14 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 14:26 [PATCH] qemu-kvm: emulator tests: fix msr test Naphtali Sprei
2010-04-14 17:28 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox