From 9af5588c30c4126a2800aae1afcb0de2c373dc6c Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 20 May 2024 17:40:47 -0400 Subject: rewrite application stuff in the kernel to support multitasking --- kernel/source/paging.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'kernel/source/paging.cpp') diff --git a/kernel/source/paging.cpp b/kernel/source/paging.cpp index d8869fc..66d9bc7 100644 --- a/kernel/source/paging.cpp +++ b/kernel/source/paging.cpp @@ -38,11 +38,6 @@ namespace hilbert::kernel::paging { uint64_t kernel_p4e; - uint64_t encode_pte(uint64_t addr, bool user, bool write, bool execute) { - return (addr & 0x0000ffffffffffff) | (execute ? 0 : (1ULL << 63)) - | (user << 2) | (write << 1) | 1; - } - void init_kernel_page_tables(uint64_t kernel_offset) { __kernel_p4_paddr = (uint64_t)kernel_p4 - kernel_offset; for (int i = 0; i < 511; ++i) @@ -87,6 +82,11 @@ namespace hilbert::kernel::paging { return 0; } + void free_pram_page(uint64_t paddr) { + uint64_t page_i = paddr / 4096; + pram_usage_bitmap[page_i / 64] &= ~(1ULL << (page_i % 64)); + } + void map_kernel_stacks() { for (uint64_t vaddr = syscall_stack_bottom; vaddr < syscall_stack_top; vaddr += 4096) -- cgit v1.2.3