summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriane van der Steldt <ariane@cvs.openbsd.org>2011-04-28 20:40:37 +0000
committerAriane van der Steldt <ariane@cvs.openbsd.org>2011-04-28 20:40:37 +0000
commitb9de760d35e2367700baf78e281ae66815be1fbb (patch)
tree6933932c2d2fa9d1ad79bfc8e2fe501332983e0c
parent9bbf050faaad2719d212a42aa68893e6ab1adddb (diff)
Expose pmap_prefer parameters.
This enables future uvm_map code to make intelligent decisions. Code is not called at the moment.
-rw-r--r--sys/arch/sh/include/pmap.h9
-rw-r--r--sys/arch/sh/sh/pmap.c24
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 */
/*