summaryrefslogtreecommitdiff
path: root/cipher/sha512-avx-amd64.S
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2019-04-15 19:46:53 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2019-04-16 23:03:36 +0300
commitd11ae95d05dc39ec6b825d1109afadd964589880 (patch)
tree6a36256a9a816cd8e49fb6be5fcb4a9b6f9d007d /cipher/sha512-avx-amd64.S
parent0903b215ef5a18332b740a24e6e2bfbed9e1d97b (diff)
downloadlibgcrypt-d11ae95d05dc39ec6b825d1109afadd964589880.tar.gz
Add CFI unwind assembly directives for AMD64 assembly
* configure.ac (gcry_cv_gcc_asm_cfi_directives): New. * cipher/asm-common-amd64.h (ADD_RIP, CFI_STARTPROC, CFI_ENDPROC) (CFI_REMEMBER_STATE, CFI_RESTORE_STATE, CFI_ADJUST_CFA_OFFSET) (CFI_REL_OFFSET, CFI_DEF_CFA_REGISTER, CFI_REGISTER, CFI_RESTORE) (CFI_PUSH, CFI_POP, CFI_POP_TMP_REG, CFI_LEAVE, DW_REGNO) (DW_SLEB128_7BIT, DW_SLEB128_28BIT, CFI_CFA_ON_STACK) (CFI_REG_ON_STACK): New. (ENTER_SYSV_FUNCPARAMS_0_4, EXIT_SYSV_FUNC): Add CFI directives. * cipher/arcfour-amd64.S: Add CFI directives. * cipher/blake2b-amd64-avx2.S: Add CFI directives. * cipher/blake2s-amd64-avx.S: Add CFI directives. * cipher/blowfish-amd64.S: Add CFI directives. * cipher/camellia-aesni-avx-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/camellia-aesni-avx2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/cast5-amd64.S: Add CFI directives. * cipher/chacha20-amd64-avx2.S: Add CFI directives. * cipher/chacha20-amd64-ssse3.S: Add CFI directives. * cipher/des-amd64.S: Add CFI directives. * cipher/rijndael-amd64.S: Add CFI directives. * cipher/rijndael-ssse3-amd64-asm.S: Add CFI directives. * cipher/salsa20-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/serpent-avx2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/serpent-sse2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha1-avx-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha1-avx-bmi2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha1-avx2-bmi2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha1-ssse3-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha256-avx-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha256-avx2-bmi2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha256-ssse3-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha512-avx-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha512-avx2-bmi2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/sha512-ssse3-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/twofish-amd64.S: Add CFI directives. * cipher/twofish-avx2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * cipher/whirlpool-sse2-amd64.S: Add CFI directives; Use 'asm-common-amd64.h'. * mpi/amd64/func_abi.h: Include 'config.h'. (CFI_STARTPROC, CFI_ENDPROC, CFI_ADJUST_CFA_OFFSET, CFI_REL_OFFSET) (CFI_RESTORE, CFI_PUSH, CFI_POP): New. (FUNC_ENTRY, FUNC_EXIT): Add CFI directives. -- This commit adds CFI directives that add DWARF unwinding information for debugger to backtrace when executing code from AMD64 assembly files. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/sha512-avx-amd64.S')
-rw-r--r--cipher/sha512-avx-amd64.S26
1 files changed, 15 insertions, 11 deletions
diff --git a/cipher/sha512-avx-amd64.S b/cipher/sha512-avx-amd64.S
index 534351e4..991fd639 100644
--- a/cipher/sha512-avx-amd64.S
+++ b/cipher/sha512-avx-amd64.S
@@ -46,17 +46,7 @@
defined(HAVE_INTEL_SYNTAX_PLATFORM_AS) && \
defined(HAVE_GCC_INLINE_ASM_AVX) && defined(USE_SHA512)
-#ifdef __PIC__
-# define ADD_RIP +rip
-#else
-# define ADD_RIP
-#endif
-
-#ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
-# define ELF(...) __VA_ARGS__
-#else
-# define ELF(...) /*_*/
-#endif
+#include "asm-common-amd64.h"
.intel_syntax noprefix
@@ -269,6 +259,7 @@ frame_size = ((frame_GPRSAVE) + (frame_GPRSAVE_size))
ELF(.type _gcry_sha512_transform_amd64_avx,@function;)
.align 16
_gcry_sha512_transform_amd64_avx:
+ CFI_STARTPROC()
xor eax, eax
cmp msglen, 0
@@ -278,6 +269,7 @@ _gcry_sha512_transform_amd64_avx:
/* Allocate Stack Space */
sub rsp, frame_size
+ CFI_ADJUST_CFA_OFFSET(frame_size);
/* Save GPRs */
mov [rsp + frame_GPRSAVE + 8 * 0], rbx
@@ -285,6 +277,11 @@ _gcry_sha512_transform_amd64_avx:
mov [rsp + frame_GPRSAVE + 8 * 2], r13
mov [rsp + frame_GPRSAVE + 8 * 3], r14
mov [rsp + frame_GPRSAVE + 8 * 4], r15
+ CFI_REL_OFFSET(rbx, frame_GPRSAVE + 8 * 0);
+ CFI_REL_OFFSET(r12, frame_GPRSAVE + 8 * 1);
+ CFI_REL_OFFSET(r13, frame_GPRSAVE + 8 * 2);
+ CFI_REL_OFFSET(r14, frame_GPRSAVE + 8 * 3);
+ CFI_REL_OFFSET(r15, frame_GPRSAVE + 8 * 4);
.Lupdateblock:
@@ -351,6 +348,11 @@ _gcry_sha512_transform_amd64_avx:
mov r13, [rsp + frame_GPRSAVE + 8 * 2]
mov r14, [rsp + frame_GPRSAVE + 8 * 3]
mov r15, [rsp + frame_GPRSAVE + 8 * 4]
+ CFI_RESTORE(rbx)
+ CFI_RESTORE(r12)
+ CFI_RESTORE(r13)
+ CFI_RESTORE(r14)
+ CFI_RESTORE(r15)
vzeroall
@@ -365,9 +367,11 @@ _gcry_sha512_transform_amd64_avx:
/* Restore Stack Pointer */
add rsp, frame_size
+ CFI_ADJUST_CFA_OFFSET(-frame_size);
.Lnowork:
ret
+ CFI_ENDPROC()
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;