--- /sys/src/9/bcm/main.c Sat Jan 26 00:19:03 2013 +++ /sys/src/9/bcm/main.c Fri Jul 26 00:49:36 2013 @@ -10,6 +10,11 @@ #include "reboot.h" +enum { + /* space for syscall args, return PC, top-of-stack struct */ + Ustkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), +}; + /* Firmware compatibility */ #define Minfirmrev 326770 #define Minfirmdate "22 Jul 2012" @@ -326,7 +331,7 @@ * of the argument list checked in syscall. */ i = oargblen+1; - p = UINT2PTR(STACKALIGN(base + BY2PG - sizeof(Tos) - i)); + p = UINT2PTR(STACKALIGN(base + BY2PG - Ustkheadroom - i)); memmove(p, oargb, i); /* --- /sys/src/9/kw/main.c Tue Jul 26 18:46:45 2011 +++ /sys/src/9/kw/main.c Fri Jul 26 00:46:17 2013 @@ -7,6 +7,7 @@ #include "init.h" #include "arm.h" #include +#include #include "reboot.h" @@ -24,6 +25,9 @@ enum { Maxmem = 512*MB, /* limited by address ranges */ Minmem = 256*MB, /* conservative default */ + + /* space for syscall args, return PC, top-of-stack struct */ + Ustkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), }; #define isascii(c) ((uchar)(c) > 0 && (uchar)(c) < 0177) @@ -515,7 +519,7 @@ * of the argument list checked in syscall. */ i = oargblen+1; - p = UINT2PTR(STACKALIGN(base + BY2PG - sizeof(up->s.args) - i)); + p = UINT2PTR(STACKALIGN(base + BY2PG - Ustkheadroom - i)); memmove(p, oargb, i); /* --- /sys/src/9/omap/main.c Tue Jan 18 00:58:06 2011 +++ /sys/src/9/omap/main.c Fri Jul 26 00:46:17 2013 @@ -7,6 +7,7 @@ #include "init.h" #include +#include #include "reboot.h" @@ -23,8 +24,12 @@ enum { Minmem = 256*MB, /* conservative default */ + + /* space for syscall args, return PC, top-of-stack struct */ + Ustkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), }; + #define isascii(c) ((uchar)(c) > 0 && (uchar)(c) < 0177) uintptr kseg0 = KZERO; @@ -485,7 +490,7 @@ * of the argument list checked in syscall. */ i = oargblen+1; - p = UINT2PTR(STACKALIGN(base + BY2PG - sizeof(up->s.args) - i)); + p = UINT2PTR(STACKALIGN(base + BY2PG - Ustkheadroom - i)); memmove(p, oargb, i); /* --- /sys/src/9/pc/main.c Thu Jun 13 23:02:40 2013 +++ /sys/src/9/pc/main.c Fri Jul 26 00:28:23 2013 @@ -9,6 +9,7 @@ #include "pool.h" #include "reboot.h" #include "mp.h" +#include Mach *m; @@ -24,6 +25,11 @@ #define BOOTARGSLEN (4096-0x200-BOOTLINELEN) #define MAXCONF 64 +enum { + /* space for syscall args, return PC, top-of-stack struct */ + Ustkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), +}; + char bootdisk[KNAMELEN]; Conf conf; char *confname[MAXCONF]; @@ -306,7 +312,7 @@ char *cp = BOOTLINE; char buf[64]; - sp = (uchar*)base + BY2PG - MAXSYSARG*BY2WD; + sp = (uchar*)base + BY2PG - Ustkheadroom; ac = 0; av[ac++] = pusharg("/386/9dos"); @@ -414,8 +420,8 @@ * The patch of nimage is a band-aid, scanning the whole * page list in imagereclaim just takes too long. */ - if(kpages > (64*MB + conf.npage*sizeof(Page))/BY2PG){ - kpages = (64*MB + conf.npage*sizeof(Page))/BY2PG; + if(kpages > (128*MB + conf.npage*sizeof(Page))/BY2PG){ + kpages = (128*MB + conf.npage*sizeof(Page))/BY2PG; conf.nimage = 2000; kpages += (conf.nproc*KSTACK)/BY2PG; } --- /sys/src/9/pcboot/main.c Thu May 31 20:22:47 2012 +++ /sys/src/9/pcboot/main.c Fri Jul 26 00:45:57 2013 @@ -16,9 +16,13 @@ #include "pool.h" #include "reboot.h" #include "ip.h" /* for eipfmt */ +#include enum { Datamagic = 0xbabeabed, + + /* space for syscall args, return PC, top-of-stack struct */ + Ustkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), }; Mach *m; @@ -343,7 +347,7 @@ return sp; } -/* we're a bootstrap loader, so we aren't passed any options. */ +/* we're a bootstrap loader, so we aren't passed any options to pass on. */ void bootargs(void *base) { @@ -353,7 +357,7 @@ char *cp = ""; char buf[64]; - sp = (uchar*)base + BY2PG - MAXSYSARG*BY2WD; + sp = (uchar*)base + BY2PG - Ustkheadroom; ac = 0; av[ac++] = pusharg("/386/9dos"); --- /sys/src/9/rb/main.c Tue Jul 23 03:48:59 2013 +++ /sys/src/9/rb/main.c Fri Jul 26 00:46:17 2013 @@ -11,6 +11,11 @@ #include #include "reboot.h" +enum { + /* space for syscall args, return PC, top-of-stack struct */ + Stkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), +}; + typedef struct mipsexec Mipsexec; /* @@ -283,7 +288,7 @@ * of the argument list checked in syscall. */ i = oargblen+1; - p = UINT2PTR(STACKALIGN(base + BY2PG - sizeof(Tos) - i)); + p = UINT2PTR(STACKALIGN(base + BY2PG - Stkheadroom - i)); memmove(p, oargb, i); /* @@ -329,7 +334,7 @@ * Kernel Stack */ p->sched.pc = (ulong)init0; - p->sched.sp = (ulong)p->kstack+KSTACK-(sizeof(Sargs)+BY2WD); + p->sched.sp = (ulong)p->kstack+KSTACK-Stkheadroom; p->sched.sp = STACKALIGN(p->sched.sp); /* --- /sys/src/9/teg2/main.c Tue May 1 22:57:57 2012 +++ /sys/src/9/teg2/main.c Fri Jul 26 00:33:01 2013 @@ -7,6 +7,7 @@ #include "init.h" #include +#include #include "arm.h" #include "reboot.h" @@ -24,6 +25,9 @@ enum { Minmem = 256*MB, /* conservative default */ + + /* space for syscall args, return PC, top-of-stack struct */ + Ustkheadroom = sizeof(Sargs) + sizeof(uintptr) + sizeof(Tos), }; #define isascii(c) ((uchar)(c) > 0 && (uchar)(c) < 0177) @@ -714,7 +718,7 @@ * of the argument list checked in syscall. */ i = oargblen+1; - p = UINT2PTR(STACKALIGN(base + BY2PG - sizeof(up->s.args) - i)); + p = UINT2PTR(STACKALIGN(base + BY2PG - Ustkheadroom)); memmove(p, oargb, i); /*