From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mats Petersson Subject: Re: [PATCH 1/2, v2] x86: use MOV instead of PUSH/POP when saving/restoring register state Date: Tue, 30 Oct 2012 15:19:46 +0000 Message-ID: <508FF012.30901@citrix.com> References: <506B2268020000780009F273@nat28.tlf.novell.com> <508FF03702000078000A576D@nat28.tlf.novell.com> <508FF1E202000078000A5786@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <508FF1E202000078000A5786@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 30/10/12 14:27, Jan Beulich wrote: > Signed-off-by: Jan Beulich > Acked-by: Keir Fraser > --- > 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