Module Name: src Committed By: skrll Date: Fri Jan 6 08:32:08 UTC 2012
Modified Files: src/sys/arch/hppa/hppa: pmap.c Log Message: Simplify code a little. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/hppa/hppa/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/hppa/hppa/pmap.c diff -u src/sys/arch/hppa/hppa/pmap.c:1.90 src/sys/arch/hppa/hppa/pmap.c:1.91 --- src/sys/arch/hppa/hppa/pmap.c:1.90 Fri Jan 6 08:03:16 2012 +++ src/sys/arch/hppa/hppa/pmap.c Fri Jan 6 08:32:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.90 2012/01/06 08:03:16 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.91 2012/01/06 08:32:08 skrll Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.90 2012/01/06 08:03:16 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.91 2012/01/06 08:32:08 skrll Exp $"); #include "opt_cputype.h" @@ -1698,6 +1698,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v { volatile pt_entry_t *pde; pt_entry_t pte, opte; + struct vm_page *pg; #ifdef PMAPDEBUG int opmapdebug = pmapdebug; @@ -1727,28 +1728,23 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v if (opte) pmap_pte_flush(pmap_kernel(), va, opte); - if (pmap_initialized) { - struct vm_page *pg; + + pg = pmap_initialized ? PHYS_TO_VM_PAGE(PTE_PAGE(pte)) : NULL; + if (pg != NULL) { + KASSERT(pa < HPPA_IOBEGIN); - pg = PHYS_TO_VM_PAGE(PTE_PAGE(pte)); - if (pg != NULL) { - KASSERT(pa < HPPA_IOBEGIN); + struct pv_entry *pve; - struct pv_entry *pve; - - pve = pmap_pv_alloc(); - if (!pve) - panic("%s: no pv entries available", - __func__); - DPRINTF(PDB_FOLLOW|PDB_ENTER, - ("%s(%lx, %lx, %x) TLB_KENTER\n", __func__, - va, pa, pte)); + pve = pmap_pv_alloc(); + if (!pve) + panic("%s: no pv entries available", __func__); + DPRINTF(PDB_FOLLOW|PDB_ENTER, ("%s(%lx, %lx, %x) TLB_KENTER\n", + _func__, va, pa, pte)); - if (pmap_check_alias(pg, va, pte)) - pmap_page_remove(pg); - pmap_pv_enter(pg, pve, pmap_kernel(), va, NULL, - PV_KENTER); - } + if (pmap_check_alias(pg, va, pte)) + pmap_page_remove(pg); + + pmap_pv_enter(pg, pve, pmap_kernel(), va, NULL, PV_KENTER); } pmap_pte_set(pde, va, pte); @@ -1815,7 +1811,9 @@ pmap_kremove(vaddr_t va, vsize_t size) pmap_pte_flush(pmap, va, pte); pmap_pte_set(pde, va, 0); - if (pmap_initialized && (pg = PHYS_TO_VM_PAGE(PTE_PAGE(pte)))) { + + pg = pmap_initialized ? PHYS_TO_VM_PAGE(PTE_PAGE(pte)) : NULL; + if (pg != NULL) { pve = pmap_pv_remove(pg, pmap, va); if (pve != NULL)