summaryrefslogtreecommitdiff
path: root/sys/arch/sh
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-12-06 20:57:20 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-12-06 20:57:20 +0000
commit06811f8b859a05f9e03926e7738072c6f7fbbc50 (patch)
tree398a2d7680dfa249a5a2dbbf60f625e96988442e /sys/arch/sh
parent03433864b95120162a7f43c2099393d501ba6abc (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/sh')
-rw-r--r--sys/arch/sh/include/pmap.h4
-rw-r--r--sys/arch/sh/sh/pmap.c15
2 files changed, 8 insertions, 11 deletions
diff --git a/sys/arch/sh/include/pmap.h b/sys/arch/sh/include/pmap.h
index 2a8de5f33bf..e4d031f149b 100644
--- a/sys/arch/sh/include/pmap.h
+++ b/sys/arch/sh/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.7 2010/11/18 21:21:38 miod Exp $ */
+/* $OpenBSD: pmap.h,v 1.8 2010/12/06 20:57:17 miod Exp $ */
/* $NetBSD: pmap.h,v 1.28 2006/04/10 23:12:11 uwe Exp $ */
/*-
@@ -81,7 +81,7 @@ pmap_remove_all(struct pmap *pmap)
*/
#ifdef SH4
#define PMAP_PREFER(pa, va) pmap_prefer((pa), (va))
-void pmap_prefer(vaddr_t, vaddr_t *);
+vaddr_t pmap_prefer(vaddr_t, vaddr_t);
#endif /* SH4 */
#define __HAVE_PMAP_DIRECT
diff --git a/sys/arch/sh/sh/pmap.c b/sys/arch/sh/sh/pmap.c
index 9678826343b..c8a624edcac 100644
--- a/sys/arch/sh/sh/pmap.c
+++ b/sys/arch/sh/sh/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.15 2010/11/20 20:33:24 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.16 2010/12/06 20:57:17 miod Exp $ */
/* $NetBSD: pmap.c,v 1.55 2006/08/07 23:19:36 tsutsui Exp $ */
/*-
@@ -890,16 +890,13 @@ pmap_clear_modify(struct vm_page *pg)
* Find first virtual address >= *vap that doesn't cause
* a virtual cache alias against vaddr_t foff.
*/
-void
-pmap_prefer(vaddr_t foff, vaddr_t *vap)
+vaddr_t
+pmap_prefer(vaddr_t foff, vaddr_t va)
{
- vaddr_t va;
-
- if (SH_HAS_VIRTUAL_ALIAS) {
- va = *vap;
+ if (SH_HAS_VIRTUAL_ALIAS)
+ va += ((foff - va) & sh_cache_prefer_mask);
- *vap = va + ((foff - va) & sh_cache_prefer_mask);
- }
+ return va;
}
#endif /* SH4 */