Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Nettle
nettle
Commits
edf2b37f
Commit
edf2b37f
authored
Jun 01, 2014
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for w64 ABI.
parent
1851417e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
40 deletions
+58
-40
ChangeLog
ChangeLog
+10
-0
x86_64/README
x86_64/README
+10
-3
x86_64/camellia-crypt-internal.asm
x86_64/camellia-crypt-internal.asm
+2
-2
x86_64/gcm-hash8.asm
x86_64/gcm-hash8.asm
+1
-1
x86_64/machine.m4
x86_64/machine.m4
+35
-34
No files found.
ChangeLog
View file @
edf2b37f
2014-06-01 Niels Möller <nisse@lysator.liu.se>
* x86_64/gcm-hash8.asm: Pass correct argument count to W64_EXIT.
* x86_64/camellia-crypt-internal.asm: Pass correct argument count
to W64_ENTRY and W64_EXIT.
* x86_64/machine.m4 [W64_ABI]: Fix for the case of 6 function
arguments. Also push %rdi unconditionally, and use aligned
accesses for save and restore %xmm registers (movdqa).
2014-05-31 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Check for COFF type directives.
...
...
x86_64/README
View file @
edf2b37f
...
...
@@ -4,6 +4,8 @@ Up to 6 integer and pointer arguments are passed in registers. Nine
registers, %rax, %rcx, %rdx, %rsi, %rdi and %r8-%r11 can be used
freely. Integers and pointers are returned in %rax.
At entry, it is required that %rsp == 8 (mod 16).
Registers May be Argument
clobbered number
...
...
@@ -51,14 +53,19 @@ Additional arguments are passed on the stack. "backing store" on the
stack for the four register arguments is also required. %xmm6 to
%xmm15 are callee-saved. The "long" type is just 32 bits.
If we have
five
arguments, and push the additional callee-save
If we have
six
arguments, and push the additional callee-save
registers %rdi and %rsi on the stack, we get a stack frame like
64(%rsp): Sixth argument
56(%rsp): Fifth argument
48(%rsp): Space for fourth argument
40(%rsp): Space for third argument
32(%rsp): Space for second argument
24(%rsp): Space for first argument
16(%rsp): Return address
8(%rsp): Saved %rsi
(%rsp) : Saved %rdi
8(%rsp) : Saved %rdi
(%rsp): Saved %rsi
If, in addition, we use more than 6 %xmm registers, we push them
*after* %rdi (but before %rsi), so that they are stored at 16-byte
aligned addresses.
x86_64/camellia-crypt-internal.asm
View file @
edf2b37f
...
...
@@ -138,7 +138,7 @@ C xorl XREG(TMP), XREG($1)
ALIGN
(
16
)
PROLOGUE
(
_nettle_camellia_crypt
)
W64_ENTRY
(
5
,
0
)
W64_ENTRY
(
6
,
0
)
test
LENGTH
,
LENGTH
jz
.Lend
...
...
@@ -197,6 +197,6 @@ PROLOGUE(_nettle_camellia_crypt)
pop
%
rbp
pop
%
rbx
.Lend:
W64_EXIT
(
5
,
0
)
W64_EXIT
(
6
,
0
)
ret
EPILOGUE
(
_nettle_camellia_crypt
)
x86_64/gcm-hash8.asm
View file @
edf2b37f
...
...
@@ -162,7 +162,7 @@ ALIGN(16)
pop
%
r12
pop
%
rbp
pop
%
rbx
W64_EXIT
(
2
,
0
)
W64_EXIT
(
4
,
0
)
ret
.Lpartial:
...
...
x86_64/machine.m4
View file @
edf2b37f
...
...
@@ -67,44 +67,48 @@ define(<XREG>,<ifelse(
dnl W64_ENTRY(nargs, xmm_used)
define(<W64_ENTRY>, <
changequote([,])dnl
ifelse(<<<<<<<<<<<<<<<< ignored; only for balancing)
ifelse(<<<<<<<<<<<<<<<<
<<
ignored; only for balancing)
ifelse(W64_ABI,yes,[
dnl unconditionally push %rdi, making %rsp 16-byte aligned
push %rdi
dnl Save %xmm6, ..., if needed
ifelse(eval($2 > 6), 1, [
sub [$]eval(
8 +
16*($2 - 6)), %rsp
movdq
u
%xmm6, 0(%rsp)
sub [$]eval(16*($2 - 6)), %rsp
movdq
a
%xmm6, 0(%rsp)
])
ifelse(eval($2 > 7), 1, [
movdq
u
%xmm7, 16(%rsp)
movdq
a
%xmm7, 16(%rsp)
])
ifelse(eval($2 > 8), 1, [
movdq
u
%xmm8, 32(%rsp)
movdq
a
%xmm8, 32(%rsp)
])
ifelse(eval($2 > 9), 1, [
movdq
u
%xmm9, 48(%rsp)
movdq
a
%xmm9, 48(%rsp)
])
ifelse(eval($2 > 10), 1, [
movdq
u
%xmm10, 64(%rsp)
movdq
a
%xmm10, 64(%rsp)
])
ifelse(eval($2 > 11), 1, [
movdq
u
%xmm11, 80(%rsp)
movdq
a
%xmm11, 80(%rsp)
])
ifelse(eval($2 > 12), 1, [
movdq
u
%xmm12, 96(%rsp)
movdq
a
%xmm12, 96(%rsp)
])
ifelse(eval($2 > 13), 1, [
movdq
u
%xmm13, 112(%rsp)
movdq
a
%xmm13, 112(%rsp)
])
ifelse(eval($2 > 14), 1, [
movdq
u
%xmm14, 128(%rsp)
movdq
a
%xmm14, 128(%rsp)
])
ifelse(eval($2 > 15), 1, [
movdq
u
%xmm15, 144(%rsp)
movdq
a
%xmm15, 144(%rsp)
])
dnl Move around arguments
ifelse(eval($1 >= 1), 1, [
push %rdi
mov %rcx, %rdi
])
ifelse(eval($1 >= 2), 1, [
dnl NOTE: Breaks 16-byte %rsp alignment
push %rsi
mov %rdx, %rsi
])
...
...
@@ -115,11 +119,10 @@ define(<W64_ENTRY>, <
mov %r9, %rcx
])
ifelse(eval($1 >= 5), 1, [
ifelse(eval($2 > 6), 1, [
mov eval(8 + 16*($2 - 6) + 56)(%rsp), %r8
], [
mov 56(%rsp), %r8
])
mov ifelse(eval($2 > 6), 1, eval(16*($2-6)+56),56)(%rsp), %r8
])
ifelse(eval($1 >= 6), 1, [
mov ifelse(eval($2 > 6), 1, eval(16*($2-6)+64),64)(%rsp), %r9
])
])
changequote(<,>)dnl
...
...
@@ -128,45 +131,43 @@ define(<W64_ENTRY>, <
dnl W64_EXIT(nargs, xmm_used)
define(<W64_EXIT>, <
changequote([,])dnl
ifelse(<<<<<<<<<<<
<
ignored; only for balancing)
ifelse(<<<<<<<<<<< ignored; only for balancing)
ifelse(W64_ABI,yes,[
ifelse(eval($1 >= 2), 1, [
pop %rsi
])
ifelse(eval($1 >= 1), 1, [
pop %rdi
])
])
ifelse(eval($2 > 15), 1, [
movdq
u
144(%rsp), %xmm15
movdq
a
144(%rsp), %xmm15
])
ifelse(eval($2 > 14), 1, [
movdq
u
128(%rsp), %xmm14
movdq
a
128(%rsp), %xmm14
])
ifelse(eval($2 > 13), 1, [
movdq
u
112(%rsp), %xmm13
movdq
a
112(%rsp), %xmm13
])
ifelse(eval($2 > 12), 1, [
movdq
u
96(%rsp), %xmm12
movdq
a
96(%rsp), %xmm12
])
ifelse(eval($2 > 11), 1, [
movdq
u
80(%rsp), %xmm11
movdq
a
80(%rsp), %xmm11
])
ifelse(eval($2 > 10), 1, [
movdq
u
64(%rsp), %xmm10
movdq
a
64(%rsp), %xmm10
])
ifelse(eval($2 > 9), 1, [
movdq
u
48(%rsp), %xmm9
movdq
a
48(%rsp), %xmm9
])
ifelse(eval($2 > 8), 1, [
movdq
u
32(%rsp), %xmm8
movdq
a
32(%rsp), %xmm8
])
ifelse(eval($2 > 7), 1, [
movdq
u
16(%rsp), %xmm7
movdq
a
16(%rsp), %xmm7
])
ifelse(eval($2 > 6), 1, [
movdq
u 0
(%rsp), %xmm6
add [$]eval(
8 +
16*($2 - 6)), %rsp
movdq
a
(%rsp), %xmm6
add [$]eval(16*($2 - 6)), %rsp
])
pop %rdi
])
changequote(<,>)dnl
>)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment