From dd5d9e1d48396cbc226ff14fe557a55613c91fcb Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 15 Mar 2024 13:16:02 -0400 Subject: better buddy memory allocator --- arch/x86_64/paging.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/x86_64') diff --git a/arch/x86_64/paging.c b/arch/x86_64/paging.c index 29c4863..9e8a5ed 100644 --- a/arch/x86_64/paging.c +++ b/arch/x86_64/paging.c @@ -43,7 +43,7 @@ s_paging_fetch_table(union PageEntry *pt, size_t l, uintptr_t virt) bool entry_new = false; if(!entry.p) { entry_new = true; - entry.value = mem_phys_take4k(); + entry.value = mem_phys_alloc(1); entry.p = 1; entry.rw = 1; entry.us = 1; @@ -116,7 +116,7 @@ mem_pd_ensure_4k(struct PageDirectory *pd, uintptr_t virt, uint8_t flg) { union PageEntry pml1e = mem_paging_fetch4k(pd, virt); if(!pml1e.p) { - uintptr_t phys = mem_phys_take4k(); + uintptr_t phys = mem_phys_alloc(1); mem_paging_map4k(pd, phys, virt, flg); } } @@ -143,7 +143,7 @@ mem_ensure_range(uintptr_t from, uintptr_t to, bool rw, bool user) void mem_pd_new(struct PageDirectory *pd) { - physptr_t pml4p = mem_phys_take4k(); + physptr_t pml4p = mem_phys_alloc(1); union PageEntry *pml4 = (union PageEntry*)mem_phys_tolinear(pml4p); memset(pml4, 0, PAGESIZE); memcpy(&pml4[256], &pd->pml4_vaddr[256], PAGESIZE / 2); -- cgit v1.2.1