diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-03-15 13:16:02 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-03-15 13:16:02 -0400 |
commit | dd5d9e1d48396cbc226ff14fe557a55613c91fcb (patch) | |
tree | b0ec9f54b80f26777ac08b723b42c1c64c5a2bda /arch | |
parent | f46ab8ca2050ee77edf6e6b979875426bdaf29dc (diff) | |
download | jove-kernel-dd5d9e1d48396cbc226ff14fe557a55613c91fcb.tar.gz jove-kernel-dd5d9e1d48396cbc226ff14fe557a55613c91fcb.tar.bz2 jove-kernel-dd5d9e1d48396cbc226ff14fe557a55613c91fcb.zip |
better buddy memory allocator
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86_64/paging.c | 6 |
1 files changed, 3 insertions, 3 deletions
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); |