From 17b139027855eff3bc4f1f46a3fd9d90700c33bd Mon Sep 17 00:00:00 2001 From: atatat Date: Mon, 17 Jan 2005 04:54:14 +0000 Subject: [PATCH] Teach mips pmap_prefer() to deal with topdown. Tested by simonb. --- sys/arch/mips/include/pmap.h | 6 +++--- sys/arch/mips/mips/pmap.c | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/arch/mips/include/pmap.h b/sys/arch/mips/include/pmap.h index 9b83bfc90887..0b9a92e6beb7 100644 --- a/sys/arch/mips/include/pmap.h +++ b/sys/arch/mips/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.45 2005/01/17 04:37:20 atatat Exp $ */ +/* $NetBSD: pmap.h,v 1.46 2005/01/17 04:54:14 atatat Exp $ */ /* * Copyright (c) 1992, 1993 @@ -171,8 +171,8 @@ void pmap_procwr(struct proc *, vaddr_t, size_t); * the virtually-indexed cache on mips3 CPUs. */ #ifdef MIPS3_PLUS -#define PMAP_PREFER(pa, va, sz, td) pmap_prefer((pa), (va)) -void pmap_prefer(vaddr_t, vaddr_t *); +#define PMAP_PREFER(pa, va, sz, td) pmap_prefer((pa), (va), (td)) +void pmap_prefer(vaddr_t, vaddr_t *, int); #endif /* MIPS3_PLUS */ #define PMAP_STEAL_MEMORY /* enable pmap_steal_memory() */ diff --git a/sys/arch/mips/mips/pmap.c b/sys/arch/mips/mips/pmap.c index 0f009c717d86..51a5fad2478e 100644 --- a/sys/arch/mips/mips/pmap.c +++ b/sys/arch/mips/mips/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.155 2003/12/30 12:33:16 pk Exp $ */ +/* $NetBSD: pmap.c,v 1.156 2005/01/17 04:54:14 atatat Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.155 2003/12/30 12:33:16 pk Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.156 2005/01/17 04:54:14 atatat Exp $"); /* * Manages physical address maps. @@ -2139,9 +2139,10 @@ pmap_pte(pmap, va) * a cache alias conflict. */ void -pmap_prefer(foff, vap) +pmap_prefer(foff, vap, td) vaddr_t foff; vaddr_t *vap; + int td; { vaddr_t va; vsize_t d; @@ -2151,6 +2152,8 @@ pmap_prefer(foff, vap) d = foff - va; d &= mips_cache_prefer_mask; + if (td && d) + d = -((-d) & mips_cache_prefer_mask); *vap = va + d; } }