return (ERESTART);
return (VM_PAGER_REFAULT);
udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags)	struct uvm_faultinfo *ufi;	vaddr_t vaddr;	struct vm_page **pps;	int npages, centeridx, flags;	vm_fault_t fault_type;	vm_prot_t access_type;{	struct vm_map_entry *entry = ufi->entry;	struct uvm_object *uobj = entry->object.uvm_obj;	struct uvm_device *udv = (struct uvm_device *)uobj;	vaddr_t curr_va;	off_t curr_offset;	paddr_t paddr, mdpgno;	int lcv, retval;	dev_t device;	paddr_t (*mapfn) __P((dev_t, off_t, int));	vm_prot_t mapprot;	UVMHIST_FUNC("udv_fault"); UVMHIST_CALLED(maphist);	UVMHIST_LOG(maphist,"  flags=%d", flags,0,0,0);	/*	 * we do not allow device mappings to be mapped copy-on-write	 * so we kill any attempt to do so here.	 */	if (UVM_ET_ISCOPYONWRITE(entry)) {		UVMHIST_LOG(maphist, "<- failed -- COW entry (etype=0x%x)",		entry->etype, 0,0,0);		uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL);		return(EIO);	}	/*	 * get device map function.	 */	device = udv->u_device;	mapfn = cdevsw[major(device)].d_mmap;	/*	 * now we must determine the offset in udv to use and the VA to	 * use for pmap_enter.  note that we always use orig_map's pmap	 * for pmap_enter (even if we have a submap).   since virtual	 * addresses in a submap must match the main map, this is ok.	 */	/* udv offset = (offset from start of entry) + entry's offset */	curr_offset = entry->offset + (vaddr - entry->start);	/* pmap va = vaddr (virtual address of pps[0]) */	curr_va = vaddr;	/*	 * loop over the page range entering in as needed	 */	retval = 0;	for (lcv = 0 ; lcv < npages ; lcv++, curr_offset += PAGE_SIZE,	    curr_va += PAGE_SIZE) {		if ((flags & PGO_ALLPAGES) == 0 && lcv != centeridx)			continue;		if (pps[lcv] == PGO_DONTCARE)			continue;		mdpgno = (*mapfn)(device, curr_offset, access_type);		if (mdpgno == -1) {			retval = EIO;			break;		}		paddr = pmap_phys_address(mdpgno);		mapprot = ufi->entry->protection;		UVMHIST_LOG(maphist,		    "  MAPPING: device: pm=0x%x, va=0x%x, pa=0x%lx, at=%d",		    ufi->orig_map->pmap, curr_va, paddr, mapprot);		if (pmap_enter(ufi->orig_map->pmap, curr_va, paddr,		    mapprot, PMAP_CANFAIL | mapprot) != 0) {			/*			 * pmap_enter() didn't have the resource to			 * enter this mapping.  Unlock everything,			 * wait for the pagedaemon to free up some			 * pages, and then tell uvm_fault() to start			 * the fault again.			 *			 * XXX Needs some rethinking for the PGO_ALLPAGES			 * XXX case.			 */			uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap,			    uobj, NULL);			pmap_update(ufi->orig_map->pmap);	/* sync what we have so far */			uvm_wait("udv_fault");			return (ERESTART);		}	}	uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL);	pmap_update(ufi->orig_map->pmap);	return (retval);}