summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorariane <ariane@openbsd.org>2011-05-18 21:43:22 +0000
committerariane <ariane@openbsd.org>2011-05-18 21:43:22 +0000
commit80915369505ae0c8eef8bdb5a375d750d287b44a (patch)
tree97e9ed9847261c6a4e9e585e417fc48487206acd
parentBetter make PMAP_PREFER_ALIGN() a rounded value, as done on other arches; (diff)
downloadwireguard-openbsd-80915369505ae0c8eef8bdb5a375d750d287b44a.tar.xz
wireguard-openbsd-80915369505ae0c8eef8bdb5a375d750d287b44a.zip
Turns out VA_ALIAS_MASK is indeed a mask, but with the PAGE_MASK deceptively
zeroed out. Documented this in code and updated PMAP_PREFER_* macros to use the corrected values. Discussed with and ok miod@
-rw-r--r--sys/arch/sparc64/include/pmap.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/arch/sparc64/include/pmap.h b/sys/arch/sparc64/include/pmap.h
index e379bf15248..31d986e8e44 100644
--- a/sys/arch/sparc64/include/pmap.h
+++ b/sys/arch/sparc64/include/pmap.h
@@ -145,7 +145,8 @@ struct prom_map {
#define PMAP_4M 0x018
#define PMAP_SZ_TO_TTE(x) (((x)&0x018)<<58)
/* If these bits are different in va's to the same PA then there is an aliasing in the d$ */
-#define VA_ALIAS_MASK (1<<13)
+#define VA_ALIAS_MASK (1<<13) /* = (VA_ALIAS_ALIGN - 1) & ~PAGE_MASK */
+#define VA_ALIAS_ALIGN (1<<14)
typedef struct pmap *pmap_t;
@@ -170,9 +171,9 @@ void pmap_bootstrap(u_long, u_long, u_int, u_int);
#define PMAP_PREFER(pa, va) ((va) + (((va) ^ (pa)) & VA_ALIAS_MASK))
/* pmap prefer alignment */
-#define PMAP_PREFER_ALIGN() (VA_ALIAS_MASK)
+#define PMAP_PREFER_ALIGN() (VA_ALIAS_ALIGN)
/* pmap prefer offset in alignment */
-#define PMAP_PREFER_OFFSET(of) ((of) & (VA_ALIAS_MASK - 1))
+#define PMAP_PREFER_OFFSET(of) ((of) & VA_ALIAS_MASK)
#define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */