From 6ee078e6feff82b2480d8034ca833563b3e849f8 Mon Sep 17 00:00:00 2001 From: ngiddings Date: Sat, 10 Apr 2021 19:15:37 -0500 Subject: [PATCH] Added C header for page table management --- include/mmgr.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/mmgr.h diff --git a/include/mmgr.h b/include/mmgr.h new file mode 100644 index 0000000..0bc0f53 --- /dev/null +++ b/include/mmgr.h @@ -0,0 +1,38 @@ +#pragma once + +#include "types/physaddr.h" + +/** + * @brief Create a new top-level page table and map the kernel in it. + * + * This function does not load the page table; it only initializes it. + * + * @return physaddr_t + */ +physaddr_t create_address_space(); + +/** + * @brief Load an existing top-level page table + * + * @param table + */ +void load_address_space(physaddr_t table); + +/** + * @brief Maps a single page with the specified flags. + * + * @param page + * @param frame + * @param flags + * @return int + */ +int map_page(void *page, physaddr_t frame, int flags); + +/** + * @brief Unmaps a single page, returning the physical address of the frame it + * pointed to. + * + * @param page + * @return physaddr_t + */ +physaddr_t unmap_page(void *page); \ No newline at end of file