svn commit: r255273 - in head/sys/powerpc: aim include

Nathan Whitehorn nwhitehorn at FreeBSD.org
Thu Sep 5 23:00:25 UTC 2013


Author: nwhitehorn
Date: Thu Sep  5 23:00:24 2013
New Revision: 255273
URL: http://svnweb.freebsd.org/changeset/base/255273

Log:
  Align stacks of kernel threads correctly at 16-byte boundaries rather than
  making sure they are all misaligned at +8 bytes. This fixes clang builds
  of powerpc64 kernels (aside from a required increase in KSTACK_PAGES which
  will come later).
  
  This commit from FreeBSD/powerpc64 with a clang-built kernel.
  
  MFC after:	2 weeks

Modified:
  head/sys/powerpc/aim/vm_machdep.c
  head/sys/powerpc/include/frame.h

Modified: head/sys/powerpc/aim/vm_machdep.c
==============================================================================
--- head/sys/powerpc/aim/vm_machdep.c	Thu Sep  5 22:59:18 2013	(r255272)
+++ head/sys/powerpc/aim/vm_machdep.c	Thu Sep  5 23:00:24 2013	(r255273)
@@ -187,6 +187,7 @@ cpu_fork(struct thread *td1, struct proc
 	cf->cf_arg1 = (register_t)tf;
 
 	pcb->pcb_sp = (register_t)cf;
+	KASSERT(pcb->pcb_sp % 16 == 0, ("stack misaligned"));
 	#ifdef __powerpc64__
 	pcb->pcb_lr = ((register_t *)fork_trampoline)[0];
 	pcb->pcb_toc = ((register_t *)fork_trampoline)[1];

Modified: head/sys/powerpc/include/frame.h
==============================================================================
--- head/sys/powerpc/include/frame.h	Thu Sep  5 22:59:18 2013	(r255272)
+++ head/sys/powerpc/include/frame.h	Thu Sep  5 23:00:24 2013	(r255273)
@@ -94,6 +94,7 @@ struct callframe {
 	register_t	cf_func;
 	register_t	cf_arg0;
 	register_t	cf_arg1;
+	register_t	_padding;	/* Maintain 16-byte alignment */
 };
 #else
 struct callframe {


More information about the svn-src-all mailing list