From e0b34937b1bd674c05d609331501f81740fbb87f Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 23 May 2024 01:31:02 -0400 Subject: kernel: vm: Add memory stats Signed-off-by: Ian Moffett --- sys/include/vm/physseg.h | 7 +++++++ sys/include/vm/vm.h | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'sys/include/vm') diff --git a/sys/include/vm/physseg.h b/sys/include/vm/physseg.h index aced4cb..af8cae8 100644 --- a/sys/include/vm/physseg.h +++ b/sys/include/vm/physseg.h @@ -32,8 +32,15 @@ #include +struct physmem_stat { + size_t reserved_kib; /* Reserved memory */ + size_t total_kib; /* Total memory */ +}; + void vm_physseg_init(void); uintptr_t vm_alloc_pageframe(size_t count); + void vm_free_pageframe(uintptr_t base, size_t count); +struct physmem_stat vm_phys_memstat(void); #endif /* !_VM_VM_PHYSSEG_H_ */ diff --git a/sys/include/vm/vm.h b/sys/include/vm/vm.h index 975eff0..f6fba66 100644 --- a/sys/include/vm/vm.h +++ b/sys/include/vm/vm.h @@ -39,6 +39,7 @@ #include #include #include +#include extern volatile struct limine_hhdm_request g_hhdm_request; @@ -52,6 +53,10 @@ struct vm_range { uintptr_t end; }; +struct vm_memstat { + struct physmem_stat pmem_stat; +}; + /* * Returns the machine's pagesize: * @@ -67,5 +72,6 @@ vm_get_page_size(void) void vm_init(void); struct vm_ctx *vm_get_ctx(void); struct vas vm_get_kvas(void); +struct vm_memstat vm_memstat(void); #endif /* !_VM_H_ */ -- cgit v1.2.3