Module Name: src Committed By: matt Date: Thu Jun 23 20:46:16 UTC 2011
Modified Files: src/sys/arch/powerpc/include/booke: pte.h src/sys/common/pmap/tlb: pmap.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/include/booke/pte.h cvs rdiff -u -r1.7 -r1.8 src/sys/common/pmap/tlb/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/powerpc/include/booke/pte.h diff -u src/sys/arch/powerpc/include/booke/pte.h:1.4 src/sys/arch/powerpc/include/booke/pte.h:1.5 --- src/sys/arch/powerpc/include/booke/pte.h:1.4 Thu Jun 23 01:27:20 2011 +++ src/sys/arch/powerpc/include/booke/pte.h Thu Jun 23 20:46:15 2011 @@ -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 */ Index: src/sys/common/pmap/tlb/pmap.c diff -u src/sys/common/pmap/tlb/pmap.c:1.7 src/sys/common/pmap/tlb/pmap.c:1.8 --- src/sys/common/pmap/tlb/pmap.c:1.7 Thu Jun 23 02:33:44 2011 +++ src/sys/common/pmap/tlb/pmap.c Thu Jun 23 20:46:15 2011 @@ -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