changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: pc64: get rid of TSTKTOP, USTKTOP is the end of user address space

changeset 7133: 1b8391d51793
parent 7132: f7a2615a3bca
child 7134: 6204230cf8b6
author: cinap_lenrek@felloff.net
date: Thu, 04 Apr 2019 15:21:25 +0200
files: sys/src/9/pc64/mem.h sys/src/9/pc64/mmu.c
description: 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.
     1.1--- a/sys/src/9/pc64/mem.h
     1.2+++ b/sys/src/9/pc64/mem.h
     1.3@@ -44,9 +44,8 @@
     1.4  */
     1.5 #define UTZERO		(0x0000000000200000ull)		/* first address in user text */
     1.6 #define UADDRMASK	(0x00007fffffffffffull)		/* canonical address mask */
     1.7-#define TSTKTOP		(0x00007ffffffff000ull)
     1.8+#define USTKTOP		(0x00007ffffffff000ull)
     1.9 #define USTKSIZE	(16*MiB)			/* size of user stack */
    1.10-#define USTKTOP		(TSTKTOP-USTKSIZE)		/* end of new stack in sysexec */
    1.11 
    1.12 /*
    1.13  *  Address spaces. Kernel, sorted by address.
     2.1--- a/sys/src/9/pc64/mmu.c
     2.2+++ b/sys/src/9/pc64/mmu.c
     2.3@@ -221,12 +221,12 @@ mmucreate(uintptr *table, uintptr va, in
     2.4 	flags = PTEWRITE|PTEVALID;
     2.5 	if(va < VMAP){
     2.6 		assert(up != nil);
     2.7-		assert((va < TSTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE));
     2.8+		assert((va < USTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE));
     2.9 
    2.10 		p = mmualloc();
    2.11 		p->index = index;
    2.12 		p->level = level;
    2.13-		if(va < TSTKTOP){
    2.14+		if(va < USTKTOP){
    2.15 			flags |= PTEUSER;
    2.16 			if(level == PML4E){
    2.17 				if((p->next = up->mmuhead) == nil)
    2.18@@ -341,9 +341,9 @@ mmuzap(void)
    2.19 
    2.20 	/* common case */
    2.21 	pte[PTLX(UTZERO, 3)] = 0;
    2.22-	pte[PTLX(TSTKTOP, 3)] = 0;
    2.23+	pte[PTLX(USTKTOP-1, 3)] = 0;
    2.24 	m->mmumap[PTLX(UTZERO, 3)/MAPBITS] &= ~(1ull<<(PTLX(UTZERO, 3)%MAPBITS));
    2.25-	m->mmumap[PTLX(TSTKTOP, 3)/MAPBITS] &= ~(1ull<<(PTLX(TSTKTOP, 3)%MAPBITS));
    2.26+	m->mmumap[PTLX(USTKTOP-1, 3)/MAPBITS] &= ~(1ull<<(PTLX(USTKTOP-1, 3)%MAPBITS));
    2.27 
    2.28 	for(i = 0; i < nelem(m->mmumap); pte += MAPBITS, i++){
    2.29 		if((w = m->mmumap[i]) == 0)