From owner-cvs-all Sun Feb 16 0:53:24 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 499FE37B401; Sun, 16 Feb 2003 00:53:21 -0800 (PST) Received: from dilbert.robbins.dropbear.id.au (121.d.011.mel.iprimus.net.au [210.50.219.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id A877743FA3; Sun, 16 Feb 2003 00:53:18 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au (hd17qe7r2ck2buqp@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id h1G8rF0n000150; Sun, 16 Feb 2003 19:53:16 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id h1G8rDO9000149; Sun, 16 Feb 2003 19:53:13 +1100 (EST) (envelope-from tim) Date: Sun, 16 Feb 2003 19:53:13 +1100 From: Tim Robbins To: Marcel Moolenaar 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> References: <200302160328.h1G3SB3s074208@repoman.freebsd.org> <20030216054157.GA1973@athlon.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030216054157.GA1973@athlon.pn.xcllnt.net>; from marcel@xcllnt.net on Sat, Feb 15, 2003 at 09:41:57PM -0800 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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-all" in the body of the message