ref: 0132e7fed0ee48dae66607fbccd7c0ab1acea45e
parent: ed6b42863cbe71ec4ab31966bc23f5d84374f6b3
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Apr 4 11:21:25 EDT 2019
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.
--- a/sys/src/9/pc64/mem.h
+++ b/sys/src/9/pc64/mem.h
@@ -44,9 +44,8 @@
*/
#define UTZERO (0x0000000000200000ull) /* first address in user text */
#define UADDRMASK (0x00007fffffffffffull) /* canonical address mask */
-#define TSTKTOP (0x00007ffffffff000ull)
+#define USTKTOP (0x00007ffffffff000ull)
#define USTKSIZE (16*MiB) /* size of user stack */
-#define USTKTOP (TSTKTOP-USTKSIZE) /* end of new stack in sysexec */
/*
* Address spaces. Kernel, sorted by address.
--- a/sys/src/9/pc64/mmu.c
+++ b/sys/src/9/pc64/mmu.c
@@ -221,12 +221,12 @@
flags = PTEWRITE|PTEVALID;
if(va < VMAP){
assert(up != nil);
- assert((va < TSTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE));
+ assert((va < USTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE));
p = mmualloc();
p->index = index;
p->level = level;
- if(va < TSTKTOP){
+ if(va < USTKTOP){
flags |= PTEUSER;
if(level == PML4E){
if((p->next = up->mmuhead) == nil)
@@ -341,9 +341,9 @@
/* common case */
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(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++){
if((w = m->mmumap[i]) == 0)