[Patch] TEST - prom-libc malloc

Przemyslaw Iskra sparky at pld-linux.org
Fri Apr 20 00:35:10 EST 2007


On Thu, Apr 19, 2007 at 10:30:16AM +0100, Paul Nasrat wrote:
> On Wed, 2007-04-18 at 11:54 -0500, Nathan Lynch wrote:
> 
> Thanks for the comments - as I said it's early stages for this one.
> 
> > Adding an atoi function seems unrelated to the rest of the patch?
> 
> Indeed I'll split that out it probably was a pull of extra stuff from
> prom-libc.

There's also strdup left in malloc.c, which, i beleve, should be moved
elsewere

> > Declarations should go in headers, not .c files.
> 
> Yup I'll fix up for final

Actually there's a lot more to do to clean up headers, there were many
declarations of functions nit existing in yaboot.


> > > +/*** bits/malloc.h ***/
> > > +struct __alloc_area
> > > +{
> > > +	struct __alloc_area *next;
> > > +	unsigned int length;
> > > +	long long foo;
> > > +};
> > 
> > What is foo?  Needs a comment, at least.
> 
> I'll look into.

Seems like foo is for aligning pruposes, this way returned pointer stays
aligned to highest boundary needed by architecture without writing a lot
of additional aligning code. malloc() returns pointer just after
__alloc_area structure so it has same alignment as 'foo'. Memory waste
is insignificant comparing to the trouble any other method would cause,
also it makes pointer[-1] problems not so harmful.


-- 
 ____  Sparky{PI] -- Przemyslaw _  ___  _  _  ........... LANG...Pl..Ca..Es..En
/____) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWW........ppcrcd.pld-linux.org
\____\| -_)'___| ||^'||//\\// <   |  _/| |  | : JID......sparky<at>jabberes.org
(____/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mail....sparky<at>pld-linux.org



More information about the Yaboot-devel mailing list