All of lore.kernel.org
 help / color / mirror / Atom feed
From: Naphtali Sprei <nsprei@redhat.com>
To: kvm@vger.kernel.org
Cc: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [PATCH] qemu-kvm: emulator tests: fix msr test
Date: Tue, 13 Apr 2010 17:26:47 +0300	[thread overview]
Message-ID: <4BC47F27.4010509@redhat.com> (raw)


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


             reply	other threads:[~2010-04-13 14:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 14:26 Naphtali Sprei [this message]
2010-04-14 17:28 ` [PATCH] qemu-kvm: emulator tests: fix msr test Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BC47F27.4010509@redhat.com \
    --to=nsprei@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.