8 /* A free page owned by the page allocator. */
11 struct page *next; /* Next free page, or null at end of chain. */
14 static struct page *free_pages;
15 static uint8_t *uninit_start, *uninit_end;
18 palloc_init (uint8_t *start, uint8_t *end)
25 palloc_get (enum palloc_flags flags)
29 if (free_pages == NULL && uninit_start < uninit_end)
31 palloc_free (uninit_start);
32 uninit_start += PGSIZE;
38 free_pages = page->next;
40 memset (page, 0, PGSIZE);
44 if (flags & PAL_ASSERT)
45 panic ("palloc_get: out of pages");
52 palloc_free (void *page_)
54 struct page *page = page_;
55 ASSERT((uintptr_t) page % PGSIZE == 0);
57 memset (page, 0xcc, PGSIZE);
59 page->next = free_pages;