Module Name: src Committed By: thorpej Date: Tue Dec 26 17:42:43 UTC 2023
Modified Files: src/sys/arch/m68k/include: pmap_motorola.h src/sys/arch/m68k/m68k: pmap_motorola.c Log Message: - G/C the PMAP_ACTIVATE() macro, just call loadustp() directly. - In pmap_activate(), rather than checking for an idle LWP and skipping the loadustp() in that case, just check if the pmap being activate is the kernel pmap. Also, KASSERT() that the specified lwp is the current lwp. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/include/pmap_motorola.h cvs rdiff -u -r1.80 -r1.81 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/include/pmap_motorola.h diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.39 src/sys/arch/m68k/include/pmap_motorola.h:1.40 --- src/sys/arch/m68k/include/pmap_motorola.h:1.39 Mon Dec 25 21:32:57 2023 +++ src/sys/arch/m68k/include/pmap_motorola.h Tue Dec 26 17:42:43 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.h,v 1.39 2023/12/25 21:32:57 thorpej Exp $ */ +/* $NetBSD: pmap_motorola.h,v 1.40 2023/12/26 17:42:43 thorpej Exp $ */ /* * Copyright (c) 1991, 1993 @@ -108,7 +108,7 @@ struct pmap { * * 68020/030 l2 size is chosen per NPTEPG, a number of page table entries * per page, to use one whole page for PTEs per one segment table entry, - * and maybe also because 68020 HP MMU machines use simlar structures. + * and maybe also because 68020 HP MMU machines use similar structures. * * 68040/060 layout is defined by hardware design and not configurable, * as defined in <m68k/pte_motorola.h>. @@ -171,15 +171,6 @@ struct pmap { #define bmtol2(n) (ffs(n) - 1) /* - * Macros for speed - */ -#define PMAP_ACTIVATE(pmap, loadhw) \ -{ \ - if ((loadhw)) \ - loadustp((paddr_t)(pmap)->pm_stpa); \ -} - -/* * For each struct vm_page, there is a list of all currently valid virtual * mappings of that page. An entry is a pv_entry, the list is pv_table. */ Index: src/sys/arch/m68k/m68k/pmap_motorola.c diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.80 src/sys/arch/m68k/m68k/pmap_motorola.c:1.81 --- src/sys/arch/m68k/m68k/pmap_motorola.c:1.80 Wed Dec 20 00:40:43 2023 +++ src/sys/arch/m68k/m68k/pmap_motorola.c Tue Dec 26 17:42:43 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.c,v 1.80 2023/12/20 00:40:43 thorpej Exp $ */ +/* $NetBSD: pmap_motorola.c,v 1.81 2023/12/26 17:42:43 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -119,7 +119,7 @@ #include "opt_m68k_arch.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.80 2023/12/20 00:40:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.81 2023/12/26 17:42:43 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -753,8 +753,15 @@ pmap_activate(struct lwp *l) PMAP_DPRINTF(PDB_FOLLOW|PDB_SEGTAB, ("pmap_activate(%p)\n", l)); - PMAP_ACTIVATE(pmap, (curlwp->l_flag & LW_IDLE) != 0 || - l->l_proc == curproc); + KASSERT(l == curlwp); + + /* + * Because the kernel has a separate root pointer, we don't + * need to activate the kernel pmap. + */ + if (pmap != pmap_kernel()) { + loadustp((paddr_t)pmap->pm_stpa); + } } /* @@ -2248,15 +2255,13 @@ pmap_remove_mapping(pmap_t pmap, vaddr_t #endif ptpmap->pm_stfree = protostfree; #endif - /* - * XXX may have changed segment table - * pointer for current process so - * update now to reload hardware. + * Segment table has changed; reload the + * MMU if it's the active user pmap. */ - - if (active_user_pmap(ptpmap)) - PMAP_ACTIVATE(ptpmap, 1); + if (active_user_pmap(ptpmap)) { + loadustp((paddr_t)ptpmap->pm_stpa); + } } } pvh->pvh_attrs &= ~PVH_PTPAGE; @@ -2474,11 +2479,12 @@ pmap_enter_ptpage(pmap_t pmap, vaddr_t v } #endif /* - * XXX may have changed segment table pointer for current - * process so update now to reload hardware. + * Segment table has changed; reload the + * MMU if it's the active user pmap. */ - if (active_user_pmap(pmap)) - PMAP_ACTIVATE(pmap, 1); + if (active_user_pmap(pmap)) { + loadustp((paddr_t)pmap->pm_stpa); + } PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB, ("enter: pmap %p stab %p(%p)\n",