PERFORCE change 132226 for review

Kip Macy kmacy at FreeBSD.org
Mon Dec 31 22:32:00 PST 2007


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

Change 132226 by kmacy at pandemonium:kmacy:xen31 on 2008/01/01 06:31:39

	make sf_buf work on xen

Affected files ...

.. //depot/projects/xen31/sys/i386/i386/vm_machdep.c#3 edit

Differences ...

==== //depot/projects/xen31/sys/i386/i386/vm_machdep.c#3 (text+ko) ====

@@ -265,7 +265,7 @@
 
 	/* Setup to release spin count in fork_exit(). */
 	td2->td_md.md_spinlock_count = 1;
-	td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I;
+	td2->td_md.md_saved_flags = PSL_USER;
 
 	/*
 	 * Now, cpu_switch() can schedule the new process.
@@ -446,7 +446,7 @@
 
 	/* Setup to release spin count in fork_exit(). */
 	td->td_md.md_spinlock_count = 1;
-	td->td_md.md_saved_flags = PSL_KERNEL | PSL_I;
+	td->td_md.md_saved_flags = PSL_USER;
 }
 
 /*
@@ -772,8 +772,11 @@
 	 */
 	ptep = vtopte(sf->kva);
 	opte = *ptep;
+#ifdef XEN
+	PT_SET_MA(sf->kva, xpmap_ptom(VM_PAGE_TO_PHYS(m)) | pgeflag | PG_RW | PG_V);
+#else	
 	*ptep = VM_PAGE_TO_PHYS(m) | pgeflag | PG_RW | PG_V;
-
+#endif
 	/*
 	 * Avoid unnecessary TLB invalidations: If the sf_buf's old
 	 * virtual-to-physical mapping was not used, then any processor
@@ -822,6 +825,14 @@
 	if (sf->ref_count == 0) {
 		TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry);
 		nsfbufsused--;
+#ifdef XEN
+		/*
+		 * Xen doesn't like having dangling R/W mappings
+		 */
+                pmap_qremove(sf->kva, 1);
+                sf->m = NULL;
+                LIST_REMOVE(sf, list_entry);
+#endif
 		if (sf_buf_alloc_want > 0)
 			wakeup_one(&sf_buf_freelist);
 	}


More information about the p4-projects mailing list