usb.patch, with conflicts and some warnings fixed
[pintos-anon] / src / threads / palloc.h
index 9bd076f4214b3f493fcbdfee955b758a5b20a221..adfb3ca67e7ecb0cd7e87c631b85f1c8023c44ff 100644 (file)
@@ -1,20 +1,23 @@
-#ifndef HEADER_PALLOC_H
-#define HEADER_PALLOC_H 1
+#ifndef THREADS_PALLOC_H
+#define THREADS_PALLOC_H
 
-/* Page allocator.  Hands out memory in page-size chunks.
-   See malloc.h for an allocator that hands out smaller
-   chunks. */
-
-#include <stdint.h>
+#include <stddef.h>
 
+/* How to allocate pages. */
 enum palloc_flags
   {
-    PAL_ASSERT = 001,           /* Panic on failure. */
-    PAL_ZERO = 002              /* Zero page contents. */
+    PAL_ASSERT = 1 << 0,   /* Panic on failure. */
+    PAL_ZERO = 1 << 1,     /* Zero page contents. */
+    PAL_USER = 1 << 2,     /* User page. */
+    PAL_NOCACHE = 1 << 3   /* Disable memory caching for page. */
   };
 
-void palloc_init (uint8_t *start, uint8_t *end);
-void *palloc_get (enum palloc_flags);
-void palloc_free (void *);
+extern void *zero_page;
+
+void palloc_init (size_t user_page_limit);
+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 /* palloc.h */
+#endif /* threads/palloc.h */