FreeBSD/sys/i386/i386/pmap.c
/*
 * this routine is called if the page table page is not
 * mapped correctly.
 */
this routine is called if the page table page is not
mapped correctly.
this routine is called if the page table page is not mapped correctly .
static vm_page_t
_pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags)
{
	vm_paddr_t ptepa;
	vm_page_t m;
	if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ |
	    VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) {
		if ((flags & PMAP_ENTER_NOSLEEP) == 0) {
			PMAP_UNLOCK(pmap);
			rw_wunlock(&pvh_global_lock);
			VM_WAIT;
			rw_wlock(&pvh_global_lock);
			PMAP_LOCK(pmap);
		}
		return (NULL);
	}
	if ((m->flags & PG_ZERO) == 0)
		pmap_zero_page(m);
	pmap->pm_stats.resident_count++;
	ptepa = VM_PAGE_TO_PHYS(m);
	pmap->pm_pdir[ptepindex] =
		(pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M);
	return (m);
}
static vm_page_t _pmap_allocpte ( pmap_t pmap , u_int ptepindex , u_int flags ) { vm_paddr_t ptepa ; vm_page_t m ; if ( ( m = vm_page_alloc ( NULL , ptepindex , VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO ) ) == NULL ) { if ( ( flags & PMAP_ENTER_NOSLEEP ) == 0 ) { PMAP_UNLOCK ( pmap ) ; rw_wunlock ( & pvh_global_lock ) ; VM_WAIT ; rw_wlock ( & pvh_global_lock ) ; PMAP_LOCK ( pmap ) ; } return ( NULL ) ; } if ( ( m -> flags & PG_ZERO ) == 0 ) pmap_zero_page ( m ) ; pmap -> pm_stats . resident_count ++ ; ptepa = VM_PAGE_TO_PHYS ( m ) ; pmap -> pm_pdir [ ptepindex ] = ( pd_entry_t ) ( ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M ) ; return ( m ) ; }
this routine is called if the page table page is not
 mapped correctly.
this routine is called if the page table page is not mapped correctly .
/*
	 * Allocate a page table page.
	 */ /*
		 * Indicate the need to retry.  While waiting, the page table
		 * page may have been allocated.
		 */ /*
	 * Map the pagetable page into the process address space, if
	 * it isn't already there.
	 */