Message ID | 20161014192852.5355-1-khuey@kylehuey.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 14/10/16 20:28, Kyle Huey wrote: >> :) 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) Ah - this should be +b rather than =&b, which avoids modifying the assembly. > : "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;" Oops. ~Andrew > "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
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;
> :) 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(-) base-commit: 0342fd279b05d0c2e31c8418fcffcdc9e48eb42f