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

Re: [Xen-devel] [PATCH v2 2/2] x86/Intel: virtualize support for cpuid faulting



> :) I am now curious as to which bit I missed.

I made these changes.

- Kyle

---
 tests/cpuid-faulting/main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/cpuid-faulting/main.c b/tests/cpuid-faulting/main.c
index 3e782a2..221567d 100644
--- a/tests/cpuid-faulting/main.c
+++ b/tests/cpuid-faulting/main.c
@@ -37,36 +37,39 @@ bool ex_record_fault_ebx(struct cpu_regs *regs,
 }
 
 unsigned int stub_rdmsr(uint32_t idx, uint64_t *val)
 {
     unsigned int fault = 0;
     uint32_t lo, hi;
 
     *val = 0;
-    asm volatile("1: rdmsr; 2:"
+    asm volatile("1: rdmsr;"
+                 "xor %%ebx, %%ebx; 2:"
                  _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_ebx)
                  : "=a" (lo), "=d" (hi), "=&b" (fault)
                  : "c" (idx));
 
     if ( !fault )
         *val = (((uint64_t)hi) << 32) | lo;
 
     return fault;
 }
 
 unsigned int stub_wrmsr(uint32_t idx, uint64_t val)
 {
     unsigned int fault = 0;
 
-    asm volatile("1: rdmsr; 2:"
+    asm volatile("1: wrmsr;"
+                 "xor %%ebx, %%ebx; 2:"
                  _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_ebx)
                  : "=&b" (fault)
                  : "c" (idx), "a" ((uint32_t)val),
-                   "d" ((uint32_t)(val >> 32)));
+                   "d" ((uint32_t)(val >> 32))
+                 : "memory");
 
     return fault;
 }
 
 unsigned long stub_cpuid(void)
 {
     unsigned int fault = 0;
 

base-commit: 0342fd279b05d0c2e31c8418fcffcdc9e48eb42f
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.