x86_64: pmap: fix typos

This commit is contained in:
2023-02-07 12:10:12 +00:00
parent 52c1ba89c4
commit e939aae775

View File

@@ -1,4 +1,4 @@
#include "socks/types.h"
#include <socks/types.h>
#include <socks/memblock.h>
#include <socks/vm.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);
*pt = 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 (size == PS_1G) {
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 */
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]));
}
/* 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 (pdir->p_entries[pd_index] != 0) {
/* this slot points to a ptab, delete it.
@@ -234,13 +233,11 @@ void pmap_bootstrap(void)
}
size_t hugepage_sz = ps_size(hugepage);
pml4t_t *kernel_pml4t;
kernel_pmap = alloc_pmap(&kernel_pml4t);
kernel_pmap = alloc_pmap();
//do_pmap_add(kernel_pmap, NULL, 0, VM_PROT_READ, PS_2M);
/* map 2GiB at the end of the address space to cover
the kernel and memblock-allocated data */
/* map 2GiB at the end of the address space to
replace the mapping created by start_32 and allow access to
the kernel and memblock-allocated data. */
uintptr_t vbase = VM_KERNEL_VOFFSET;
for (size_t i = 0; i < C_2GiB; i += hugepage_sz) {
do_pmap_add(kernel_pmap,