diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-03 16:53:51 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-03 16:54:42 -0400 |
commit | 516e920cd96730cf470357aa250636d9d42a849c (patch) | |
tree | 16e177ffc8bfed0a86abe46455bcbb37c2dbed6d /kernel/memory/physalloc.h | |
parent | boot headers moved (diff) | |
download | comus-516e920cd96730cf470357aa250636d9d42a849c.tar.gz comus-516e920cd96730cf470357aa250636d9d42a849c.tar.bz2 comus-516e920cd96730cf470357aa250636d9d42a849c.zip |
memory allocator/pager, plus other stuff
Diffstat (limited to 'kernel/memory/physalloc.h')
-rw-r--r-- | kernel/memory/physalloc.h | 44 |
1 files changed, 44 insertions, 0 deletions
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 <freya@freyacat.org> + * + * Physical page allocator functions + */ + +#ifndef PHYSALLOC_H_ +#define PHYSALLOC_H_ + +#include <comus/memory.h> + +/** + * 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 */ |