diff options
author | Benji Dial <benji@benjidial.net> | 2024-05-20 17:40:47 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-05-20 17:40:47 -0400 |
commit | 9af5588c30c4126a2800aae1afcb0de2c373dc6c (patch) | |
tree | d2a48a97b1664f958b5f88a8b0c03ef8366b0f49 /kernel/source/paging.cpp | |
parent | 5a54df93c4e9368c36e69d1e9c88cd2904e92308 (diff) | |
download | hilbert-os-9af5588c30c4126a2800aae1afcb0de2c373dc6c.tar.gz |
rewrite application stuff in the kernel to support multitasking
Diffstat (limited to 'kernel/source/paging.cpp')
-rw-r--r-- | kernel/source/paging.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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) |