summaryrefslogtreecommitdiffstats
path: root/lib/libc/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-11-02 18:06:22 +0000
committerkib <kib@FreeBSD.org>2011-11-02 18:06:22 +0000
commitd5bbfd2b4a596efac124921b8eb84c0e9294fac1 (patch)
tree30ffe06c53c73ac5b2b281f967a3330077d0ec19 /lib/libc/amd64
parent953d552ca471abcbd82aee3b3517bfd9a34ef155 (diff)
downloadFreeBSD-src-d5bbfd2b4a596efac124921b8eb84c0e9294fac1.zip
FreeBSD-src-d5bbfd2b4a596efac124921b8eb84c0e9294fac1.tar.gz
Make sure that stack is 16-byte aligned before calling a function,
as it is required by amd64 ABI. Add a comment for the places were the stack is accidentally properly aligned already. PR: amd64/162214 Submitted by: yamayan <yamayan kbh biglobe ne jp> MFC after: 1 week
Diffstat (limited to 'lib/libc/amd64')
-rw-r--r--lib/libc/amd64/gen/setjmp.S3
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
index 1409f4c..47772be 100644
--- a/lib/libc/amd64/gen/setjmp.S
+++ b/lib/libc/amd64/gen/setjmp.S
@@ -54,6 +54,7 @@ ENTRY(setjmp)
movq $1,%rdi /* SIG_BLOCK */
movq $0,%rsi /* (sigset_t*)set */
leaq 72(%rcx),%rdx /* 9,10; (sigset_t*)oset */
+ /* stack is 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
popq %rdi
movq %rdi,%rcx
@@ -81,7 +82,9 @@ ENTRY(__longjmp)
movq $3,%rdi /* SIG_SETMASK */
leaq 72(%rdx),%rsi /* (sigset_t*)set */
movq $0,%rdx /* (sigset_t*)oset */
+ subq $0x8,%rsp /* make the stack 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
+ addq $0x8,%rsp
popq %rsi
popq %rdi /* jmpbuf */
movq %rdi,%rdx
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index 438d440..ef90bc6 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -62,6 +62,7 @@ ENTRY(sigsetjmp)
movq $1,%rdi /* SIG_BLOCK */
movq $0,%rsi /* (sigset_t*)set */
leaq 72(%rcx),%rdx /* 9,10 (sigset_t*)oset */
+ /* stack is 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
popq %rdi
2: movq %rdi,%rcx
@@ -90,7 +91,9 @@ ENTRY(__siglongjmp)
movq $3,%rdi /* SIG_SETMASK */
leaq 72(%rdx),%rsi /* (sigset_t*)set */
movq $0,%rdx /* (sigset_t*)oset */
+ subq $0x8,%rsp /* make the stack 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
+ addq $0x8,%rsp
popq %rsi
popq %rdi /* jmpbuf */
2: movq %rdi,%rdx
OpenPOWER on IntegriCloud