Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 2011 18:22:35 +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: r229010 - stable/8/lib/libc/amd64/gen
Message-ID:  <201112301822.pBUIMZCl024726@svn.freebsd.org>

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

Log:
  MFC r227023:
  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

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

Modified: stable/8/lib/libc/amd64/gen/setjmp.S
==============================================================================
--- stable/8/lib/libc/amd64/gen/setjmp.S	Fri Dec 30 18:20:44 2011	(r229009)
+++ stable/8/lib/libc/amd64/gen/setjmp.S	Fri Dec 30 18:22:34 2011	(r229010)
@@ -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: stable/8/lib/libc/amd64/gen/sigsetjmp.S
==============================================================================
--- stable/8/lib/libc/amd64/gen/sigsetjmp.S	Fri Dec 30 18:20:44 2011	(r229009)
+++ stable/8/lib/libc/amd64/gen/sigsetjmp.S	Fri Dec 30 18:22:34 2011	(r229010)
@@ -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



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