]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
don't overrun memory object
authorJan Beulich <jbeulich@suse.com>
Mon, 23 Jan 2017 10:45:49 +0000 (10:45 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 23 Jan 2017 11:37:53 +0000 (11:37 +0000)
Using MOVUPS on an 8-byte quantity is wrong. There's no need for memory
accesses in any of the probe_*() functions anyway - switch them all to
insns without any operands or with register ones.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Switch PXOR for MOVQ in the MMX case to avoid regression on older hypervisors
which lack an emulation of PXOR.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tests/fpu-exception-emulation/main.c

index 5ba37e2f0e4678cfa3afd4b2438ea6c4fe7df4a4..b0eb56384f82f95afe3d8c0eb7ee69c851912562 100644 (file)
@@ -52,7 +52,6 @@ struct test_cfg
     exinfo_t fault;
 };
 
-static unsigned long zero;
 static unsigned long default_cr0;
 
 /**
@@ -78,11 +77,10 @@ exinfo_t probe_x87(bool force)
     asm volatile ("test %[fep], %[fep];"
                   "jz 1f;"
                   _ASM_XEN_FEP
-                  "1: fildq %[ptr]; 2:"
+                  "1: fnop; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
                   : "+a" (fault)
-                  : [ptr] "m" (zero),
-                    [fep] "q" (force));
+                  : [fep] "q" (force));
 
     return fault;
 }
@@ -142,11 +140,10 @@ exinfo_t probe_mmx(bool force)
     asm volatile ("test %[fep], %[fep];"
                   "jz 1f;"
                   _ASM_XEN_FEP
-                  "1: movq %[ptr], %%mm0; 2:"
+                  "1: movq %%mm0, %%mm0; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
                   : "+a" (fault)
-                  : [ptr] "m" (zero),
-                    [fep] "q" (force));
+                  : [fep] "q" (force));
 
     return fault;
 }
@@ -158,11 +155,10 @@ exinfo_t probe_sse(bool force)
     asm volatile ("test %[fep], %[fep];"
                   "jz 1f;"
                   _ASM_XEN_FEP
-                  "1: movups %[ptr], %%xmm0; 2:"
+                  "1: movups %%xmm0, %%xmm0; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_eax)
                   : "+a" (fault)
-                  : [ptr] "m" (zero),
-                    [fep] "q" (force));
+                  : [fep] "q" (force));
 
     return fault;
 }