qemu-kvm: emulator tests: fix msr test
PATCH 1/1 qemu-kvm: emulator tests: fix msr test
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 <[email protected]>
--- kvm/user/test/x86/msr.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
kvm/user/test/x86/msr.c +8 -6
@@ -17,23 +17,25 @@ static void report(const char *name, int passed)static void wrmsr (unsigned index,unsigned long long value) { - asmvolatile ("wrmsr" : :"c" (index),"A" (value)); +unsigned a = value, d = value >>32 ; + + asmvolatile ("wrmsr" : :"a" (a),"d" (d),"c" (index)); }static unsigned long long rdmsr (unsigned index) { -unsigned long long value; - - asmvolatile ("rdmsr" :"=A" (value) :"c" (index)); +unsigned a, d; -return value; + asmvolatile ("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 );
Signature · 1 line
1.6.3.3
Marcelo Tosatti
AppliedQuoted 5 lines · Naphtali Sprei
use correct 64 bit mode inline assembly constraints
use a canonical form address when writing to theMSR_KERNEL_GS_BASEMSRSigned-off-by Naphtali Sprei <[email protected]>
Applied, thanks.