Last active
June 4, 2019 18:20
-
-
Save danintel/47223ed3701ba15bff055cc8ed789d44 to your computer and use it in GitHub Desktop.
Tracing %rsp in OpenSSL SHA-256 AVX2 function sha256_block_data-order_avx2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%RSP Value PERL/ASM SOURCE (file sha512-x86_64.pl ) | |
============ =================================================== | |
.type ${func}_avx2,\@function,3 | |
.align 64 | |
${func}_avx2: #DAN: function sha256_block_data_order_avx2 | |
.cfi_startproc | |
.Lavx2_shortcut: | |
7fffffffd708 #DAN: %rsp value on function entry | |
mov %rsp,%rax # copy %rsp | |
.cfi_def_cfa_register %rax | |
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 | |
7fffffffd6d8 | |
sub \$`2*$SZ*$rounds+4*8+$win64*16*($SZ==4?4:6)`,%rsp #DAN: %rsp -= 0x220 | |
7fffffffd4b8 | |
and \$-256*$SZ,%rsp # align stack frame #DAN: %rsp &= 0xfffffffffffffc00 | |
7fffffffd400 | |
add \$`2*$SZ*($rounds-8)`,%rsp #DAN: %rsp += 0x1c0 | |
7fffffffd5c0 | |
mov %rax,$_rsp # save copy of %rsp #DAN: saves original %rsp at 0x58(%rsp) | |
.cfi_cfa_expression $_rsp,deref,+8 | |
.Loop_avx2: | |
lea -$PUSH8(%rsp),%rsp #DAN: %rsp -= 0x40 | |
7fffffffd580 | |
#DAN: 1st time in .Lavx2_00_47 loop ------------------------------ | |
.Lavx2_00_47: | |
#DAN: Code generated from AVX2_256_00_47($j=0) | |
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0); #DAN:%rsp -= 0x40 | |
7fffffffd540 | |
#DAN: Code generated from AVX2_256_00_47($j=1) | |
#DAN: No change in %rsp as (($j%2) != 0) | |
#DAN: Code generated from AVX2_256_00_47($j=2) | |
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0); #DAN:%rsp -= 0x40 | |
7fffffffd500 | |
&jne (".Lavx2_00_47"); #DAN: jump taken to top of loop | |
#DAN: 2nd time in .Lavx2_00_47 loop ------------------------------ | |
.Lavx2_00_47: | |
#DAN: Code generated from AVX2_256_00_47($j=0) | |
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0); #DAN:%rsp -= 0x40 | |
7fffffffd4c0 | |
#DAN: Code generated from AVX2_256_00_47($j=1) | |
#DAN: No change in %rsp as (($j%2) != 0) | |
#DAN: Code generated from AVX2_256_00_47($j=2) | |
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0); #DAN:%rsp -= 0x40 | |
7fffffffd480 | |
&jne (".Lavx2_00_47"); #DAN: jump taken to top of loop | |
#DAN: 3rd (last) time in .Lavx2_00_47 loop ------------------------------ | |
.Lavx2_00_47: | |
#DAN: Code generated from AVX2_256_00_47($j=0) | |
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0); #DAN:%rsp -= 0x40 | |
7fffffffd440 | |
#DAN: Code generated from AVX2_256_00_47($j=1) | |
#DAN: *NO* change in %rsp as (($j%2) != 0) | |
#DAN: Code generated from AVX2_256_00_47($j=2) | |
&lea ("%rsp","-$PUSH8(%rsp)") if (($j%2)==0); #DAN:%rsp -= 0x40 | |
7fffffffd400 | |
#DAN: Code generated from AVX2_256_00_47($j=3) | |
#DAN: *NO* change in %rsp as (($j%2) != 0) | |
&jne (".Lavx2_00_47"); #DAN: jump *NOT* taken | |
#DAN: Now outside of .Lavx2_00_47 loop ------------------------------ | |
lea `2*$SZ*($rounds-8)`(%rsp),$Tbl #DAN: save old, aligned %rsp in %rbp: %rbp = 0x1c0(%rsp) | |
#DAN: ^^^ %rbp now holds 7fffffffd5c0 | |
je .Ldone_avx2 #DAN: jump taken | |
.Ldone_avx2: | |
lea ($Tbl),%rsp #DAN: restore old stack value | |
7fffffffd5c0 | |
mov $_rsp,%rsi #DAN: save original stack value in %rsi: %rsi = 0x58(%rsp) | |
#DAN: ^^^ %rsi now has 7fffffffd708 | |
.cfi_def_cfa %rsi,8 | |
lea (%rsi),%rsp #DAN: restore original stack value on function entry | |
7fffffffd708 | |
.cfi_def_cfa_register %rsp | |
.Lepilogue_avx2: | |
ret | |
.cfi_endproc | |
.size ${func}_avx2,.-${func}_avx2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment