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

[Xen-devel] [PATCH v2 3/3] x86: use 32-bit loads for 32-bit PV guest state reload



This is slightly more efficient than loading 64-bit quantities.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -313,6 +313,13 @@ static always_inline void stac(void)
 987:
 .endm
 
+#define LOAD_ONE_REG(reg, compat) \
+.if !(compat); \
+        movq  UREGS_r##reg(%rsp),%r##reg; \
+.else; \
+        movl  UREGS_r##reg(%rsp),%e##reg; \
+.endif
+
 /*
  * Reload registers not preserved by C code from frame.
  *
@@ -326,16 +333,14 @@ static always_inline void stac(void)
         movq  UREGS_r10(%rsp),%r10
         movq  UREGS_r9(%rsp),%r9
         movq  UREGS_r8(%rsp),%r8
-.if \ax
-        movq  UREGS_rax(%rsp),%rax
 .endif
-.elseif \ax
-        movl  UREGS_rax(%rsp),%eax
+.if \ax
+        LOAD_ONE_REG(ax, \compat)
 .endif
-        movq  UREGS_rcx(%rsp),%rcx
-        movq  UREGS_rdx(%rsp),%rdx
-        movq  UREGS_rsi(%rsp),%rsi
-        movq  UREGS_rdi(%rsp),%rdi
+        LOAD_ONE_REG(cx, \compat)
+        LOAD_ONE_REG(dx, \compat)
+        LOAD_ONE_REG(si, \compat)
+        LOAD_ONE_REG(di, \compat)
 .endm
 
 /*
@@ -372,8 +377,9 @@ static always_inline void stac(void)
         .subsection 0
 #endif
 .endif
-987:    movq  UREGS_rbp(%rsp),%rbp
-        movq  UREGS_rbx(%rsp),%rbx
+987:
+        LOAD_ONE_REG(bp, \compat)
+        LOAD_ONE_REG(bx, \compat)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 



Attachment: x86-32on64-load-low.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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