From 95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sun, 12 Jan 2025 01:17:36 -0600 Subject: PROJECT RESTRUCTURING Move the entire kernel into its own directory. Create new directories for system commands, libraries and other required essentials for a complete Unix-like operating system. Signed-off-by: Danny Holman --- arch/i386/kernel/pmem.c | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 arch/i386/kernel/pmem.c (limited to 'arch/i386/kernel/pmem.c') diff --git a/arch/i386/kernel/pmem.c b/arch/i386/kernel/pmem.c deleted file mode 100644 index 40e3400..0000000 --- a/arch/i386/kernel/pmem.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -static struct pfa_page freelist; - -void pfa_init(struct mboot_info *header) { - struct mboot_mmap_entry *mme; - for (uintptr_t i = 0; i < header->mmap_length; i += sizeof(struct mboot_mmap_entry)) { - mme = (struct mboot_mmap_entry*)(header->mmap_addr + i); - if (mme->type == MBOOT_MEM_AVAILABLE) - pfa_free(mme->addr_low, mme->len_low / PAGE_SIZE); - } -} - -uintptr_t pfa_alloc(size_t num_pages) { - struct pfa_page *temp = (struct pfa_page*)PAGE_TMP_MAP; - map_page(freelist.next, PAGE_TMP_MAP, PD_PRES | PD_RW); - uintptr_t ret = freelist.next; - freelist.next = temp->next; - memset(temp, 0, 32); - unmap_page(PAGE_TMP_MAP); - return ret; -} - -void pfa_free(uintptr_t paddr, size_t num_pages) { - uintptr_t addr; - struct pfa_page *temp = (struct pfa_page*)PAGE_TMP_MAP; - for (size_t i = 0; i < num_pages; i++) { - addr = (i * PAGE_SIZE + paddr); - if (addr >= KSTART && addr < KEND) - continue; - if (addr == 0) - continue; - map_page(addr, PAGE_TMP_MAP, PD_PRES | PD_RW); - memset(PAGE_TMP_MAP, 1, 32); - temp->next = freelist.next; - freelist.next = addr; - unmap_page(PAGE_TMP_MAP); - } -} -- cgit v1.2.3