diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-11 21:30:58 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-11 21:33:15 -0400 |
commit | ce379e9444670e88b807b5e260e1623be1304227 (patch) | |
tree | 572265b98545279d33fc83cd6322604495c316be | |
parent | 6f7902208064d7c8c1f3cd559be36a90866005be (diff) |
kern: vm: Add BYTES_TO_PAGES helper macro
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | src/sys/include/vm/vm.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sys/include/vm/vm.h b/src/sys/include/vm/vm.h index f5f7b16..59cd4bc 100644 --- a/src/sys/include/vm/vm.h +++ b/src/sys/include/vm/vm.h @@ -32,12 +32,15 @@ #include <sys/types.h> #include <sys/queue.h> +#include <sys/param.h> #include <sys/bootvars.h> #define VM_HIGHER_HALF (get_kernel_base()) #define PHYS_TO_VIRT(PHYS) (void *)((uintptr_t)(PHYS) + VM_HIGHER_HALF) #define VIRT_TO_PHYS(VIRT) ((uintptr_t)(VIRT) - VM_HIGHER_HALF) + #define DEFAULT_PAGESIZE 4096 +#define BYTES_TO_PAGES(N) (ALIGN_UP((N), DEFAULT_PAGESIZE) / DEFAULT_PAGESIZE) /* Physical/virtual address */ typedef uintptr_t vaddr_t; |