Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 2011 18:29:09 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r229011 - stable/8/lib/libc/i386/gen
Message-ID:  <201112301829.pBUIT9Cv024963@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Dec 30 18:29:09 2011
New Revision: 229011
URL: http://svn.freebsd.org/changeset/base/229011

Log:
  MFC r227024:
  Despite official i386 ABI does not mandate any stack alignment besides
  the word alignment, some versions of gcc do require 16-byte alignment.
  Make sure the stack is 16-byte aligned before calling a subroutine.

Modified:
  stable/8/lib/libc/i386/gen/setjmp.S
  stable/8/lib/libc/i386/gen/sigsetjmp.S
Directory Properties:
  stable/8/lib/libc/   (props changed)

Modified: stable/8/lib/libc/i386/gen/setjmp.S
==============================================================================
--- stable/8/lib/libc/i386/gen/setjmp.S	Fri Dec 30 18:22:34 2011	(r229010)
+++ stable/8/lib/libc/i386/gen/setjmp.S	Fri Dec 30 18:29:09 2011	(r229011)
@@ -51,12 +51,19 @@ __FBSDID("$FreeBSD$");
 ENTRY(setjmp)
 	movl	4(%esp),%ecx
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	leal	28(%ecx), %eax
 	pushl	%eax			/* (sigset_t*)oset */
 	pushl	$0			/* (sigset_t*)set  */
 	pushl	$1			/* SIG_BLOCK       */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%ecx
 	movl	0(%esp),%edx
@@ -76,12 +83,19 @@ END(setjmp)
 ENTRY(__longjmp)
 	movl	4(%esp),%edx
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	pushl	$0			/* (sigset_t*)oset */
 	leal	28(%edx), %eax
 	pushl	%eax			/* (sigset_t*)set  */
 	pushl	$3			/* SIG_SETMASK     */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%edx
 	movl	8(%esp),%eax

Modified: stable/8/lib/libc/i386/gen/sigsetjmp.S
==============================================================================
--- stable/8/lib/libc/i386/gen/sigsetjmp.S	Fri Dec 30 18:22:34 2011	(r229010)
+++ stable/8/lib/libc/i386/gen/sigsetjmp.S	Fri Dec 30 18:29:09 2011	(r229011)
@@ -60,12 +60,19 @@ ENTRY(sigsetjmp)
 	testl	%eax,%eax
 	jz	2f
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	leal	28(%ecx), %eax
 	pushl	%eax			/* (sigset_t*)oset */
 	pushl	$0			/* (sigset_t*)set  */
 	pushl	$1			/* SIG_BLOCK       */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%ecx
 2:	movl	0(%esp),%edx
@@ -87,12 +94,19 @@ ENTRY(__siglongjmp)
 	cmpl	$0,44(%edx)
 	jz	2f
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	pushl	$0			/* (sigset_t*)oset */
 	leal	28(%edx), %eax
 	pushl	%eax			/* (sigset_t*)set  */
 	pushl	$3			/* SIG_SETMASK     */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%edx
 2:	movl	8(%esp),%eax



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112301829.pBUIT9Cv024963>