diff mbox series

[04/13] x86/crypto/aesni-intel_avx: Standardize stack alignment prologue

Message ID 02d00a0903a0959f4787e186e2a07d271e1f63d4.1614182415.git.jpoimboe@redhat.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show
Series x86/crypto/asm: objtool support | expand

Commit Message

Josh Poimboeuf Feb. 24, 2021, 4:29 p.m. UTC
Use RBP instead of R14 for saving the old stack pointer before
realignment.  This resembles what compilers normally do.

This enables ORC unwinding by allowing objtool to understand the stack
realignment.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/crypto/aesni-intel_avx-x86_64.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Peter Zijlstra Feb. 25, 2021, 9:38 a.m. UTC | #1
On Wed, Feb 24, 2021 at 10:29:17AM -0600, Josh Poimboeuf wrote:
> Use RBP instead of R14 for saving the old stack pointer before
> realignment.  This resembles what compilers normally do.
> 
> This enables ORC unwinding by allowing objtool to understand the stack
> realignment.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  arch/x86/crypto/aesni-intel_avx-x86_64.S | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/crypto/aesni-intel_avx-x86_64.S b/arch/x86/crypto/aesni-intel_avx-x86_64.S
> index 188f1848a730..98e3552b6e03 100644
> --- a/arch/x86/crypto/aesni-intel_avx-x86_64.S
> +++ b/arch/x86/crypto/aesni-intel_avx-x86_64.S
> @@ -251,22 +251,20 @@ VARIABLE_OFFSET = 16*8
>  .macro FUNC_SAVE
>          push    %r12
>          push    %r13
> -        push    %r14
>          push    %r15
>  
> -        mov     %rsp, %r14
> -
> -
> +	push	%rbp
> +	mov	%rsp, %rbp
>  
>          sub     $VARIABLE_OFFSET, %rsp
>          and     $~63, %rsp                    # align rsp to 64 bytes
>  .endm
>  
>  .macro FUNC_RESTORE
> -        mov     %r14, %rsp
> +        mov     %rbp, %rsp
> +	pop	%rbp
>  
>          pop     %r15
> -        pop     %r14
>          pop     %r13
>          pop     %r12
>  .endm

Urgh, I was about to say your patch is whitespace damaged, but it's the
original file :-/
diff mbox series

Patch

diff --git a/arch/x86/crypto/aesni-intel_avx-x86_64.S b/arch/x86/crypto/aesni-intel_avx-x86_64.S
index 188f1848a730..98e3552b6e03 100644
--- a/arch/x86/crypto/aesni-intel_avx-x86_64.S
+++ b/arch/x86/crypto/aesni-intel_avx-x86_64.S
@@ -251,22 +251,20 @@  VARIABLE_OFFSET = 16*8
 .macro FUNC_SAVE
         push    %r12
         push    %r13
-        push    %r14
         push    %r15
 
-        mov     %rsp, %r14
-
-
+	push	%rbp
+	mov	%rsp, %rbp
 
         sub     $VARIABLE_OFFSET, %rsp
         and     $~63, %rsp                    # align rsp to 64 bytes
 .endm
 
 .macro FUNC_RESTORE
-        mov     %r14, %rsp
+        mov     %rbp, %rsp
+	pop	%rbp
 
         pop     %r15
-        pop     %r14
         pop     %r13
         pop     %r12
 .endm