Commit bfca2b2c authored by Martin Storsjö's avatar Martin Storsjö Committed by Niels Möller

Updated x86_64 assembler for W64 support.

Rev: nettle/ChangeLog:1.242
Rev: nettle/x86_64/aes-decrypt-internal.asm:1.4
Rev: nettle/x86_64/aes-encrypt-internal.asm:1.11
Rev: nettle/x86_64/camellia-crypt-internal.asm:1.3
Rev: nettle/x86_64/memxor.asm:1.4
Rev: nettle/x86_64/serpent-decrypt.asm:1.4
Rev: nettle/x86_64/serpent-encrypt.asm:1.6
Rev: nettle/x86_64/sha1-compress.asm:1.3
parent 3f8a8c0c
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
From Martin Storsj: From Martin Storsj:
* x86_64/machine.m4 (W64_ENTRY, W64_EXIT): New macros for * x86_64/machine.m4 (W64_ENTRY, W64_EXIT): New macros for
supporting W64 ABI. supporting W64 ABI.
* x86_64: Updated all assembly files to use them.
* configure.ac (W64_ABI): New variable, set when compiling for * configure.ac (W64_ABI): New variable, set when compiling for
W64 ABI (64-bit M$ windows). W64 ABI (64-bit M$ windows).
......
...@@ -55,6 +55,7 @@ define(<TMP>,<%rbp>) ...@@ -55,6 +55,7 @@ define(<TMP>,<%rbp>)
.text .text
ALIGN(4) ALIGN(4)
PROLOGUE(_nettle_aes_decrypt) PROLOGUE(_nettle_aes_decrypt)
W64_ENTRY(5, 0)
test PARAM_LENGTH, PARAM_LENGTH test PARAM_LENGTH, PARAM_LENGTH
jz .Lend jz .Lend
...@@ -129,5 +130,6 @@ PROLOGUE(_nettle_aes_decrypt) ...@@ -129,5 +130,6 @@ PROLOGUE(_nettle_aes_decrypt)
pop %rbp pop %rbp
pop %rbx pop %rbx
.Lend: .Lend:
W64_EXIT(5, 0)
ret ret
EPILOGUE(_nettle_aes_decrypt) EPILOGUE(_nettle_aes_decrypt)
...@@ -55,6 +55,7 @@ define(<TMP>,<%rbp>) ...@@ -55,6 +55,7 @@ define(<TMP>,<%rbp>)
.text .text
ALIGN(4) ALIGN(4)
PROLOGUE(_nettle_aes_encrypt) PROLOGUE(_nettle_aes_encrypt)
W64_ENTRY(5, 0)
test PARAM_LENGTH, PARAM_LENGTH test PARAM_LENGTH, PARAM_LENGTH
jz .Lend jz .Lend
...@@ -129,5 +130,6 @@ PROLOGUE(_nettle_aes_encrypt) ...@@ -129,5 +130,6 @@ PROLOGUE(_nettle_aes_encrypt)
pop %rbp pop %rbp
pop %rbx pop %rbx
.Lend: .Lend:
W64_EXIT(5, 0)
ret ret
EPILOGUE(_nettle_aes_encrypt) EPILOGUE(_nettle_aes_encrypt)
...@@ -125,6 +125,7 @@ C xorl XREG(TMP), XREG($1) ...@@ -125,6 +125,7 @@ C xorl XREG(TMP), XREG($1)
ALIGN(4) ALIGN(4)
PROLOGUE(_nettle_camellia_crypt) PROLOGUE(_nettle_camellia_crypt)
W64_ENTRY(5, 0)
test LENGTH, LENGTH test LENGTH, LENGTH
jz .Lend jz .Lend
...@@ -182,5 +183,6 @@ PROLOGUE(_nettle_camellia_crypt) ...@@ -182,5 +183,6 @@ PROLOGUE(_nettle_camellia_crypt)
pop %rbp pop %rbp
pop %rbx pop %rbx
.Lend: .Lend:
W64_EXIT(5, 0)
ret ret
EPILOGUE(_nettle_camellia_crypt) EPILOGUE(_nettle_camellia_crypt)
...@@ -40,6 +40,7 @@ define(<USE_SSE2>, <no>) ...@@ -40,6 +40,7 @@ define(<USE_SSE2>, <no>)
ALIGN(4) ALIGN(4)
PROLOGUE(memxor) PROLOGUE(memxor)
W64_ENTRY(3, 0)
mov %rdx, %r10 mov %rdx, %r10
mov %rdi, %rdx mov %rdi, %rdx
jmp .Lmemxor3_entry jmp .Lmemxor3_entry
...@@ -50,6 +51,7 @@ EPILOGUE(memxor) ...@@ -50,6 +51,7 @@ EPILOGUE(memxor)
ALIGN(4) ALIGN(4)
PROLOGUE(memxor3) PROLOGUE(memxor3)
W64_ENTRY(4, 0)
C %cl needed for shift count, so move away N C %cl needed for shift count, so move away N
mov %rcx, N mov %rcx, N
.Lmemxor3_entry: .Lmemxor3_entry:
...@@ -200,6 +202,8 @@ C jz .Ldone ...@@ -200,6 +202,8 @@ C jz .Ldone
xor (BP, N), TMP xor (BP, N), TMP
mov TMP, (DST, N) mov TMP, (DST, N)
C ENTRY might have been 3 args, too, but it doesn't matter for the exit
W64_EXIT(4, 0)
ret ret
.Lfinal: .Lfinal:
...@@ -214,6 +218,8 @@ C jz .Ldone ...@@ -214,6 +218,8 @@ C jz .Ldone
jnc .Lfinal_loop jnc .Lfinal_loop
.Ldone: .Ldone:
C ENTRY might have been 3 args, too, but it doesn't matter for the exit
W64_EXIT(4, 0)
ret ret
ifelse(USE_SSE2, yes, < ifelse(USE_SSE2, yes, <
...@@ -247,6 +253,8 @@ ifelse(USE_SSE2, yes, < ...@@ -247,6 +253,8 @@ ifelse(USE_SSE2, yes, <
movdqu (BP), %xmm1 movdqu (BP), %xmm1
pxor %xmm0, %xmm1 pxor %xmm0, %xmm1
movdqa %xmm1, (DST) movdqa %xmm1, (DST)
C ENTRY might have been 3 args, too, but it doesn't matter for the exit
W64_EXIT(4, 0)
ret ret
>) >)
......
...@@ -525,6 +525,7 @@ define(<WLTI>, < ...@@ -525,6 +525,7 @@ define(<WLTI>, <
ALIGN(4) ALIGN(4)
PROLOGUE(nettle_serpent_decrypt) PROLOGUE(nettle_serpent_decrypt)
C save all registers that need to be saved C save all registers that need to be saved
W64_ENTRY(4, 13)
push %rbx push %rbx
push %rbp push %rbp
push %r12 push %r12
...@@ -697,4 +698,5 @@ PROLOGUE(nettle_serpent_decrypt) ...@@ -697,4 +698,5 @@ PROLOGUE(nettle_serpent_decrypt)
pop %r12 pop %r12
pop %rbp pop %rbp
pop %rbx pop %rbx
W64_EXIT(4, 13)
ret ret
...@@ -552,6 +552,7 @@ define(<WLT>, < ...@@ -552,6 +552,7 @@ define(<WLT>, <
ALIGN(4) ALIGN(4)
PROLOGUE(nettle_serpent_encrypt) PROLOGUE(nettle_serpent_encrypt)
C save all registers that need to be saved C save all registers that need to be saved
W64_ENTRY(4, 13)
push %rbx push %rbx
push %rbp push %rbp
push %r12 push %r12
...@@ -732,4 +733,5 @@ C parallell. ...@@ -732,4 +733,5 @@ C parallell.
pop %r12 pop %r12
pop %rbp pop %rbp
pop %rbx pop %rbx
W64_EXIT(4, 13)
ret ret
...@@ -126,6 +126,7 @@ C adding, and then rotating back. ...@@ -126,6 +126,7 @@ C adding, and then rotating back.
ALIGN(4) ALIGN(4)
PROLOGUE(_nettle_sha1_compress) PROLOGUE(_nettle_sha1_compress)
C save all registers that need to be saved C save all registers that need to be saved
W64_ENTRY(2, 0)
sub $68, %rsp C %rsp = W sub $68, %rsp C %rsp = W
...@@ -250,5 +251,6 @@ PROLOGUE(_nettle_sha1_compress) ...@@ -250,5 +251,6 @@ PROLOGUE(_nettle_sha1_compress)
addl SE, 16(STATE) addl SE, 16(STATE)
add $68, %rsp add $68, %rsp
W64_EXIT(2, 0)
ret ret
EPILOGUE(_nettle_sha1_compress) EPILOGUE(_nettle_sha1_compress)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment