aboutsummaryrefslogtreecommitdiffstats
path: root/src/threads/palloc.h
diff options
context:
space:
mode:
authorklaar36 <klas.arvidsson@liu.se>2015-03-20 17:30:24 +0100
committerklaar36 <klas.arvidsson@liu.se>2015-03-20 17:30:24 +0100
commite7bc50ca8ffcaa6ed68ebd2315f78b0f5a7d10ad (patch)
tree4de97af7207676b69cb6a9aba8cb443cc134855d /src/threads/palloc.h
parentb0418a24e709f0632d2ede5b0f327c422931939b (diff)
downloadpintos-rs-e7bc50ca8ffcaa6ed68ebd2315f78b0f5a7d10ad.tar.gz
Initial Pintos
Diffstat (limited to 'src/threads/palloc.h')
-rw-r--r--src/threads/palloc.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/threads/palloc.h b/src/threads/palloc.h
new file mode 100644
index 0000000..c9a4281
--- /dev/null
+++ b/src/threads/palloc.h
@@ -0,0 +1,24 @@
+#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;
+extern size_t free_page_limit; // klaar@ida
+
+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 */