PERFORCE change 135696 for review
Kip Macy
kmacy at FreeBSD.org
Tue Feb 19 02:14:56 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=135696
Change 135696 by kmacy at pandemonium:kmacy:xen31 on 2008/02/19 02:14:09
don't thread pv entry free list through the page tables
don't ignore mapping in pmap_enter if valid bit isn't set
Affected files ...
.. //depot/projects/xen31/sys/i386/xen/pmap.c#37 edit
Differences ...
==== //depot/projects/xen31/sys/i386/xen/pmap.c#37 (text+ko) ====
@@ -612,43 +612,48 @@
* - Assumes a vm_offset_t will fit in a pte (true for i386).
* Because PG_V is never set, there can be no mappings to invalidate.
*/
+static int ptelist_count = 0;
static vm_offset_t
pmap_ptelist_alloc(vm_offset_t *head)
{
- pt_entry_t *pte;
vm_offset_t va;
-
- va = *head;
- if (va == 0)
- return (va); /* Out of memory */
- pte = vtopte(va);
- *head = *pte;
- if (*head & PG_V)
- panic("pmap_ptelist_alloc: va with PG_V set!");
- *pte = 0;
+ vm_offset_t *phead = (vm_offset_t *)*head;
+
+ if (ptelist_count == 0) {
+ printf("out of memory!!!!!!\n");
+ return (0); /* Out of memory */
+ }
+ ptelist_count--;
+ va = phead[ptelist_count];
return (va);
}
static void
pmap_ptelist_free(vm_offset_t *head, vm_offset_t va)
{
- pt_entry_t *pte;
+ vm_offset_t *phead = (vm_offset_t *)*head;
- if (va & PG_V)
- panic("pmap_ptelist_free: freeing va with PG_V set!");
- pte = vtopte(va);
- *pte = *head; /* virtual! PG_V is 0 though */
- *head = va;
+ phead[ptelist_count++] = va;
}
static void
pmap_ptelist_init(vm_offset_t *head, void *base, int npages)
{
- int i;
+ int i, nstackpages;
vm_offset_t va;
+ vm_page_t m;
+
+ nstackpages = (npages + PAGE_SIZE/sizeof(vm_offset_t) - 1)/ (PAGE_SIZE/sizeof(vm_offset_t));
+ for (i = 0; i < nstackpages; i++) {
+ va = (vm_offset_t)base + i * PAGE_SIZE;
+ m = vm_page_alloc(NULL, i,
+ VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED |
+ VM_ALLOC_ZERO);
+ pmap_qenter(va, &m, 1);
+ }
- *head = 0;
- for (i = npages - 1; i >= 0; i--) {
+ *head = (vm_offset_t)base;
+ for (i = npages - 1; i >= nstackpages; i--) {
va = (vm_offset_t)base + i * PAGE_SIZE;
pmap_ptelist_free(head, va);
}
@@ -2595,12 +2600,15 @@
pa = VM_PAGE_TO_PHYS(m);
om = NULL;
opa = origpte = 0;
+
+#if 0
+ KASSERT((*pte & PG_V) || (*pte == 0), ("address set but not valid pte=%p *pte=0x%016jx",
+ pte, *pte));
+#endif
+ origpte = PT_GET(pte);
+ opa = origpte & PG_FRAME;
+
- if (*pte & PG_V) {
- origpte = PT_GET(pte);
- opa = origpte & PG_FRAME;
- }
-
/*
* Mapping has not changed, must be protection or wiring change.
*/
@@ -2695,7 +2703,7 @@
* to update the pte.
*/
if ((origpte & ~(PG_M|PG_A)) != newpte) {
- if (origpte & PG_V) {
+ if (origpte) {
invlva = FALSE;
origpte = pte_load_store(pte, newpte | PG_A);
if (origpte & PG_A) {
More information about the p4-projects
mailing list