PKUOS - Pintos
Pintos source browser for PKU Operating System course
palloc.h
Go to the documentation of this file.
1#ifndef THREADS_PALLOC_H
2#define THREADS_PALLOC_H
3
4#include <stddef.h>
5
6/** How to allocate pages. */
8 {
9 PAL_ASSERT = 001, /**< Panic on failure. */
10 PAL_ZERO = 002, /**< Zero page contents. */
11 PAL_USER = 004 /**< User page. */
12 };
13
14void palloc_init (size_t user_page_limit);
15void *palloc_get_page (enum palloc_flags);
16void *palloc_get_multiple (enum palloc_flags, size_t page_cnt);
17void palloc_free_page (void *);
18void palloc_free_multiple (void *, size_t page_cnt);
19
20#endif /**< threads/palloc.h */
static size_t user_page_limit
-ul: Maximum number of pages to put into palloc's user pool.
Definition: init.c:58
palloc_flags
How to allocate pages.
Definition: palloc.h:8
@ PAL_ZERO
Zero page contents.
Definition: palloc.h:10
@ PAL_USER
User page.
Definition: palloc.h:11
@ PAL_ASSERT
Panic on failure.
Definition: palloc.h:9
void * palloc_get_page(enum palloc_flags)
Obtains a single free page and returns its kernel virtual address.
Definition: palloc.c:111
void palloc_free_multiple(void *, size_t page_cnt)
threads/palloc.h
Definition: palloc.c:118
void * palloc_get_multiple(enum palloc_flags, size_t page_cnt)
Obtains and returns a group of PAGE_CNT contiguous free pages.
Definition: palloc.c:71
void palloc_free_page(void *)
Frees the page at PAGE.
Definition: palloc.c:146
void palloc_init(size_t user_page_limit)
Initializes the page allocator.
Definition: palloc.c:46