diff options
author | sigsegv7 <ian@vegaa.systems> | 2023-10-07 16:52:15 -0400 |
---|---|---|
committer | sigsegv7 <ian@vegaa.systems> | 2023-10-07 16:52:15 -0400 |
commit | 32dbfb1ae399904c9fadc5b7fff232fcbc139add (patch) | |
tree | 8f3b1063fc0a1e6d91e2e07731ac5c42407a43b3 /sys/include | |
parent | 75ce5c6864b5b9b7a060d813d6d4c9f27e8ffabd (diff) |
kernel: vm: Add pageframe allocation
This commit introduces pageframe allocation logic to the
Vega virtual memory subsystem.
Signed-off-by: sigsegv7 <ian@vegaa.systems>
Diffstat (limited to 'sys/include')
-rw-r--r-- | sys/include/vm/vm.h | 15 | ||||
-rw-r--r-- | sys/include/vm/vm_physseg.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sys/include/vm/vm.h b/sys/include/vm/vm.h index 78038f0..baf7677 100644 --- a/sys/include/vm/vm.h +++ b/sys/include/vm/vm.h @@ -32,6 +32,8 @@ #include <sys/types.h> #include <sys/limine.h> +#include <sys/cdefs.h> +#include <vm/vm_page.h> extern volatile struct limine_hhdm_request g_hhdm_request; @@ -40,6 +42,19 @@ extern volatile struct limine_hhdm_request g_hhdm_request; #define PHYS_TO_VIRT(phys) (void *)((uintptr_t)phys + VM_HIGHER_HALF) #define VIRT_TO_PHYS(virt) ((uintptr_t)virt - VM_HIGHER_HALF) +/* + * Returns the machine's pagesize: + * + * XXX TODO: This needs to be moved to vmm_init.c + * while returning a non-constant value. + */ +static inline size_t +vm_get_page_size(void) +{ + return 4096; +} + void vm_init(void); +struct vas vm_new_vas(void); #endif /* !_VM_H_ */ diff --git a/sys/include/vm/vm_physseg.h b/sys/include/vm/vm_physseg.h index 5bf21db..5865a84 100644 --- a/sys/include/vm/vm_physseg.h +++ b/sys/include/vm/vm_physseg.h @@ -30,6 +30,10 @@ #ifndef _VM_VM_PHYSSEG_H_ #define _VM_VM_PHYSSEG_H_ +#include <sys/types.h> + void vm_physseg_init(void); +uintptr_t vm_alloc_pageframe(size_t count); +void vm_free_pageframe(uintptr_t base, size_t count); #endif /* !_VM_VM_PHYSSEG_H_ */ |