x86_64: pmap: fix typos
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#include "socks/types.h"
|
#include <socks/types.h>
|
||||||
#include <socks/memblock.h>
|
#include <socks/memblock.h>
|
||||||
#include <socks/vm.h>
|
#include <socks/vm.h>
|
||||||
#include <socks/printk.h>
|
#include <socks/printk.h>
|
||||||
@@ -33,10 +33,9 @@ static size_t ps_size(page_size_t ps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmap_t alloc_pmap(pml4t_t **pt)
|
static pmap_t alloc_pmap()
|
||||||
{
|
{
|
||||||
pml4t_t *p = kzalloc(sizeof *p, 0);
|
pml4t_t *p = kzalloc(sizeof *p, 0);
|
||||||
*pt = p;
|
|
||||||
return vm_virt_to_phys(p);
|
return vm_virt_to_phys(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +175,7 @@ static kern_status_t do_pmap_add(pmap_t pmap, void *p, pfn_t pfn, vm_prot_t prot
|
|||||||
/* if we're mapping a 1GiB page, we stop here */
|
/* if we're mapping a 1GiB page, we stop here */
|
||||||
if (size == PS_1G) {
|
if (size == PS_1G) {
|
||||||
if (pdpt->p_entries[pdpt_index] != 0) {
|
if (pdpt->p_entries[pdpt_index] != 0) {
|
||||||
/* this slot points to a ptab, delete it.
|
/* this slot points to a pdir, delete it.
|
||||||
if this slot points to a hugepage, this does nothing */
|
if this slot points to a hugepage, this does nothing */
|
||||||
delete_pdir(pdpt->p_entries[pdpt_index]);
|
delete_pdir(pdpt->p_entries[pdpt_index]);
|
||||||
}
|
}
|
||||||
@@ -197,7 +196,7 @@ static kern_status_t do_pmap_add(pmap_t pmap, void *p, pfn_t pfn, vm_prot_t prot
|
|||||||
pdir = vm_phys_to_virt(ENTRY_TO_PTR(pdpt->p_entries[pdpt_index]));
|
pdir = vm_phys_to_virt(ENTRY_TO_PTR(pdpt->p_entries[pdpt_index]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we're ampping a 2MiB page, we stop here */
|
/* if we're mapping a 2MiB page, we stop here */
|
||||||
if (size == PS_2M) {
|
if (size == PS_2M) {
|
||||||
if (pdir->p_entries[pd_index] != 0) {
|
if (pdir->p_entries[pd_index] != 0) {
|
||||||
/* this slot points to a ptab, delete it.
|
/* this slot points to a ptab, delete it.
|
||||||
@@ -234,13 +233,11 @@ void pmap_bootstrap(void)
|
|||||||
}
|
}
|
||||||
size_t hugepage_sz = ps_size(hugepage);
|
size_t hugepage_sz = ps_size(hugepage);
|
||||||
|
|
||||||
pml4t_t *kernel_pml4t;
|
kernel_pmap = alloc_pmap();
|
||||||
kernel_pmap = alloc_pmap(&kernel_pml4t);
|
|
||||||
|
|
||||||
//do_pmap_add(kernel_pmap, NULL, 0, VM_PROT_READ, PS_2M);
|
/* map 2GiB at the end of the address space to
|
||||||
|
replace the mapping created by start_32 and allow access to
|
||||||
/* map 2GiB at the end of the address space to cover
|
the kernel and memblock-allocated data. */
|
||||||
the kernel and memblock-allocated data */
|
|
||||||
uintptr_t vbase = VM_KERNEL_VOFFSET;
|
uintptr_t vbase = VM_KERNEL_VOFFSET;
|
||||||
for (size_t i = 0; i < C_2GiB; i += hugepage_sz) {
|
for (size_t i = 0; i < C_2GiB; i += hugepage_sz) {
|
||||||
do_pmap_add(kernel_pmap,
|
do_pmap_add(kernel_pmap,
|
||||||
|
|||||||
Reference in New Issue
Block a user