PERFORCE change 31670 for review

Peter Wemm peter at FreeBSD.org
Thu May 22 20:27:10 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=31670

Change 31670 by peter at peter_hammer on 2003/05/22 20:26:20

	re-enable pmap_copy().  Thats all of the stubbed out functions
	repaired.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/pmap.c#11 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#11 (text+ko) ====

@@ -701,6 +701,16 @@
 }
 
 /*
+ * Are we current address space or kernel?
+ */
+static __inline int
+pmap_is_current(pmap_t pmap)
+{
+	return (pmap == kernel_pmap ||
+	    (pmap->pm_pml4[PML4PML4I] & PG_FRAME) == (PML4pml4e[0] & PG_FRAME));
+}
+
+/*
  *	Routine:	pmap_extract
  *	Function:
  *		Extract the physical page address associated
@@ -2518,7 +2528,6 @@
 pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
 	  vm_offset_t src_addr)
 {
-#if 0
 	vm_offset_t addr;
 	vm_offset_t end_addr = src_addr + len;
 	vm_offset_t pdnxt;
@@ -2533,7 +2542,7 @@
 	for (addr = src_addr; addr < end_addr; addr = pdnxt) {
 		pt_entry_t *src_pte, *dst_pte;
 		vm_page_t dstmpte, srcmpte;
-		pd_entry_t srcptepaddr;
+		pd_entry_t srcptepaddr, *pde;
 		unsigned ptepindex;
 
 		if (addr >= UPT_MIN_ADDRESS)
@@ -2551,13 +2560,25 @@
 		pdnxt = (addr + NBPDR) & ~PDRMASK;
 		ptepindex = pmap_pde_pindex(addr);
 
-		srcptepaddr = src_pmap->pm_pdir[ptepindex];
+		pde = pmap_pde(src_pmap, addr);
+		if (pde)
+			srcptepaddr = *pde;
+		else
+			continue;
 		if (srcptepaddr == 0)
 			continue;
 			
 		if (srcptepaddr & PG_PS) {
-			if (dst_pmap->pm_pdir[ptepindex] == 0) {
-				dst_pmap->pm_pdir[ptepindex] = srcptepaddr;
+			pde = pmap_pde(dst_pmap, addr);
+			if (pde == 0) {
+				/*
+				 * XXX should do an allocpte here to
+				 * instantiate the pde
+				 */
+				continue;
+			}
+			if (*pde == 0) {
+				*pde = srcptepaddr;
 				dst_pmap->pm_stats.resident_count +=
 				    NBPDR / PAGE_SIZE;
 			}
@@ -2610,7 +2631,6 @@
 			src_pte++;
 		}
 	}
-#endif
 }	
 
 /*


More information about the p4-projects mailing list