|
CS350 COS
COS
|
#include <stdbool.h>#include <stdint.h>#include <stdarg.h>#include <string.h>#include <sys/cdefs.h>#include <sys/kassert.h>#include <sys/kdebug.h>#include <sys/kmem.h>#include <sys/queue.h>#include <sys/spinlock.h>#include <machine/amd64.h>#include <machine/pmap.h>Go to the source code of this file.
Data Structures | |
| struct | FreePage |
| struct | PageInfo |
Macros | |
| #define | FREEPAGE_MAGIC_FREE 0x4652454550414745ULL |
| #define | FREEPAGE_MAGIC_INUSE 0x414c4c4f43415445ULL |
Typedefs | |
| typedef struct FreePage | FreePage |
| typedef struct PageInfo | PageInfo |
Functions | |
| LIST_HEAD (FreeListHead, FreePage) | |
| void | PAlloc_LateInit () |
| void | PAlloc_AddRegion (uintptr_t start, uintptr_t len) |
| static PageInfo * | PAllocGetInfo (void *pg) |
| void * | PAlloc_AllocPage () |
| static void | PAllocFreePage (void *region) |
| void | PAlloc_Retain (void *pg) |
| void | PAlloc_Release (void *pg) |
| static void | Debug_PAllocStats (int argc, const char *argv[]) |
| REGISTER_DBGCMD (pallocstats, "Page allocator statistics", Debug_PAllocStats) | |
| static void | Debug_PAllocDump (int argc, const char *argv[]) |
| REGISTER_DBGCMD (pallocdump, "Dump page allocator's free list", Debug_PAllocDump) | |
Variables | |
| Spinlock | pallocLock |
| uint64_t | totalPages |
| uint64_t | freePages |
| XMem * | pageInfoXMem |
| PageInfo * | pageInfoTable |
| uint64_t | pageInfoLength |
| struct FreePage |
| struct PageInfo |
|
static |
Definition at line 288 of file palloc.c.
|
static |
| LIST_HEAD | ( | FreeListHead | , |
| FreePage | |||
| ) |
Definition at line 45 of file palloc.c.
PAlloc_AddRegion –
Add a physical memory region to the page allocator.
Definition at line 92 of file palloc.c.
| void * PAlloc_AllocPage | ( | ) |
PAlloc_AllocPage –
Allocate a physical page and return the page's address in the Kernel's ident mapped memory region.
| NULL | if no memory is available. |
Definition at line 188 of file palloc.c.
| void PAlloc_LateInit | ( | ) |
PAlloc_LateInit –
The late init call is made after the page tables are initialized using a small boot memory region (2nd 16MBs). This is where initialize the XMem region that represents the PageInfo array, and map memory into it.
Definition at line 71 of file palloc.c.
| void PAlloc_Release | ( | void * | pg | ) |
PAlloc_Release –
Deccrement the reference count for a physical page. If the reference count is zero the page will be freed.
Definition at line 265 of file palloc.c.
| void PAlloc_Retain | ( | void * | pg | ) |
|
static |
PAllocFreePage –
Free a page.
Definition at line 221 of file palloc.c.
|
inlinestatic |
| REGISTER_DBGCMD | ( | pallocdump | , |
| "Dump page allocator's free list" | , | ||
| Debug_PAllocDump | |||
| ) |
| REGISTER_DBGCMD | ( | pallocstats | , |
| "Page allocator statistics" | , | ||
| Debug_PAllocStats | |||
| ) |