Add mips_indexof() macro to make code for checking the cache index

easier to read.
This commit is contained in:
jeffs 2000-10-31 21:21:10 +00:00
parent 63a0bbd711
commit 11ef576801
3 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.h,v 1.50 2000/10/09 07:33:31 nisimura Exp $ */
/* $NetBSD: locore.h,v 1.51 2000/10/31 21:21:10 jeffs Exp $ */
/*
* Copyright 1996 The Board of Trustees of The Leland Stanford
@ -230,6 +230,8 @@ extern u_int mips_L2CacheLSize;
extern u_int mips_CacheAliasMask;
extern u_int mips_CachePreferMask;
#define mips_indexof(addr) (((int)(addr)) & mips_CacheAliasMask)
#ifdef MIPS3
extern int mips3_L1TwoWayCache;
extern int mips3_cacheflush_bug;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.109 2000/10/10 20:39:42 jeffs Exp $ */
/* $NetBSD: pmap.c,v 1.110 2000/10/31 21:21:11 jeffs Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2000/10/10 20:39:42 jeffs Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2000/10/31 21:21:11 jeffs Exp $");
/*
* Manages physical address maps.
@ -1956,8 +1956,8 @@ pmap_enter_pv(pmap, va, pa, npte)
/*
* Check cache aliasing incompatibility
*/
if ((npv->pv_va & mips_CacheAliasMask)
!= (va & mips_CacheAliasMask)) {
if (mips_indexof(npv->pv_va)
!= mips_indexof(va)) {
pmap_page_cache(pa,PV_UNCACHED);
MachFlushDCache(pv->pv_va, PAGE_SIZE);
*npte = (*npte & ~MIPS3_PG_CACHEMODE) | MIPS3_PG_UNCACHED;
@ -2111,7 +2111,7 @@ pmap_remove_pv(pmap, va, pa)
*/
pv = pa_to_pvh(pa);
for (npv = pv->pv_next; npv; npv = npv->pv_next) {
if ((pv->pv_va ^ npv->pv_va) & mips_CacheAliasMask)
if (mips_indexof(pv->pv_va ^ npv->pv_va))
break;
}
if (npv == NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.71 2000/09/13 01:53:01 nisimura Exp $ */
/* $NetBSD: vm_machdep.c,v 1.72 2000/10/31 21:21:11 jeffs Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.71 2000/09/13 01:53:01 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.72 2000/10/31 21:21:11 jeffs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -257,9 +257,7 @@ pagemove(from, to, size)
fpte = kvtopte(from);
tpte = kvtopte(to);
#ifdef MIPS3
if (CPUISMIPS3 &&
((int)from & mips_CacheAliasMask) !=
((int)to & mips_CacheAliasMask)) {
if (CPUISMIPS3 && (mips_indexof(from) != mips_indexof(to))) {
MachHitFlushDCache((vaddr_t)from, size);
}
#endif