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

[Xen-changelog] [xen master] x86emul: correct FPU stub asm() constraints



commit 3dfbb8df335f12297cfc7db9d3df2b74c474921b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jan 24 12:35:59 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jan 24 12:35:59 2017 +0100

    x86emul: correct FPU stub asm() constraints
    
    Properly inform the compiler about fic's role as both an input (its
    insn_bytes field) and output (its exn_raised field).
    
    Take the opportunity and bring emulate_fpu_insn_stub() more in line
    with emulate_fpu_insn_stub_eflags().
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index bd48290..5bb5bdf 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -924,13 +924,13 @@ static inline bool fpu_check_write(void)
         : "=m" (fic.insn_bytes)                         \
         : "m" (_arg) : "memory" )
 
-#define emulate_fpu_insn_stub(_bytes...)                                \
+#define emulate_fpu_insn_stub(bytes...)                                 \
 do {                                                                    \
-    uint8_t *buf = get_stub(stub);                                      \
-    unsigned int _nr = sizeof((uint8_t[]){ _bytes });                   \
-    fic.insn_bytes = _nr;                                               \
-    memcpy(buf, ((uint8_t[]){ _bytes, 0xc3 }), _nr + 1);                \
-    stub.func();                                                        \
+    unsigned int nr_ = sizeof((uint8_t[]){ bytes });                    \
+    fic.insn_bytes = nr_;                                               \
+    memcpy(get_stub(stub), ((uint8_t[]){ bytes, 0xc3 }), nr_ + 1);      \
+    asm volatile ( "call *%[stub]" : "+m" (fic) :                       \
+                   [stub] "rm" (stub.func) );                           \
     put_stub(stub);                                                     \
 } while (0)
 
@@ -944,7 +944,7 @@ do {                                                        
            \
                    "call *%[func];"                                     \
                    _POST_EFLAGS("[eflags]", "[mask]", "[tmp]")          \
                    : [eflags] "+g" (_regs._eflags),                     \
-                     [tmp] "=&r" (tmp_)                                 \
+                     [tmp] "=&r" (tmp_), "+m" (fic)                     \
                    : [func] "rm" (stub.func),                           \
                      [mask] "i" (EFLG_ZF|EFLG_PF|EFLG_CF) );            \
     put_stub(stub);                                                     \
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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