Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Apr 2002 08:27:16 -0700 (PDT)
From:      Thomas Moestl <tmm@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 9657 for review
Message-ID:  <200204131527.g3DFRGW14275@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9657

Change 9657 by tmm@tmm_sparc64 on 2002/04/13 08:26:41

	Use pmap_extract() again for now to avoid the same problem that
	was also present in the pipe implementation.
	While being there, turn some diagnostic panics into KASSERT()s.

Affected files ...

... //depot/projects/sparc64/sys/sparc64/sparc64/vm_machdep.c#50 edit

Differences ...

==== //depot/projects/sparc64/sys/sparc64/sparc64/vm_machdep.c#50 (text+ko) ====

@@ -336,20 +336,15 @@
 void
 vmapbuf(struct buf *bp)
 {
-	vm_map_t map;
-	vm_map_entry_t me;
-	vm_object_t obj;
-	vm_pindex_t midx;
-	vm_prot_t prot, rprot;
-	boolean_t wired;
+	vm_prot_t prot;
 	caddr_t addr, kva;
 	int pidx;
 	struct vm_page *m;
+	vm_offset_t phys;
 
 	GIANT_REQUIRED;
 
-	if ((bp->b_flags & B_PHYS) == 0)
-		panic("vmapbuf");
+	KASSERT((bp->b_flags & B_PHYS) != 0, ("vmapbuf: not a B_PHYS buffer"));
 
 	/*
 	 * Use the d-cache color of b->b_data (the user space region) for the
@@ -373,19 +368,16 @@
 		 */
 		vm_fault_quick((addr >= (caddr_t)bp->b_saveaddr) ?
 		    addr : bp->b_saveaddr, prot);
-		map = &curproc->p_vmspace->vm_map;
-		if (vm_map_lookup(&map, (vm_offset_t)addr, prot, &me, &obj,
-		     &midx, &rprot, &wired) != KERN_SUCCESS ||
-		    (m = vm_page_lookup(obj, midx)) == NULL)
-			panic("vmapbuf: page not present");
-		vm_map_lookup_done(map, me);
+		phys = pmap_extract(&curproc->p_vmspace->vm_pmap,
+		    (vm_offset_t)addr);
+		KASSERT(phys != 0, ("vmapbuf: page not present"));
+		m = PHYS_TO_VM_PAGE(phys);
 		vm_page_hold(m);
 		bp->b_pages[pidx] = m;
 		pmap_enter(kernel_pmap, (vm_offset_t)kva, m,
 		    VM_PROT_READ | VM_PROT_WRITE, TRUE);
 	}
-	if (pidx > btoc(MAXPHYS))
-		panic("vmapbuf: mapped more than MAXPHYS");
+	KASSERT(pidx <= btoc(MAXPHYS), ("vmapbuf: mapped more than MAXPHYS"));
 
 	bp->b_npages = pidx;
 }
@@ -403,8 +395,8 @@
 
 	GIANT_REQUIRED;
 
-	if ((bp->b_flags & B_PHYS) == 0)
-		panic("vunmapbuf");
+	KASSERT((bp->b_flags & B_PHYS) != 0,
+	    ("vunmapbuf: not a B_PHYS buffer"));
 
 	npages = bp->b_npages;
 	kva = trunc_page((vm_offset_t)bp->b_data);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204131527.g3DFRGW14275>