Change some memory mappings.
This commit is contained in:
parent
46cc5c9478
commit
0289ec3b3e
|
@ -175,9 +175,7 @@ mem_init(void)
|
||||||
// Your code goes here:
|
// Your code goes here:
|
||||||
boot_map_region(kern_pgdir,
|
boot_map_region(kern_pgdir,
|
||||||
UPAGES, ROUNDUP(pages_size, PGSIZE),
|
UPAGES, ROUNDUP(pages_size, PGSIZE),
|
||||||
PADDR(pages), PTE_W);
|
PADDR(pages), PTE_U);
|
||||||
kern_pgdir[PDX(UPAGES)] |= PTE_U | PTE_P;
|
|
||||||
kern_pgdir[PDX(UPAGES)] &= ~PTE_W;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Use the physical memory that 'bootstack' refers to as the kernel
|
// Use the physical memory that 'bootstack' refers to as the kernel
|
||||||
|
@ -193,8 +191,6 @@ mem_init(void)
|
||||||
boot_map_region(kern_pgdir,
|
boot_map_region(kern_pgdir,
|
||||||
KSTACKTOP-KSTKSIZE, KSTKSIZE,
|
KSTACKTOP-KSTKSIZE, KSTKSIZE,
|
||||||
PADDR(bootstack), PTE_W);
|
PADDR(bootstack), PTE_W);
|
||||||
kern_pgdir[PDX(KSTACKTOP-KSTKSIZE)] |= PTE_W | PTE_P;
|
|
||||||
kern_pgdir[PDX(KSTACKTOP-KSTKSIZE)] &= ~PTE_U;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Map all of physical memory at KERNBASE.
|
// Map all of physical memory at KERNBASE.
|
||||||
|
@ -207,9 +203,6 @@ mem_init(void)
|
||||||
boot_map_region(kern_pgdir,
|
boot_map_region(kern_pgdir,
|
||||||
KERNBASE, 0x100000000 - KERNBASE,
|
KERNBASE, 0x100000000 - KERNBASE,
|
||||||
0, PTE_W);
|
0, PTE_W);
|
||||||
kern_pgdir[PDX(KERNBASE)] |= PTE_W | PTE_P;
|
|
||||||
kern_pgdir[PDX(KERNBASE)] &= ~PTE_U;
|
|
||||||
|
|
||||||
|
|
||||||
// Check that the initial page directory has been set up correctly.
|
// Check that the initial page directory has been set up correctly.
|
||||||
check_kern_pgdir();
|
check_kern_pgdir();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user