camellia/asm/cmll-x86_64.pl: add CFI annotations.
[openssl.git] / crypto / camellia / asm / cmll-x86_64.pl
index d94f46b887e516cab8cf932320760192bd62a178..02c52c3efe47ddf35cbf59cac458abcf269cd73a 100644 (file)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
 
 # ====================================================================
 # Copyright (c) 2008 Andy Polyakov <appro@openssl.org>
@@ -40,7 +47,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 die "can't locate x86_64-xlate.pl";
 
-open OUT,"| \"$^X\" $xlate $flavour $output";
+open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
 *STDOUT=*OUT;
 
 sub hi() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1h/;    $r; }
@@ -130,11 +137,17 @@ Camellia_EncryptBlock:
 .align 16
 .Lenc_rounds:
 Camellia_EncryptBlock_Rounds:
+.cfi_startproc
        push    %rbx
+.cfi_push      %rbx
        push    %rbp
+.cfi_push      %rbp
        push    %r13
+.cfi_push      %r13
        push    %r14
+.cfi_push      %r14
        push    %r15
+.cfi_push      %r15
 .Lenc_prologue:
 
        #mov    %rsi,$inp               # put away arguments
@@ -166,13 +179,20 @@ Camellia_EncryptBlock_Rounds:
        mov     @S[3],12($out)
 
        mov     0(%rsp),%r15
+.cfi_restore   %r15
        mov     8(%rsp),%r14
+.cfi_restore   %r14
        mov     16(%rsp),%r13
+.cfi_restore   %r13
        mov     24(%rsp),%rbp
+.cfi_restore   %rbp
        mov     32(%rsp),%rbx
+.cfi_restore   %rbx
        lea     40(%rsp),%rsp
+.cfi_adjust_cfa_offset -40
 .Lenc_epilogue:
        ret
+.cfi_endproc
 .size  Camellia_EncryptBlock_Rounds,.-Camellia_EncryptBlock_Rounds
 
 .type  _x86_64_Camellia_encrypt,\@abi-omnipotent
@@ -240,11 +260,17 @@ Camellia_DecryptBlock:
 .align 16
 .Ldec_rounds:
 Camellia_DecryptBlock_Rounds:
+.cfi_startproc
        push    %rbx
+.cfi_push      %rbx
        push    %rbp
+.cfi_push      %rbp
        push    %r13
+.cfi_push      %r13
        push    %r14
+.cfi_push      %r14
        push    %r15
+.cfi_push      %r15
 .Ldec_prologue:
 
        #mov    %rsi,$inp               # put away arguments
@@ -276,13 +302,20 @@ Camellia_DecryptBlock_Rounds:
        mov     @S[3],12($out)
 
        mov     0(%rsp),%r15
+.cfi_restore   %r15
        mov     8(%rsp),%r14
+.cfi_restore   %r14
        mov     16(%rsp),%r13
+.cfi_restore   %r13
        mov     24(%rsp),%rbp
+.cfi_restore   %rbp
        mov     32(%rsp),%rbx
+.cfi_restore   %rbx
        lea     40(%rsp),%rsp
+.cfi_adjust_cfa_offset -40
 .Ldec_epilogue:
        ret
+.cfi_endproc
 .size  Camellia_DecryptBlock_Rounds,.-Camellia_DecryptBlock_Rounds
 
 .type  _x86_64_Camellia_decrypt,\@abi-omnipotent
@@ -402,11 +435,17 @@ $code.=<<___;
 .type  Camellia_Ekeygen,\@function,3
 .align 16
 Camellia_Ekeygen:
+.cfi_startproc
        push    %rbx
+.cfi_push      %rbx
        push    %rbp
+.cfi_push      %rbp
        push    %r13
+.cfi_push      %r13
        push    %r14
+.cfi_push      %r14
        push    %r15
+.cfi_push      %r15
 .Lkey_prologue:
 
        mov     %edi,${keyend}d         # put away arguments, keyBitLength
@@ -566,13 +605,20 @@ $code.=<<___;
        mov     \$4,%eax
 .Ldone:
        mov     0(%rsp),%r15
+.cfi_restore   %r15
        mov     8(%rsp),%r14
+.cfi_restore   %r14
        mov     16(%rsp),%r13
+.cfi_restore   %r13
        mov     24(%rsp),%rbp
+.cfi_restore   %rbp
        mov     32(%rsp),%rbx
+.cfi_restore   %rbx
        lea     40(%rsp),%rsp
+.cfi_adjust_cfa_offset -40
 .Lkey_epilogue:
        ret
+.cfi_endproc
 .size  Camellia_Ekeygen,.-Camellia_Ekeygen
 ___
 }
@@ -630,17 +676,25 @@ $code.=<<___;
 .type  Camellia_cbc_encrypt,\@function,6
 .align 16
 Camellia_cbc_encrypt:
+.cfi_startproc
        cmp     \$0,%rdx
        je      .Lcbc_abort
        push    %rbx
+.cfi_push      %rbx
        push    %rbp
+.cfi_push      %rbp
        push    %r12
+.cfi_push      %r12
        push    %r13
+.cfi_push      %r13
        push    %r14
+.cfi_push      %r14
        push    %r15
+.cfi_push      %r15
 .Lcbc_prologue:
 
        mov     %rsp,%rbp
+.cfi_def_cfa_register  %rbp
        sub     \$64,%rsp
        and     \$-64,%rsp
 
@@ -661,6 +715,7 @@ Camellia_cbc_encrypt:
 
        mov     %r8,$_ivp
        mov     %rbp,$_rsp
+.cfi_cfa_expression    $_rsp,deref,+56
 
 .Lcbc_body:
        lea     .LCamellia_SBOX(%rip),$Tbl
@@ -849,15 +904,24 @@ Camellia_cbc_encrypt:
 .align 16
 .Lcbc_done:
        mov     $_rsp,%rcx
+.cfi_def_cfa   %rcx,56
        mov     0(%rcx),%r15
+.cfi_restore   %r15
        mov     8(%rcx),%r14
+.cfi_restore   %r14
        mov     16(%rcx),%r13
+.cfi_restore   %r13
        mov     24(%rcx),%r12
+.cfi_restore   %r12
        mov     32(%rcx),%rbp
+.cfi_restore   %rbp
        mov     40(%rcx),%rbx
+.cfi_restore   %rbx
        lea     48(%rcx),%rsp
+.cfi_def_cfa   %rsp,8
 .Lcbc_abort:
        ret
+.cfi_endproc
 .size  Camellia_cbc_encrypt,.-Camellia_cbc_encrypt
 
 .asciz "Camellia for x86_64 by <appro\@openssl.org>"