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

[Xen-devel] [PATCH 6/6] x86emul: simplify FPU handling asm() constraints



The memory clobber is rather harsh here. However, fic.exn_raised may be
modified as a side effect, so we need to let the compiler know that all
of "fic" may be changed (preventing it from moving around accesses to
the exn_raised field).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -784,7 +784,7 @@ do {
 })
 
 struct fpu_insn_ctxt {
-    uint8_t insn_bytes;
+    uint8_t insn_bytes; /* Must be first! */
     int8_t exn_raised;
 };
 
@@ -878,23 +878,21 @@ do {
         "movb $2f-1f,%0 \n"                             \
         "1: " _op "     \n"                             \
         "2:             \n"                             \
-        : "=m" (fic.insn_bytes) : : "memory" )
+        : "+m" (fic) )
 
 #define emulate_fpu_insn_memdst(_op, _arg)              \
     asm volatile (                                      \
         "movb $2f-1f,%0 \n"                             \
         "1: " _op " %1  \n"                             \
         "2:             \n"                             \
-        : "=m" (fic.insn_bytes), "=m" (_arg)            \
-        : : "memory" )
+        : "+m" (fic), "=m" (_arg) )
 
 #define emulate_fpu_insn_memsrc(_op, _arg)              \
     asm volatile (                                      \
         "movb $2f-1f,%0 \n"                             \
         "1: " _op " %1  \n"                             \
         "2:             \n"                             \
-        : "=m" (fic.insn_bytes)                         \
-        : "m" (_arg) : "memory" )
+        : "+m" (fic) : "m" (_arg) )
 
 #define emulate_fpu_insn_stub(_bytes...)                                \
 do {                                                                    \



Attachment: x86emul-FPU-constraints.patch
Description: Text document

_______________________________________________
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®.