[klibc] myths about upwards growing stacks

H. Peter Anvin hpa@zytor.com
Sun, 26 Jan 2003 15:18:15 -0800


Matthew Wilcox wrote:
> just downloaded klibc 0.72 and took a look.  first thing i found was that
> the URL for latest version is out of date:
> 
> klibc is archived at:
> 
>         ftp://ftp.zytor.com/pub/linux/libs/klibc/
> 
> the `libs/' is superfluous.
> 
> more importantly, this piece of code in klibc/arch/README is wrong:
> 
> #if STACK_GROWS_UP
>   argc = (int)*argptr--;
>   argv = (char **)argptr;
>   envp = argv-(argc+1);
> #else
>   argc = (int)*argptr++;
>   argv = (char **)argptr;
>   envp = argv+(argc+1);
> #endif
> 
> i'm not sure why people think that having an upwards-growing stack
> means that argc, argv & envp all change places, but they don't.  see
> include/asm-parisc/processor.h for complete details of the stack layout.
> 

As we discussed at LCA, the README is indeed wrong in much more than the 
above code.  I have updated it in the CVS tree.

	-hpa