From owner-svn-src-head@FreeBSD.ORG Wed Nov 2 18:06:23 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7232B1065687; Wed, 2 Nov 2011 18:06:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4729A8FC0A; Wed, 2 Nov 2011 18:06:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2I6NaT032238; Wed, 2 Nov 2011 18:06:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2I6Na9032235; Wed, 2 Nov 2011 18:06:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201111021806.pA2I6Na9032235@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 2 Nov 2011 18:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227023 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2011 18:06:23 -0000 Author: kib Date: Wed Nov 2 18:06:22 2011 New Revision: 227023 URL: http://svn.freebsd.org/changeset/base/227023 Log: 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 MFC after: 1 week Modified: head/lib/libc/amd64/gen/setjmp.S head/lib/libc/amd64/gen/sigsetjmp.S Modified: head/lib/libc/amd64/gen/setjmp.S ============================================================================== --- head/lib/libc/amd64/gen/setjmp.S Wed Nov 2 17:40:21 2011 (r227022) +++ head/lib/libc/amd64/gen/setjmp.S Wed Nov 2 18:06:22 2011 (r227023) @@ -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 Modified: head/lib/libc/amd64/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/amd64/gen/sigsetjmp.S Wed Nov 2 17:40:21 2011 (r227022) +++ head/lib/libc/amd64/gen/sigsetjmp.S Wed Nov 2 18:06:22 2011 (r227023) @@ -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