size_t ram_pages;
/* Page directory with kernel mappings only. */
-uint32_t *base_page_dir;
+uint32_t *init_page_dir;
#ifdef FILESYS
/* -f: Format the file system? */
/* -r: Reboot after kernel tasks complete? */
static bool reboot_when_done;
+/* -ul: Maximum number of pages to put into palloc's user pool. */
+static size_t user_page_limit = SIZE_MAX;
+
static void ram_init (void);
static void paging_init (void);
printf ("Pintos booting with %'zu kB RAM...\n", ram_pages * PGSIZE / 1024);
/* Initialize memory system. */
- palloc_init ();
+ palloc_init (user_page_limit);
malloc_init ();
paging_init ();
/* Populates the base page directory and page table with the
kernel virtual mapping, and then sets up the CPU to use the
- new page directory. Points base_page_dir to the page
+ new page directory. Points init_page_dir to the page
directory it creates.
At the time this function is called, the active page table
size_t page;
extern char _start, _end_kernel_text;
- pd = base_page_dir = palloc_get_page (PAL_ASSERT | PAL_ZERO);
+ pd = init_page_dir = palloc_get_page (PAL_ASSERT | PAL_ZERO);
pt = NULL;
for (page = 0; page < ram_pages; page++)
{
new page tables immediately. See [IA32-v2a] "MOV--Move
to/from Control Registers" and [IA32-v3a] 3.7.5 "Base Address
of the Page Directory". */
- asm volatile ("movl %0, %%cr3" : : "r" (vtop (base_page_dir)));
+ asm volatile ("movl %0, %%cr3" : : "r" (vtop (init_page_dir)));
}
/* Breaks the kernel command line into words and returns them as