From 516e920cd96730cf470357aa250636d9d42a849c Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 3 Apr 2025 16:53:51 -0400 Subject: memory allocator/pager, plus other stuff --- kernel/memory/physalloc.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 kernel/memory/physalloc.h (limited to 'kernel/memory/physalloc.h') diff --git a/kernel/memory/physalloc.h b/kernel/memory/physalloc.h new file mode 100644 index 0000000..7afe998 --- /dev/null +++ b/kernel/memory/physalloc.h @@ -0,0 +1,44 @@ +/** + * @file physalloc.h + * + * @author Freya Murphy + * + * Physical page allocator functions + */ + +#ifndef PHYSALLOC_H_ +#define PHYSALLOC_H_ + +#include + +/** + * Initalize the physical page allocator + */ +void physalloc_init(struct memory_map *map); + +/** + * Allocates a single physical page in memory + * @preturns the physical address of the page + */ +void *alloc_phys_page(void); + +/** + * Allocates count physical pages in memory + * @returns the physical address of the first page + */ +void *alloc_phys_pages(int count); + +/** +* Frees a single physical page in memory + * @param ptr - the physical address of the page + */ +void free_phys_page(void *ptr); + +/** + * Frees count physical pages in memory + * @param ptr - the physical address of the first page + * @param count - the number of pages in the list + */ +void free_phys_pages(void *ptr, int count); + +#endif /* physalloc.h */ -- cgit v1.2.3-freya