Module Name:    src
Committed By:   joerg
Date:           Thu Jul  2 09:57:09 UTC 2009

Modified Files:
        src/lib/libc/arch/x86_64/gen: _lwp.c

Log Message:
Fix stack alignment for the thread stack.  The AMD64 stack has 16 Bytes
alignment, but this is active before the return address is pushed onto
the stack.  Fixes random crashes in va_start when the SSE registers are
saved.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/gen/_lwp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/x86_64/gen/_lwp.c
diff -u src/lib/libc/arch/x86_64/gen/_lwp.c:1.5 src/lib/libc/arch/x86_64/gen/_lwp.c:1.6
--- src/lib/libc/arch/x86_64/gen/_lwp.c:1.5	Wed Jul  1 16:54:41 2009
+++ src/lib/libc/arch/x86_64/gen/_lwp.c	Thu Jul  2 09:57:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.5 2009/07/01 16:54:41 joerg Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.6 2009/07/02 09:57:09 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.5 2009/07/01 16:54:41 joerg Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.6 2009/07/02 09:57:09 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -57,7 +57,7 @@
 	/* LINTED uintptr_t is safe */
 	gr[_REG_RIP] = (uintptr_t)start;
 	
-	sp = (void **) (((uintptr_t)(stack_base + stack_size) & ~15) - 8);
+	sp = (void **) (((uintptr_t)(stack_base + stack_size) & ~15));
 
 	/* LINTED __greg_t is safe */
 	gr[_REG_RDI] = (__greg_t)arg;

Reply via email to