Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2003 21:41:57 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        "Tim J. Robbins" <tjr@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/bin/sh machdep.h memalloc.c nodes.c.pat
Message-ID:  <20030216054157.GA1973@athlon.pn.xcllnt.net>
In-Reply-To: <200302160328.h1G3SB3s074208@repoman.freebsd.org>
References:  <200302160328.h1G3SB3s074208@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 15, 2003 at 07:28:11PM -0800, Tim J. Robbins wrote:
> tjr         2003/02/15 19:28:11 PST
> 
>   Modified files:
>     bin/sh               memalloc.c nodes.c.pat 
>   Added files:
>     bin/sh               machdep.h 
>   Log:
>   Temporarily back out machdep.h/ALIGN changes. It seems that on sparc64,
>   using the alignment from sys/param.h (16) instead of the alignment
>   from machdep.h (8) tickled a nasty bug in the memory allocator that I
>   haven't been able to track down yet.

I noticed that stalloc() in memalloc.c always yields an 8-byte
aligned address due to the fact that the space field in struct
stack_block is 8-byte aligned on 64-bit architectures. A fix
for this would look something like:

Index: memalloc.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/memalloc.c,v
retrieving revision 1.19
diff -u -r1.19 memalloc.c
--- memalloc.c	30 Jun 2002 05:15:03 -0000	1.19
+++ memalloc.c	16 Feb 2003 05:39:51 -0000
@@ -139,8 +139,8 @@
 		sp = ckmalloc(sizeof(struct stack_block) - MINSIZE + 
 		    blocksize);
 		sp->prev = stackp;
-		stacknxt = sp->space;
-		stacknleft = blocksize;
+		stacknxt = ALIGN(sp->space);
+		stacknleft = TRUNC(blocksize);
 		stackp = sp;
 		INTON;
 	}

I left TRUNC undefined. It's purpose is to adjust for the alignment
of stacknxt.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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