From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sat, 16 Mar 2013 21:56:10 -0400 To: 9fans@9fans.net Message-ID: <28593dfb6d5103e0abae7d7c9f22ea0f@brasstown.quanstro.net> In-Reply-To: <795419ca3771d16899c7b30e7c59ec84@rei2.9hal> References: <795419ca3771d16899c7b30e7c59ec84@rei2.9hal> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] exec() question Topicbox-Message-UUID: 2c300bb2-ead8-11e9-9d60-3106f5b1d025 so, i thought about this a bit, and i think the extra flexablity and generality of finding a hole in the process' address space for ESEG doesn't pay=E2=80=94too fancy. moving TSTK above the normal stack so TSTK is not in normally adressable space, seems more natural. for nix this results in a trivial diff /n/dump/2013/0316/sys/src/nix/k10/mem.h:60,68 - /sys/src/nix/k10/mem.h:60= ,68 */ #define UTZERO (0+2*MiB) /* first address in user text */ #define UTROUND(t) ROUNDUP((t), BIGPGSZ) - #define USTKTOP (0x00007ffffffff000ull & ~(BIGPGSZ-1)) + #define TSTKTOP (0x00007ffffffff000ull & ~(BIGPGSZ-1)) #define USTKSIZE (16*1024*1024) /* size of user stack */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* end of new stack in sysexec */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */ =20 =20 /* it's a little more intricate for the 9 kernels, as they aren't quite as tidy. but still, there are just a few extra bits. it is probablly a good idea to rid ourselves of TSTKSIZE as it's not needed anymore. - erik diff -c /n/dump/2013/0316/sys/src/9/bcm/mmu.c bcm/mmu.c /n/dump/2013/0316/sys/src/9/bcm/mmu.c:12,18 - bcm/mmu.c:12,18 =20 enum { L1lo =3D UZERO/MiB, /* L1X(UZERO)? */ - L1hi =3D (USTKTOP+MiB-1)/MiB, /* L1X(USTKTOP+MiB-1)? */ + L1hi =3D (TSTKTOP+MiB-1)/MiB, /* L1X(TSTKTOP+MiB-1)? */ }; =20 void diff -c /n/dump/2013/0316/sys/src/9/kw/mmu.c kw/mmu.c /n/dump/2013/0316/sys/src/9/kw/mmu.c:12,18 - kw/mmu.c:12,18 =20 enum { L1lo =3D UZERO/MiB, /* L1X(UZERO)? */ - L1hi =3D (USTKTOP+MiB-1)/MiB, /* L1X(USTKTOP+MiB-1)? */ + L1hi =3D (TSTKTOP+MiB-1)/MiB, /* L1X(TSTKTOP+MiB-1)? */ }; =20 #define ISHOLE(pte) ((pte) =3D=3D 0) diff -c /n/dump/2013/0316/sys/src/9/omap/mmu.c omap/mmu.c /n/dump/2013/0316/sys/src/9/omap/mmu.c:11,17 - omap/mmu.c:11,17 =20 enum { L1lo =3D UZERO/MiB, /* L1X(UZERO)? */ - L1hi =3D (USTKTOP+MiB-1)/MiB, /* L1X(USTKTOP+MiB-1)? */ + L1hi =3D (TSTKTOP+MiB-1)/MiB, /* L1X(TSTKTOP+MiB-1)? */ }; =20 #define ISHOLE(pte) ((pte) =3D=3D 0) diff -c /n/dump/2013/0316/sys/src/9/teg2/mmu.c teg2/mmu.c /n/dump/2013/0316/sys/src/9/teg2/mmu.c:23,29 - teg2/mmu.c:23,29 =20 L1lo =3D UZERO/MiB, /* L1X(UZERO)? */ #ifdef SMALL_ARM /* well under 1GB of RAM? */ - L1hi =3D (USTKTOP+MiB-1)/MiB, /* L1X(USTKTOP+MiB-1)? */ + L1hi =3D (TSTKTOP+MiB-1)/MiB, /* L1X(TSTKTOP+MiB-1)? */ #else /* * on trimslice, top of 1GB ram can't be addressible, as high diff -c /n/dump/2013/0316/sys/src/9/bcm/mem.h bcm/mem.h /n/dump/2013/0316/sys/src/9/bcm/mem.h:51,59 - bcm/mem.h:51,59 =20 #define UZERO 0 /* user segment */ #define UTZERO (UZERO+BY2PG) /* user text start */ - #define USTKTOP 0x20000000 /* user segment end +1 */ + #define TSTKTOP 0x20000000 /* user segment end +1 */ #define USTKSIZE (8*1024*1024) /* user stack size */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* sysexec temporary stack */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* sysexec temporary stack */ #define TSTKSIZ 256 =20 /* address at which to copy and execute rebootcode */ diff -c /n/dump/2013/0316/sys/src/9/bitsy/mem.h bitsy/mem.h /n/dump/2013/0316/sys/src/9/bitsy/mem.h:60,68 - bitsy/mem.h:60,68 #define UCDRAMTOP 0xD0000000 /* ... */ #define NULLZERO 0xE0000000 /* 128 meg for cache flush zeroes */ #define NULLTOP 0xE8000000 /* ... */ - #define USTKTOP 0x2000000 /* byte just beyond user stack */ + #define TSTKTOP 0x2000000 /* byte just beyond user stack */ #define USTKSIZE (8*1024*1024) /* size of user stack */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* end of new stack in sysexec */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */ #define TSTKSIZ 100 #define MACHADDR (KZERO+0x00001000) #define EVECTORS 0xFFFF0000 /* virt base of exception vectors */ diff -c /n/dump/2013/0316/sys/src/9/kw/mem.h kw/mem.h /n/dump/2013/0316/sys/src/9/kw/mem.h:69,77 - kw/mem.h:69,77 =20 #define UZERO 0 /* user segment */ #define UTZERO (UZERO+BY2PG) /* user text start */ - #define USTKTOP KZERO /* user segment end +1 */ + #define TSTKTOP KZERO /* user segment end +1 */ #define USTKSIZE (8*1024*1024) /* user stack size */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* sysexec temporary stack */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* sysexec temporary stack */ #define TSTKSIZ 256 =20 /* address at which to copy and execute rebootcode */ diff -c /n/dump/2013/0316/sys/src/9/omap/mem.h omap/mem.h /n/dump/2013/0316/sys/src/9/omap/mem.h:73,81 - omap/mem.h:73,81 #define UTZERO (UZERO+BY2PG) /* user text start */ #define UTROUND(t) ROUNDUP((t), BY2PG) /* moved USTKTOP down to 512MB to keep MMIO space out of user space. */ - #define USTKTOP 0x20000000 /* user segment end +1 */ + #define TSTKTOP 0x20000000 /* user segment end +1 */ #define USTKSIZE (8*1024*1024) /* user stack size */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* sysexec temporary stack */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* sysexec temporary stack */ #define TSTKSIZ 256 =20 /* address at which to copy and execute rebootcode */ diff -c /n/dump/2013/0316/sys/src/9/pc/mem.h pc/mem.h /n/dump/2013/0316/sys/src/9/pc/mem.h:61,69 - pc/mem.h:61,69 #define VMAPSIZE (0x10000000-VPTSIZE-KMAPSIZE) #define UZERO 0 /* base of user address space */ #define UTZERO (UZERO+BY2PG) /* first address in user text */ - #define USTKTOP (VMAP-BY2PG) /* byte just beyond user stack */ + #define TSTKTOP (VMAP-BY2PG) /* byte just beyond user stack */ #define USTKSIZE (16*1024*1024) /* size of user stack */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* end of new stack in sysexec */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */ #define TSTKSIZ 256 /* pages in new stack; limits exec args */ =20 /* diff -c /n/dump/2013/0316/sys/src/9/pcpae/mem.h pcpae/mem.h /n/dump/2013/0316/sys/src/9/pcpae/mem.h:61,69 - pcpae/mem.h:61,69 #define VMAPSIZE (0x10000000-VPTSIZE-KMAPSIZE-KXMAPSIZE) #define UZERO 0 /* base of user address space */ #define UTZERO (UZERO+BY2PG) /* first address in user text */ - #define USTKTOP (VMAP-BY2PG) /* byte just beyond user stack */ + #define TSTKTOP (VMAP-BY2PG) /* byte just beyond user stack */ #define USTKSIZE (16*1024*1024) /* size of user stack */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* end of new stack in sysexec */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */ #define TSTKSIZ 256 /* pages in new stack; limits exec args */ =20 /* diff -c /n/dump/2013/0316/sys/src/9/teg2/mem.h teg2/mem.h /n/dump/2013/0316/sys/src/9/teg2/mem.h:91,99 - teg2/mem.h:91,99 * moved it down another MB to utterly avoid KADDR(stack_base) mapping * to high exception vectors. see confinit(). */ - #define USTKTOP (0x40000000 - 64*KiB - MiB) /* user segment end +1 */ + #define TSTKTOP (0x40000000 - 64*KiB - MiB) /* user segment end +1 */ #define USTKSIZE (8*1024*1024) /* user stack size */ - #define TSTKTOP (USTKTOP-USTKSIZE) /* sysexec temporary stack */ + #define USTKTOP (TSTKTOP-USTKSIZE) /* sysexec temporary stack */ #define TSTKSIZ 256 =20 /* address at which to copy and execute rebootcode */