Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern make sure that the 'struct malloc' header on alloca...



details:   https://anonhg.NetBSD.org/src/rev/582f0c34e029
branches:  trunk
changeset: 773262:582f0c34e029
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jan 30 05:42:54 2012 +0000

description:
make sure that the 'struct malloc' header on allocations is properly
aligned to (ALIGNBYTES+1).  this ensures that the memory that malloc(9)
returns is correctly aligned for the platform.  this change has an
effect on hppa, ia64, sparc and sparc64.

necessary on sparc for 8-byte load/store instructions.  with this my
SS20 boots multiuser again.

diffstat:

 sys/kern/kern_malloc.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ade53284df3f -r 582f0c34e029 sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Mon Jan 30 04:25:14 2012 +0000
+++ b/sys/kern/kern_malloc.c    Mon Jan 30 05:42:54 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc.c,v 1.136 2012/01/30 01:56:47 rmind Exp $  */
+/*     $NetBSD: kern_malloc.c,v 1.137 2012/01/30 05:42:54 mrg Exp $    */
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.136 2012/01/30 01:56:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.137 2012/01/30 05:42:54 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -93,7 +93,7 @@
 struct malloc_header {
        /* Total size, include the header. */
        size_t          mh_size;
-};
+} __aligned(ALIGNBYTES+1);
 
 /*
  * Allocate a block of memory



Home | Main Index | Thread Index | Old Index