From 4130562b1555cabe441efe9420cebe12e7ed8d39 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 13 Jan 2024 16:43:49 -0500 Subject: application loading --- include/mercury/kernel/paging.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'include/mercury/kernel/paging.hpp') diff --git a/include/mercury/kernel/paging.hpp b/include/mercury/kernel/paging.hpp index 4ba5fdf..f6d400a 100644 --- a/include/mercury/kernel/paging.hpp +++ b/include/mercury/kernel/paging.hpp @@ -11,27 +11,36 @@ 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); + uint64_t encode_pte( + uint64_t addr, bool user, bool write, bool execute, bool ps); + void init_kernel_page_tables(uint64_t kernel_offset); - void map_kernel_stack(); + void map_kernel_stacks(); - //assumes page-alignment void map_kernel_page( uint64_t paddr, uint64_t vaddr, bool write, bool execute); + void unmap_kernel_page(uint64_t vaddr); + //maps writable and not executable void *map_new_kernel_pages(uint64_t count); + //maps writable and not executable + void map_new_kernel_page(uint64_t &vaddr_out, uint64_t &paddr_out); + uint64_t get_used_vram_page_count(); uint64_t get_free_pram_page_count(); + extern uint64_t kernel_p4e; + + uint64_t take_2mib_pram_page(); + } #endif -- cgit v1.2.3