From b9de760d35e2367700baf78e281ae66815be1fbb Mon Sep 17 00:00:00 2001 From: Ariane van der Steldt Date: Thu, 28 Apr 2011 20:40:37 +0000 Subject: Expose pmap_prefer parameters. This enables future uvm_map code to make intelligent decisions. Code is not called at the moment. --- sys/arch/sh/include/pmap.h | 9 ++++++++- sys/arch/sh/sh/pmap.c | 24 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/sys/arch/sh/include/pmap.h b/sys/arch/sh/include/pmap.h index 55f5b7ff697..954f9b607c8 100644 --- a/sys/arch/sh/include/pmap.h +++ b/sys/arch/sh/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.9 2010/12/26 15:41:00 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.10 2011/04/28 20:40:36 ariane Exp $ */ /* $NetBSD: pmap.h,v 1.28 2006/04/10 23:12:11 uwe Exp $ */ /*- @@ -81,6 +81,13 @@ pmap_remove_all(struct pmap *pmap) #ifdef SH4 #define PMAP_PREFER(pa, va) pmap_prefer((pa), (va)) vaddr_t pmap_prefer(vaddr_t, vaddr_t); +vaddr_t pmap_prefer_align(void); +vaddr_t pmap_prefer_offset(vaddr_t); + +/* pmap prefer alignment */ +#define PMAP_PREFER_ALIGN() pmap_prefer_align() +/* pmap prefer offset in alignment */ +#define PMAP_PREFER_OFFSET(of) pmap_prefer_offset(of) #endif /* SH4 */ #define __HAVE_PMAP_DIRECT diff --git a/sys/arch/sh/sh/pmap.c b/sys/arch/sh/sh/pmap.c index 3adb1cd3305..cbfaf6875f8 100644 --- a/sys/arch/sh/sh/pmap.c +++ b/sys/arch/sh/sh/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.17 2010/12/14 20:24:25 jasper Exp $ */ +/* $OpenBSD: pmap.c,v 1.18 2011/04/28 20:40:36 ariane Exp $ */ /* $NetBSD: pmap.c,v 1.55 2006/08/07 23:19:36 tsutsui Exp $ */ /*- @@ -903,6 +903,28 @@ pmap_prefer(vaddr_t foff, vaddr_t va) return va; } + +/* + * pmap_prefer_align() + * + * Return virtual cache alignment. + */ +vaddr_t +pmap_prefer_align(void) +{ + return SH_HAS_VIRTUAL_ALIAS ? sh_cache_prefer_mask + 1 : 0; +} + +/* + * pmap_prefer_offset(vaddr_t of) + * + * Calculate offset in virtual cache. + */ +vaddr_t +pmap_prefer_offset(vaddr_t of) +{ + return of & (SH_HAS_VIRTUAL_ALIAS ? sh_cache_prefer_mask : 0); +} #endif /* SH4 */ /* -- cgit v1.2.3