Author: nwhitehorn
Date: Thu Sep 26 18:18:51 2013
New Revision: 255897
URL: http://svnweb.freebsd.org/changeset/base/255897

Log:
  MFC r255273,255282:
  
  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).

Modified:
  stable/9/sys/powerpc/aim/vm_machdep.c
  stable/9/sys/powerpc/include/frame.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/powerpc/aim/vm_machdep.c
==============================================================================
--- stable/9/sys/powerpc/aim/vm_machdep.c       Thu Sep 26 18:10:19 2013        
(r255896)
+++ stable/9/sys/powerpc/aim/vm_machdep.c       Thu Sep 26 18:18:51 2013        
(r255897)
@@ -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: stable/9/sys/powerpc/include/frame.h
==============================================================================
--- stable/9/sys/powerpc/include/frame.h        Thu Sep 26 18:10:19 2013        
(r255896)
+++ stable/9/sys/powerpc/include/frame.h        Thu Sep 26 18:18:51 2013        
(r255897)
@@ -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 {
@@ -102,6 +103,7 @@ struct callframe {
        register_t      cf_func;
        register_t      cf_arg0;
        register_t      cf_arg1;
+       register_t      _padding;       /* Maintain 16-byte alignment */
 };
 #endif
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to