Page fault handler now allocates new page tables

Rather than contantly checking if a page table exists before access, the fault handler will automatically allocate them as needed.
This commit is contained in:
2023-11-07 12:44:23 -06:00
parent 091830e508
commit 108e04a8f0
4 changed files with 106 additions and 25 deletions

View File

@@ -23,7 +23,7 @@ physaddr_t reserve_pages(size_t size);
* @param size
* @return int
*/
int free_pages(physaddr_t location, size_t size);
size_t free_pages(physaddr_t location);
/**
* @brief Reserves a single page and returns its physical address.
@@ -92,6 +92,27 @@ physaddr_t create_address_space();
*/
physaddr_t current_address_space();
/**
* @brief Maps a region in virtual memory with the specified flags.
*
* @param page
* @param frame
* @param size
* @param flags
*/
error_t map_region(void *page, physaddr_t frame, size_t size, int flags);
/**
* @brief Unmaps a region in virtual memory. All pages which contain some part
* of the region specified will be unmapped.
*
* @param page
* @param size
*
* @returns The physical address of the first page that was unmapped
*/
physaddr_t unmap_region(void *page, size_t size);
/**
* @brief Maps a single page with the specified flags.
*
@@ -100,7 +121,7 @@ physaddr_t current_address_space();
* @param flags
* @return int
*/
int map_page(void *page, physaddr_t frame, int flags);
error_t map_page(void *page, physaddr_t frame, int flags);
/**
* @brief Unmaps a single page, returning the physical address of the frame it