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

Re: [Xen-devel] [PATCH 1/2, v2] x86: use MOV instead of PUSH/POP when saving/restoring register state



On 30/10/12 14:27, Jan Beulich wrote:
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---
This patch did not change from its v1 submission.

--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -21,8 +21,7 @@ ENTRY(compat_hypercall)
  UNLIKELY_START(ne, msi_check)
          movl  $HYPERCALL_VECTOR,%edi
          call  check_for_unexpected_msi
-        RESTORE_ALL
-        SAVE_ALL
+        LOAD_C_CLOBBERED
  UNLIKELY_END(msi_check)
GET_CURRENT(%rbx)
@@ -173,8 +172,7 @@ compat_bad_hypercall:
  /* %rbx: struct vcpu, interrupts disabled */
  compat_restore_all_guest:
          ASSERT_INTERRUPTS_DISABLED
-        RESTORE_ALL
-        addq  $8,%rsp
+        RESTORE_ALL adj=8
  .Lft0:  iretq
.section .fixup,"ax"
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -47,12 +47,10 @@ restore_all_guest:
          cmpl  $1,%ecx
          ja    .Lforce_iret
- addq $8,%rsp
-        popq  %rcx                    # RIP
-        popq  %r11                    # CS
-        cmpw  $FLAT_USER_CS32,%r11
-        popq  %r11                    # RFLAGS
-        popq  %rsp                    # RSP
+        cmpw  $FLAT_USER_CS32,16(%rsp)# CS
+        movq  8(%rsp),%rcx            # RIP
+        movq  24(%rsp),%r11           # RFLAGS
+        movq  32(%rsp),%rsp           # RSP
          je    1f
          sysretq
  1:      sysretl
@@ -101,8 +99,7 @@ failsafe_callback:
          ALIGN
  /* No special register assumptions. */
  restore_all_xen:
-        RESTORE_ALL
-        addq  $8,%rsp
+        RESTORE_ALL adj=8
          iretq
/*
@@ -311,8 +308,7 @@ ENTRY(int80_direct_trap)
  UNLIKELY_START(ne, msi_check)
          movl  $0x80,%edi
          call  check_for_unexpected_msi
-        RESTORE_ALL
-        SAVE_ALL
+        LOAD_C_CLOBBERED
  UNLIKELY_END(msi_check)
GET_CURRENT(%rbx)
--- a/xen/include/asm-x86/x86_64/asm_defns.h
+++ b/xen/include/asm-x86/x86_64/asm_defns.h
@@ -5,11 +5,11 @@
#ifdef CONFIG_FRAME_POINTER
  /* Indicate special exception stack frame by inverting the frame pointer. */
-#define SETUP_EXCEPTION_FRAME_POINTER           \
-        movq  %rsp,%rbp;                        \
+#define SETUP_EXCEPTION_FRAME_POINTER(offs)     \
+        leaq  offs(%rsp),%rbp;                  \
          notq  %rbp
  #else
-#define SETUP_EXCEPTION_FRAME_POINTER
+#define SETUP_EXCEPTION_FRAME_POINTER(off)
Is it too pedantic to say that "off" here should be "offs"?
Just for consistency...

--
Mats


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