if (uvm_map(pager_map, &kva, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_FLAG_NOMERGE) != 0) {
if (uvm_map(pager_map, &kva, size, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_FLAG_NOMERGE) != KERN_SUCCESS) {
uvm_pagermapin(pps, npages, flags)	struct vm_page **pps;	int npages;	int flags;{	vsize_t size;	vaddr_t kva;	vaddr_t cva;	struct vm_page *pp;	vm_prot_t prot;	UVMHIST_FUNC("uvm_pagermapin"); UVMHIST_CALLED(maphist);	UVMHIST_LOG(maphist,"(pps=0x%x, npages=%d)", pps, npages,0,0);	/*	 * compute protection.  outgoing I/O only needs read	 * access to the page, whereas incoming needs read/write.	 */	prot = VM_PROT_READ;	if (flags & UVMPAGER_MAPIN_READ)		prot |= VM_PROT_WRITE;ReStart:	size = npages << PAGE_SHIFT;	kva = 0;			/* let system choose VA */	if (uvm_map(pager_map, &kva, size, NULL,	    UVM_UNKNOWN_OFFSET, 0, UVM_FLAG_NOMERGE) != 0) {		if (curproc == uvm.pagedaemon_proc) {			simple_lock(&pager_map_wanted_lock);			if (emerginuse) {				UVM_UNLOCK_AND_WAIT(&emergva,				    &pager_map_wanted_lock, FALSE,				    "emergva", 0);				goto ReStart;			}			emerginuse = TRUE;			simple_unlock(&pager_map_wanted_lock);			kva = emergva;			KASSERT(npages <= MAXBSIZE >> PAGE_SHIFT);			goto enter;		}		if ((flags & UVMPAGER_MAPIN_WAITOK) == 0) {			UVMHIST_LOG(maphist,"<- NOWAIT failed", 0,0,0,0);			return(0);		}		simple_lock(&pager_map_wanted_lock);		pager_map_wanted = TRUE;		UVMHIST_LOG(maphist, "  SLEEPING on pager_map",0,0,0,0);		UVM_UNLOCK_AND_WAIT(pager_map, &pager_map_wanted_lock, FALSE,		    "pager_map", 0);		goto ReStart;	}enter:	/* got it */	for (cva = kva ; size != 0 ; size -= PAGE_SIZE, cva += PAGE_SIZE) {		pp = *pps++;		KASSERT(pp);		KASSERT(pp->flags & PG_BUSY);		pmap_enter(vm_map_pmap(pager_map), cva, VM_PAGE_TO_PHYS(pp),		    prot, PMAP_WIRED | ((pp->flags & PG_FAKE) ? prot :					VM_PROT_READ));	}	pmap_update(vm_map_pmap(pager_map));	UVMHIST_LOG(maphist, "<- done (KVA=0x%x)", kva,0,0,0);	return(kva);}