inching closer to nix. the base page size isn't necessarly the alignment for executables. introduce the UTROUND() macro from nix. additionally, fix the stack calcuations in pc and pcpae/main.c to account for the size of the Tos structure. without this fix the tos changes for rb make the pc kernel unbootable. Reference: /n/atom/patch/applied2013/utround Date: Sat Aug 3 21:30:15 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/9/port/sysproc.c Sat Aug 3 21:29:45 2013 +++ /sys/src/9/port/sysproc.c Sat Aug 3 21:29:46 2013 @@ -294,7 +294,7 @@ data = l2be(exec.data); bss = l2be(exec.bss); - t = (UTZERO+sizeof(Exec)+text+(BY2PG-1)) & ~(BY2PG-1); + t = UTROUND(UTZERO+sizeof(Exec)+text); d = (t + data + (BY2PG-1)) & ~(BY2PG-1); bssend = t + data + bss; b = (bssend + (BY2PG-1)) & ~(BY2PG-1); --- /sys/src/9/pc/main.c Sat Aug 3 21:29:47 2013 +++ /sys/src/9/pc/main.c Sat Aug 3 21:29:48 2013 @@ -8,6 +8,7 @@ #include "init.h" #include "pool.h" #include "reboot.h" +#include Mach *m; @@ -23,6 +24,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), +}; + usize segpgsizes = (1< Mach *m; @@ -23,6 +24,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), +}; + usize segpgsizes = (1<