Date: Wed, 11 Apr 2007 19:09:41 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 117915 for review Message-ID: <200704111909.l3BJ9fUu043750@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=117915 Change 117915 by gonzo@gonzo_jeeves on 2007/04/11 19:08:48 o Obsolete pmap_page_protect in favour of pmap_remove_write o Dump physical memory chunks in verbose mode o Get rid of PG_BUSY flug o Set PG_WRITABLE in pmap_enter Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/pmap.c#27 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/pmap.c#27 (text+ko) ==== @@ -315,6 +315,22 @@ } } + if (bootverbose) { + int indx; + + printf("Physical memory chunk(s):\n"); + for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { + vm_paddr_t size; + + size = phys_avail[indx + 1] - phys_avail[indx]; + printf("%#08jx - %#08jx, %ju bytes (%ju pages)\n", + (uintmax_t)phys_avail[indx], + (uintmax_t)phys_avail[indx + 1] - 1, + (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); + } + } + + /* * Steal the message buffer from the beginning of memory. */ @@ -766,7 +782,6 @@ VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED | VM_ALLOC_ZERO); vm_page_lock_queues(); - vm_page_flag_clear(lev1pg, PG_BUSY); lev1pg->valid = VM_PAGE_BITS_ALL; vm_page_unlock_queues(); VM_OBJECT_UNLOCK(pmap->pm_pteobj); @@ -1221,10 +1236,7 @@ if(!mem) panic("pmap_enter: failed to get a page for lev2 segment"); - vm_page_lock_queues(); - vm_page_flag_clear(mem, PG_BUSY); mem->valid = VM_PAGE_BITS_ALL; - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(pmap->pm_pteobj); pmap_segmap(pmap, va) = @@ -1304,6 +1316,13 @@ if (wired) pmap->pm_stats.wired_count++; + if(prot & VM_PROT_WRITE) + { + vm_page_lock_queues(); + vm_page_flag_set(m, PG_WRITEABLE); + vm_page_unlock_queues(); + } + wired = wired ? PG_W : 0; global = pmap == kernel_pmap ? PG_G : 0; p = pte_prot(pmap, prot); @@ -1576,42 +1595,36 @@ } /* - * pmap_page_protect: - * - * Lower the permission for all mappings to a given page. + * Clear the write and modified bits in each of the given page's mappings. */ void -pmap_page_protect(vm_page_t m, vm_prot_t prot) +pmap_remove_write(vm_page_t m) { pv_entry_t pv, npv; vm_offset_t va; pt_entry_t *pte; - /* - * Consider only readonly case + if((m->flags & PG_WRITEABLE) == 0) + return; + + /* + * Loop over all current mappings + * setting/clearing as appropos. */ - if ((prot & VM_PROT_WRITE) == 0) { - if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) { - /* - * Loop over all current mappings - * setting/clearing as appropos. - */ - for(pv = TAILQ_FIRST(&m->md.pv_list); pv; pv = npv) { - npv = TAILQ_NEXT(pv, pv_plist); - pte = pmap_pte(pv->pv_pmap, pv->pv_va); - - if ((pte == NULL) || !pte_valid(pte)) - panic("page on pm_pvlist has no pte\n"); + for(pv = TAILQ_FIRST(&m->md.pv_list); pv; pv = npv) + { + npv = TAILQ_NEXT(pv, pv_plist); + pte = pmap_pte(pv->pv_pmap, pv->pv_va); + + if ((pte == NULL) || !pte_valid(pte)) + panic("page on pm_pvlist has no pte\n"); - va = pv->pv_va; - pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE, - prot); + va = pv->pv_va; + pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE, + VM_PROT_READ | VM_PROT_EXECUTE); + } - } - } else { - pmap_remove_all(m); - } - } + vm_page_flag_clear(m, PG_WRITEABLE); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704111909.l3BJ9fUu043750>