On Sat Mar 17 13:23:51 EDT 2007, [EMAIL PROTECTED] wrote:
> > the pc address space got bigger in 2005 so that programs could
> > use more than 2gb of memory. the top of the stack is now
> > 0xdffff000 instead of 0x7ffff000, so if you s/0x7/0xd/ you
> > will probably be okay.
> >
> Thank you very much, that worked fine, which is OK at least to test
> the compiler.
>
> > it would be even better if _main looked
> > at its stack pointer and anded off some bits, so that those
> > weren't hard-coded.
> >
> If you know a quick way to inspect the stack pointer, rather than me
> having to dig for it, I'll fix it with pleasure.
this c program will tell you where c leaves the tos.
#include<u.h>
#include<libc.h>
void
main(void)
{
char *tos;
print("%p\n", &tos);
exits("");
}
for me this prints dfffef68. so there are 0x98 bytes taken
from the top of the stack before main starts.
> Alternatively, if
> you know where I ought to look, please point me there. Oh, yes,
> please also explain what "and"ing off a few bits means, unless you
> mean that by trimming the incoming stack pointer I'll get a reasonable
> value for a private copy. That would make just about as much sense as
> I can grasp.
i'm pretty sure that's what he's after. /sys/src/libc/386/main9.s subtracts
a constant from _tos.
- erik