diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-06-24 13:22:16 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-06-24 13:22:16 +0000 |
commit | 03f621b4ad00ae11a297fdcebfc89315b2320da3 (patch) | |
tree | cd00ac6de69d1ce1dc75e5eed2d459122edcb0af /sys | |
parent | 7e310a00247ef048ed5192a21b9ec288944134e8 (diff) |
Add pmap_enter_cache(), similar to pmap_kenter_cache() but for managed
pages, and implement pmap_enter() as a particular case of it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/m68k/include/pmap_motorola.h | 3 | ||||
-rw-r--r-- | sys/arch/m68k/m68k/pmap_motorola.c | 42 |
2 files changed, 34 insertions, 11 deletions
diff --git a/sys/arch/m68k/include/pmap_motorola.h b/sys/arch/m68k/include/pmap_motorola.h index 00dba40bd9a..e2fa7ccb2bc 100644 --- a/sys/arch/m68k/include/pmap_motorola.h +++ b/sys/arch/m68k/include/pmap_motorola.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.h,v 1.14 2006/06/17 16:29:10 miod Exp $ */ +/* $OpenBSD: pmap_motorola.h,v 1.15 2006/06/24 13:22:14 miod Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -135,6 +135,7 @@ extern char *vmmap; /* map for mem, dumps, etc. */ void pmap_proc_iflush(struct proc *, vaddr_t, vsize_t); +int pmap_enter_cache(pmap_t, vaddr_t, paddr_t, vm_prot_t, int, pt_entry_t); void pmap_kenter_cache(vaddr_t, paddr_t, pt_entry_t); #ifdef M68K_MMU_HP diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c index 81336332102..e56c554cb58 100644 --- a/sys/arch/m68k/m68k/pmap_motorola.c +++ b/sys/arch/m68k/m68k/pmap_motorola.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.c,v 1.45 2006/06/20 20:40:18 miod Exp $ */ +/* $OpenBSD: pmap_motorola.c,v 1.46 2006/06/24 13:22:15 miod Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -975,6 +975,33 @@ pmap_enter(pmap, va, pa, prot, flags) vm_prot_t prot; int flags; { + pt_entry_t pte; + + pte = 0; +#if defined(M68040) || defined(M68060) + if (mmutype <= MMU_68040 && (pte_prot(prot) & PG_PROT) == PG_RW) +#ifdef PMAP_DEBUG + if (dowriteback && (dokwriteback || pmap != pmap_kernel())) +#endif + pte |= PG_CCB; +#endif + return (pmap_enter_cache(pmap, va, pa, prot, flags, pte)); +} + +/* + * Similar to pmap_enter(), but allows the caller to control the + * cacheability of the mapping. However if it is found that this mapping + * needs to be cache inhibited, the cache bits from the caller are ignored. + */ +int +pmap_enter_cache(pmap, va, pa, prot, flags, template) + pmap_t pmap; + vaddr_t va; + paddr_t pa; + vm_prot_t prot; + int flags; + pt_entry_t template; +{ struct vm_page *pg; pt_entry_t *pte; int npte, error; @@ -986,8 +1013,8 @@ pmap_enter(pmap, va, pa, prot, flags) boolean_t wired = (flags & PMAP_WIRED) != 0; PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER, - ("pmap_enter(%p, %lx, %lx, %x, %x)\n", - pmap, va, pa, prot, wired)); + ("pmap_enter_cache(%p, %lx, %lx, %x, %x, %x)\n", + pmap, va, pa, prot, wired, template)); #ifdef DIAGNOSTIC /* @@ -1235,13 +1262,8 @@ validate: if (!cacheable) #endif npte |= PG_CI; -#if defined(M68040) || defined(M68060) - if (mmutype <= MMU_68040 && (npte & (PG_PROT|PG_CI)) == PG_RW) -#ifdef PMAP_DEBUG - if (dowriteback && (dokwriteback || pmap != pmap_kernel())) -#endif - npte |= PG_CCB; -#endif + else + npte |= template; PMAP_DPRINTF(PDB_ENTER, ("enter: new pte value %x\n", npte)); |