Redo how the pte_*wire* inlines work. Now pmap.c makes no assuming about

what type pt_entry_t.  It can now be a scalar or a union/struct.
This commit is contained in:
matt 2011-06-23 20:46:15 +00:00
parent 6398a253c4
commit c0b4eeb495
2 changed files with 15 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pte.h,v 1.4 2011/06/23 01:27:20 matt Exp $ */
/* $NetBSD: pte.h,v 1.5 2011/06/23 20:46:15 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@ -162,9 +162,15 @@ pte_cached_change(pt_entry_t pt_entry, bool cached)
}
static inline pt_entry_t
pte_wired_entry(void)
pte_wire_entry(pt_entry_t pt_entry)
{
return PTE_WIRED;
return pt_entry | PTE_WIRED;
}
static inline pt_entry_t
pte_unwire_entry(pt_entry_t pt_entry)
{
return pt_entry & ~PTE_WIRED;
}
static inline pt_entry_t
@ -245,6 +251,7 @@ pte_make_kenter_pa(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,
{
pt_entry_t pt_entry = (pt_entry_t) pa & PTE_RPN_MASK;
pt_entry |= PTE_WIRED;
pt_entry |= pte_flag_bits(mdpg, flags);
pt_entry |= pte_prot_bits(NULL, prot); /* pretend unmanaged */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.7 2011/06/23 02:33:44 matt Exp $ */
/* $NetBSD: pmap.c,v 1.8 2011/06/23 20:46:15 matt Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.7 2011/06/23 02:33:44 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.8 2011/06/23 20:46:15 matt Exp $");
/*
* Manages physical address maps.
@ -1007,7 +1007,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
*/
if (wired) {
pmap->pm_stats.wired_count++;
npte |= pte_wired_entry();
npte = pte_wire_entry(npte);
}
UVMHIST_LOG(*histp, "new pte %#x (pa %#"PRIxPADDR")", npte, pa, 0,0);
@ -1094,8 +1094,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
if ((flags & PMAP_NOCACHE) == 0 && !PMAP_PAGE_COLOROK_P(pa, va))
PMAP_COUNT(kenter_pa_bad);
const pt_entry_t npte = pte_make_kenter_pa(pa, mdpg, prot, flags)
| pte_wired_entry();
const pt_entry_t npte = pte_make_kenter_pa(pa, mdpg, prot, flags);
kpreempt_disable();
pt_entry_t * const ptep = pmap_pte_reserve(pmap_kernel(), va, 0);
KASSERT(ptep != NULL);
@ -1220,7 +1219,7 @@ pmap_unwire(pmap_t pmap, vaddr_t va)
#endif
if (pte_wired_p(pt_entry)) {
*ptep &= ~pte_wired_entry();
*ptep = pte_unwire_entry(*ptep);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC