rem: gCheck = true;
context: int vm_page_init(kernel_args *ka){	unsigned int i;	dprintf("vm_page_init: entry\n");	page_lock = 0;	// initialize queues	page_free_queue.head = NULL;	page_free_queue.tail = NULL;	page_free_queue.count = 0;	page_clear_queue.head = NULL;	page_clear_queue.tail = NULL;	page_clear_queue.count = 0;	page_modified_queue.head = NULL;	page_modified_queue.tail = NULL;	page_modified_queue.count = 0;	page_active_queue.head = NULL;	page_active_queue.tail = NULL;	page_active_queue.count = 0;	// calculate the size of memory by looking at the phys_mem_range array	{		unsigned int last_phys_page = 0;		physical_page_offset = ka->phys_mem_range[0].start / PAGE_SIZE;		for(i=0; i<ka->num_phys_mem_ranges; i++) {			last_phys_page = (ka->phys_mem_range[i].start + ka->phys_mem_range[i].size) / PAGE_SIZE - 1;		}		dprintf("first phys page = 0x%lx, last 0x%x\n", physical_page_offset, last_phys_page);		num_pages = last_phys_page - physical_page_offset;	}	// map in the new free page table	all_pages = (vm_page *)vm_alloc_from_ka_struct(ka, num_pages * sizeof(vm_page), LOCK_KERNEL|LOCK_RW);	dprintf("vm_init: putting free_page_table @ %p, # ents %d (size 0x%x)\n",		all_pages, num_pages, (unsigned int)(num_pages * sizeof(vm_page)));	// initialize the free page table	for(i=0; i < num_pages - 1; i++) {		all_pages[i].ppn = physical_page_offset + i;		all_pages[i].type = PAGE_TYPE_PHYSICAL;		all_pages[i].state = PAGE_STATE_FREE;		all_pages[i].ref_count = 0;		enqueue_page(&page_free_queue, &all_pages[i]);	}	dprintf("initialized table\n");	// mark some of the page ranges inuse	for(i = 0; i < ka->num_phys_alloc_ranges; i++) {		vm_mark_page_range_inuse(ka->phys_alloc_range[i].start / PAGE_SIZE,			ka->phys_alloc_range[i].size / PAGE_SIZE);	}	gCheck = true;	// set the global max_commit variable	vm_increase_max_commit(num_pages*PAGE_SIZE);	dprintf("vm_page_init: exit\n");	return 0;}