pc64: get rid of TSTKTOP, USTKTOP is the end of user address space

the temporary stack segment used to be at a fixed address above or
below the user stack. these days, the temp stack is mapped dynamically
by sysexec so TSTKTOP is obsolete.
This commit is contained in:
cinap_lenrek 2019-04-04 15:21:25 +02:00
parent ed6b42863c
commit 0132e7fed0
2 changed files with 5 additions and 6 deletions

View file

@ -44,9 +44,8 @@
*/ */
#define UTZERO (0x0000000000200000ull) /* first address in user text */ #define UTZERO (0x0000000000200000ull) /* first address in user text */
#define UADDRMASK (0x00007fffffffffffull) /* canonical address mask */ #define UADDRMASK (0x00007fffffffffffull) /* canonical address mask */
#define TSTKTOP (0x00007ffffffff000ull) #define USTKTOP (0x00007ffffffff000ull)
#define USTKSIZE (16*MiB) /* size of user stack */ #define USTKSIZE (16*MiB) /* size of user stack */
#define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */
/* /*
* Address spaces. Kernel, sorted by address. * Address spaces. Kernel, sorted by address.

View file

@ -221,12 +221,12 @@ mmucreate(uintptr *table, uintptr va, int level, int index)
flags = PTEWRITE|PTEVALID; flags = PTEWRITE|PTEVALID;
if(va < VMAP){ if(va < VMAP){
assert(up != nil); assert(up != nil);
assert((va < TSTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE)); assert((va < USTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE));
p = mmualloc(); p = mmualloc();
p->index = index; p->index = index;
p->level = level; p->level = level;
if(va < TSTKTOP){ if(va < USTKTOP){
flags |= PTEUSER; flags |= PTEUSER;
if(level == PML4E){ if(level == PML4E){
if((p->next = up->mmuhead) == nil) if((p->next = up->mmuhead) == nil)
@ -341,9 +341,9 @@ mmuzap(void)
/* common case */ /* common case */
pte[PTLX(UTZERO, 3)] = 0; pte[PTLX(UTZERO, 3)] = 0;
pte[PTLX(TSTKTOP, 3)] = 0; pte[PTLX(USTKTOP-1, 3)] = 0;
m->mmumap[PTLX(UTZERO, 3)/MAPBITS] &= ~(1ull<<(PTLX(UTZERO, 3)%MAPBITS)); m->mmumap[PTLX(UTZERO, 3)/MAPBITS] &= ~(1ull<<(PTLX(UTZERO, 3)%MAPBITS));
m->mmumap[PTLX(TSTKTOP, 3)/MAPBITS] &= ~(1ull<<(PTLX(TSTKTOP, 3)%MAPBITS)); m->mmumap[PTLX(USTKTOP-1, 3)/MAPBITS] &= ~(1ull<<(PTLX(USTKTOP-1, 3)%MAPBITS));
for(i = 0; i < nelem(m->mmumap); pte += MAPBITS, i++){ for(i = 0; i < nelem(m->mmumap); pte += MAPBITS, i++){
if((w = m->mmumap[i]) == 0) if((w = m->mmumap[i]) == 0)