Date: Sun, 16 Feb 2003 19:53:13 +1100 From: Tim Robbins <tjr@FreeBSD.ORG> To: Marcel Moolenaar <marcel@xcllnt.net> 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: <20030216195313.A99764@dilbert.robbins.dropbear.id.au> In-Reply-To: <20030216054157.GA1973@athlon.pn.xcllnt.net>; from marcel@xcllnt.net on Sat, Feb 15, 2003 at 09:41:57PM -0800 References: <200302160328.h1G3SB3s074208@repoman.freebsd.org> <20030216054157.GA1973@athlon.pn.xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 15, 2003 at 09:41:57PM -0800, Marcel Moolenaar wrote: > 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. Thanks for pointing this out. I noticed that making MINSIZE an integer multiple of (ALIGNBYTES + 1) fixed the problem, but didn't notice that stacknxt started off being wrongly aligned. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030216195313.A99764>