summaryrefslogtreecommitdiff
path: root/include/sys/physalloc.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-02-04 14:19:54 -0500
committerFreya Murphy <freya@freyacat.org>2024-02-04 14:19:54 -0500
commit1b09896afcf562d199d4df8d671601bba2b1f081 (patch)
treeb4ee4ae8e6e1ff5c5b27fe97509752b17fae330b /include/sys/physalloc.h
parentfix acpi on uefi, kprint fixes (diff)
downloadcorn-1b09896afcf562d199d4df8d671601bba2b1f081.tar.gz
corn-1b09896afcf562d199d4df8d671601bba2b1f081.tar.bz2
corn-1b09896afcf562d199d4df8d671601bba2b1f081.zip
refactor archHEADmain
Diffstat (limited to 'include/sys/physalloc.h')
-rw-r--r--include/sys/physalloc.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sys/physalloc.h b/include/sys/physalloc.h
new file mode 100644
index 0000000..6837972
--- /dev/null
+++ b/include/sys/physalloc.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#ifndef MEMORY_INTERNAL
+ #error "Do not include headers from <sys/physalloc.h>, only use <memory.h>"
+#endif
+
+/**
+ * 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);