diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-12-06 20:57:20 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-12-06 20:57:20 +0000 |
commit | 06811f8b859a05f9e03926e7738072c6f7fbbc50 (patch) | |
tree | 398a2d7680dfa249a5a2dbbf60f625e96988442e /sys/arch/sparc | |
parent | 03433864b95120162a7f43c2099393d501ba6abc (diff) |
Change the signature of PMAP_PREFER from void PMAP_PREFER(..., vaddr_t *) to
vaddr_t PMAP_PREFER(..., vaddr_t). This allows better compiler optimization
when the function is inlined, and avoids accessing memory on architectures
when we can pass function arguments in registers.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/include/pmap.h | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/pmap.c | 22 |
2 files changed, 12 insertions, 14 deletions
diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index d2727b93faa..2c3c3968ff2 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.48 2010/07/10 19:32:24 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.49 2010/12/06 20:57:18 miod Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -270,7 +270,7 @@ int pmap_dumpmmu(int (*)(dev_t, daddr64_t, caddr_t, size_t), daddr64 struct proc; void pmap_activate(struct proc *); void pmap_bootstrap(int nmmu, int nctx, int nregion); -void pmap_prefer(vaddr_t, vaddr_t *); +vaddr_t pmap_prefer(vaddr_t, vaddr_t); int pmap_pa_exists(paddr_t); void pmap_unwire(pmap_t, vaddr_t); void pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t); diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 77121c067f9..1a8c2680a3b 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.157 2010/07/10 19:32:25 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.158 2010/12/06 20:57:18 miod Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -6239,13 +6239,10 @@ kvm_setcache(va, npages, cached) * least likely to cause cache aliases. * (This will just seg-align mappings.) */ -void -pmap_prefer(foff, vap) - vaddr_t foff; - vaddr_t *vap; +vaddr_t +pmap_prefer(vaddr_t foff, vaddr_t va) { - vaddr_t va = *vap; - long d, m; + vaddr_t d, m; #if defined(SUN4) || defined(SUN4C) || defined(SUN4E) if (VA_INHOLE(va)) @@ -6253,12 +6250,13 @@ pmap_prefer(foff, vap) #endif m = CACHE_ALIAS_DIST; - if (m == 0) /* m=0 => no cache aliasing */ - return; + if (m != 0) { /* m=0 => no cache aliasing */ + d = foff - va; + d &= (m - 1); + va += d; + } - d = foff - va; - d &= (m - 1); - *vap = va + d; + return va; } void |