From 33584548339a79eba908635b1eb2d342f295151e Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 13 Nov 2022 16:56:03 +0100 Subject: [PATCH] Add getters for free, used and reserved memory --- kernel/src/MemoryManager.cpp | 19 +++++++++++++++---- kernel/src/MemoryManager.h | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/kernel/src/MemoryManager.cpp b/kernel/src/MemoryManager.cpp index 4f349e0d..1223ffd8 100644 --- a/kernel/src/MemoryManager.cpp +++ b/kernel/src/MemoryManager.cpp @@ -98,10 +98,6 @@ namespace MemoryManager lock_pages((u64)page_bitmap_addr, page_bitmap_size / MMU::page_size() + 1); } - void protect_kernel_sections() - { - } - void init() { init_physical_allocator(); @@ -148,4 +144,19 @@ namespace MemoryManager if (start_index > index) start_index = index; return {}; } + + u64 free() + { + return free_mem; + } + + u64 used() + { + return used_mem; + } + + u64 reserved() + { + return reserved_mem; + } } \ No newline at end of file diff --git a/kernel/src/MemoryManager.h b/kernel/src/MemoryManager.h index 0f580786..59621504 100644 --- a/kernel/src/MemoryManager.h +++ b/kernel/src/MemoryManager.h @@ -11,4 +11,8 @@ namespace MemoryManager void lock_page(u64 page); void lock_pages(u64 pages, u64 count); + + u64 free(); + u64 used(); + u64 reserved(); } \ No newline at end of file