summaryrefslogtreecommitdiffstats
path: root/src/threads/palloc.h
diff options
context:
space:
mode:
authorFelipe Boeira <felipe.boeira@liu.se>2019-01-08 18:39:03 +0100
committerFelipe Boeira <felipe.boeira@liu.se>2019-01-08 18:39:03 +0100
commitd4522b8e9854178473adcea0fbb84f23f6e744bd (patch)
treefbcf620617c5023154eba3f965b3a982daa64a47 /src/threads/palloc.h
downloadpintos-d4522b8e9854178473adcea0fbb84f23f6e744bd.tar.gz
Initial commit
Diffstat (limited to 'src/threads/palloc.h')
-rw-r--r--src/threads/palloc.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/threads/palloc.h b/src/threads/palloc.h
new file mode 100644
index 0000000..2d41cf6
--- /dev/null
+++ b/src/threads/palloc.h
@@ -0,0 +1,23 @@
+#ifndef THREADS_PALLOC_H
+#define THREADS_PALLOC_H
+
+#include <stddef.h>
+
+/* How to allocate pages. */
+enum palloc_flags
+ {
+ PAL_ASSERT = 001, /* Panic on failure. */
+ PAL_ZERO = 002, /* Zero page contents. */
+ PAL_USER = 004 /* User page. */
+ };
+
+/* Maximum number of pages to put in user pool. */
+extern size_t user_page_limit;
+
+void palloc_init (void);
+void *palloc_get_page (enum palloc_flags);
+void *palloc_get_multiple (enum palloc_flags, size_t page_cnt);
+void palloc_free_page (void *);
+void palloc_free_multiple (void *, size_t page_cnt);
+
+#endif /* threads/palloc.h */