]> xenbits.xensource.com Git - xen.git/commitdiff
x86/entry: Rearrange RESTORE_ALL to restore register in stack order
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 8 Feb 2018 11:43:22 +0000 (12:43 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 8 Feb 2018 11:43:22 +0000 (12:43 +0100)
Results in a more predictable (i.e. linear) memory access pattern.

No functional change.

This is part of XSA-254.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
master commit: f85d105e27735f0e20aa30d77f03774f3ed55ae5
master date: 2018-01-05 19:57:08 +0000

xen/include/asm-x86/asm_defns.h

index 1c8d66c435fc202a9caedb77a708d491a09c4c38..7d740e715615ba8d6eff60508eb149ac2839eeb8 100644 (file)
@@ -310,7 +310,6 @@ static always_inline void stac(void)
  * @compat: R8-R15 don't need reloading
  */
 .macro RESTORE_ALL adj=0 compat=0
-        LOAD_C_CLOBBERED \compat
 .if !\compat
         movq  UREGS_r15(%rsp),%r15
         movq  UREGS_r14(%rsp),%r14
@@ -319,6 +318,7 @@ static always_inline void stac(void)
 .endif
         LOAD_ONE_REG(bp, \compat)
         LOAD_ONE_REG(bx, \compat)
+        LOAD_C_CLOBBERED \compat
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm