]> xenbits.xensource.com Git - xen.git/commitdiff
x86emul: correct stub invocation constraints
authorJan Beulich <jbeulich@suse.com>
Wed, 26 Apr 2017 07:49:24 +0000 (09:49 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Apr 2017 07:49:24 +0000 (09:49 +0200)
Stub invocations need to have the space the stub occupies as an input,
to prevent the compiler from re-ordering (or omitting) writes to it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index c822221d8a24a92bdb0bf06a5a7731f8e9b9eaf4..a695d5a49dd60de042249d7b99a07c59060da30e 100644 (file)
@@ -837,7 +837,8 @@ do{ asm volatile (                                                      \
                    ".popsection\n\t"                                    \
                    _ASM_EXTABLE(.Lret%=, .Lfix%=)                       \
                    : [exn] "+g" (res_), constraints,                    \
-                     [stub] "rm" (stub.func) );                         \
+                     [stub] "rm" (stub.func),                           \
+                     "m" (*(uint8_t(*)[MAX_INST_LEN + 1])stub.ptr) );   \
     if ( unlikely(~res_.raw) )                                          \
     {                                                                   \
         gprintk(XENLOG_WARNING,                                         \
@@ -853,7 +854,8 @@ do{ asm volatile (                                                      \
 #else
 # define invoke_stub(pre, post, constraints...)                         \
     asm volatile ( pre "\n\tcall *%[stub]\n\t" post                     \
-                   : constraints, [stub] "rm" (stub.func) )
+                   : constraints, [stub] "rm" (stub.func),              \
+                     "m" (*(uint8_t(*)[MAX_INST_LEN + 1])stub.buf) )
 #endif
 
 #define emulate_stub(dst, src...) do {                                  \