Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Redo how the pte_*wire* inlines work. Now pmap.c makes ...



details:   https://anonhg.NetBSD.org/src/rev/b1b61184d457
branches:  trunk
changeset: 766489:b1b61184d457
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jun 23 20:46:15 2011 +0000

description:
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.

diffstat:

 sys/arch/powerpc/include/booke/pte.h |  13 ++++++++++---
 sys/common/pmap/tlb/pmap.c           |  11 +++++------
 2 files changed, 15 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r a3a461b257c8 -r b1b61184d457 sys/arch/powerpc/include/booke/pte.h
--- a/sys/arch/powerpc/include/booke/pte.h      Thu Jun 23 18:15:30 2011 +0000
+++ b/sys/arch/powerpc/include/booke/pte.h      Thu Jun 23 20:46:15 2011 +0000
@@ -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 @@
 }
 
 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 @@
 {
        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 */
 
diff -r a3a461b257c8 -r b1b61184d457 sys/common/pmap/tlb/pmap.c
--- a/sys/common/pmap/tlb/pmap.c        Thu Jun 23 18:15:30 2011 +0000
+++ b/sys/common/pmap/tlb/pmap.c        Thu Jun 23 20:46:15 2011 +0000
@@ -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 @@
         */
        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 @@
        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 @@
 #endif
 
        if (pte_wired_p(pt_entry)) {
-               *ptep &= ~pte_wired_entry();
+               *ptep = pte_unwire_entry(*ptep);
                pmap->pm_stats.wired_count--;
        }
 #ifdef DIAGNOSTIC



Home | Main Index | Thread Index | Old Index