Eliminate USERTOP; no use for it.

This commit is contained in:
Frans Kaashoek 2011-08-24 10:24:40 -04:00
parent 194f8bf739
commit 6f2327580f
2 changed files with 3 additions and 4 deletions

View file

@ -6,7 +6,6 @@
// Key addresses for address space layout (see kmap in vm.c for the layout) // Key addresses for address space layout (see kmap in vm.c for the layout)
#define KERNBASE 0xF0000000 // First kernel virtual address #define KERNBASE 0xF0000000 // First kernel virtual address
#define USERTOP (KERNBASE-PGSIZE) // Highest user virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__

6
vm.c
View file

@ -99,7 +99,7 @@ mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm, char* (*alloc)(vo
// than its memory. // than its memory.
// //
// setupkvm() and exec() set up every page table like this: // setupkvm() and exec() set up every page table like this:
// 0..USERTOP : user memory (text, data, stack, heap), mapped to some unused phys mem // 0..KERNBASE : user memory (text, data, stack, heap), mapped to some unused phys mem
// KERNBASE..KERNBASE+EXTMEM: mapped to 0..EXTMEM (below extended memory) // KERNBASE..KERNBASE+EXTMEM: mapped to 0..EXTMEM (below extended memory)
// KERNBASE+EXTMEM..KERNBASE+end : mapped to EXTMEM..end (mapped without write permission) // KERNBASE+EXTMEM..KERNBASE+end : mapped to EXTMEM..end (mapped without write permission)
// KERNBASE+end..KERBASE+PHYSTOP : mapped to end..PHYSTOP (rw data + free memory) // KERNBASE+end..KERBASE+PHYSTOP : mapped to end..PHYSTOP (rw data + free memory)
@ -223,7 +223,7 @@ allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
char *mem; char *mem;
uint a; uint a;
if(newsz > USERTOP) if(newsz >= KERNBASE)
return 0; return 0;
if(newsz < oldsz) if(newsz < oldsz)
return oldsz; return oldsz;
@ -279,7 +279,7 @@ freevm(pde_t *pgdir)
if(pgdir == 0) if(pgdir == 0)
panic("freevm: no pgdir"); panic("freevm: no pgdir");
deallocuvm(pgdir, USERTOP, 0); deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){ for(i = 0; i < NPDENTRIES; i++){
if(pgdir[i] & PTE_P) { if(pgdir[i] & PTE_P) {
char * v = p2v(PTE_ADDR(pgdir[i])); char * v = p2v(PTE_ADDR(pgdir[i]));