foo
This commit is contained in:
+11
-1
@@ -17,6 +17,16 @@ errno_t pmap_new_kernel(struct pmap* pt, enum alloc_flags flags) {
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
pte_t* root = HHDM_PTR(addr);
|
||||
const size_t num_entries = (size_t)1 << arch_mem_level_bits();
|
||||
for (size_t i = num_entries / 2; i < num_entries; i++) {
|
||||
phys_t dir;
|
||||
status = mem_phys_alloc(1, flags, &dir);
|
||||
if (status)
|
||||
return status;
|
||||
root[i] = pte_build(dir, PTE_DIR, CACHE_ANY);
|
||||
}
|
||||
|
||||
struct pmap result = {
|
||||
.root = addr,
|
||||
.lock = (struct spinlock){0},
|
||||
@@ -71,7 +81,7 @@ static pte_t* get_pte(struct pmap* pt, uintptr_t vaddr, bool is_user, bool check
|
||||
|
||||
if (pte_is_present(pte)) {
|
||||
// Get the next level.
|
||||
*pte = pte_build(pte_address(pte), level_flags, CACHE_ANY);
|
||||
*pte |= pte_build(0, level_flags, CACHE_ANY);
|
||||
current_head = HHDM_PTR(pte_address(pte));
|
||||
} else {
|
||||
// If the current level isn't present, we can skip the rest.
|
||||
|
||||
Reference in New Issue
Block a user