diff options
author | Benji Dial <benji@benjidial.net> | 2024-01-08 22:28:41 -0500 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-01-08 22:28:41 -0500 |
commit | c2f48fb5df0981df1df23de2b277274f9fe75080 (patch) | |
tree | 5202557438bbe3bdc7d10c7769731ab3594185f9 /include/mercury/kernel/paging.hpp | |
download | hilbert-os-c2f48fb5df0981df1df23de2b277274f9fe75080.tar.gz |
first commit
Diffstat (limited to 'include/mercury/kernel/paging.hpp')
-rw-r--r-- | include/mercury/kernel/paging.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/mercury/kernel/paging.hpp b/include/mercury/kernel/paging.hpp new file mode 100644 index 0000000..9627162 --- /dev/null +++ b/include/mercury/kernel/paging.hpp @@ -0,0 +1,34 @@ +#ifndef MERCURY_KERNEL_PAGING_HPP +#define MERCURY_KERNEL_PAGING_HPP + +#include <cstdint> + +//in paging.asm +extern "C" [[noreturn]] void switch_to_kernel_p4(void (*and_then_jump_to)()); + +namespace mercury::kernel::paging { + + void mark_all_pram_used(); + void mark_all_vram_free(); + + //assumes page-alignment + void mark_pram_region_free(uint64_t start_addr, uint64_t end_addr); + //assumes page-alignment + void mark_vram_region_used(uint64_t start_addr, uint64_t end_addr); + + uint64_t find_unmapped_vram_region(uint64_t page_count); + + void init_kernel_page_tables(uint64_t kernel_offset); + + void map_kernel_stack(); + + //assumes page-alignment + void map_kernel_page( + uint64_t paddr, uint64_t vaddr, bool write, bool execute); + + uint64_t get_used_vram_page_count(); + uint64_t get_free_pram_page_count(); + +} + +#endif |