summaryrefslogtreecommitdiff
path: root/sys/arch/arm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-02-01 04:28:46 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-02-01 04:28:46 +0000
commit8c77a6f7aabd5e56f7fabfc939bfff564cfb7c82 (patch)
tree9ae97612acd79b0d2000d9cb40cf49e290aaeb20 /sys/arch/arm
parent62657f013a2ffd6a246d56d34e7807482ac6bb9e (diff)
Fix the encoding of AP bits for large page second-level
short-descriptors with arm v7 (same as small page encoding, except XN is in a different bit for the mask). Expanded version of a diff from Patrick Wildt who also tested and reviewed this.
Diffstat (limited to 'sys/arch/arm')
-rw-r--r--sys/arch/arm/arm/pmap.c26
-rw-r--r--sys/arch/arm/arm/pmap7.c20
-rw-r--r--sys/arch/arm/include/pmap.h54
3 files changed, 92 insertions, 8 deletions
diff --git a/sys/arch/arm/arm/pmap.c b/sys/arch/arm/arm/pmap.c
index 7603fde46ab..dda550f522f 100644
--- a/sys/arch/arm/arm/pmap.c
+++ b/sys/arch/arm/arm/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.57 2016/01/31 00:14:50 jsg Exp $ */
+/* $OpenBSD: pmap.c,v 1.58 2016/02/01 04:28:45 jsg Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -4361,6 +4361,12 @@ pt_entry_t pte_l1_s_prot_kr;
pt_entry_t pte_l1_s_prot_kw;
pt_entry_t pte_l1_s_prot_mask;
+pt_entry_t pte_l2_l_prot_ur;
+pt_entry_t pte_l2_l_prot_uw;
+pt_entry_t pte_l2_l_prot_kr;
+pt_entry_t pte_l2_l_prot_kw;
+pt_entry_t pte_l2_l_prot_mask;
+
pt_entry_t pte_l2_s_prot_ur;
pt_entry_t pte_l2_s_prot_uw;
pt_entry_t pte_l2_s_prot_kr;
@@ -4413,6 +4419,12 @@ pmap_pte_init_generic(void)
pte_l1_s_prot_kw = L1_S_PROT_KW_generic;
pte_l1_s_prot_mask = L1_S_PROT_MASK_generic;
+ pte_l2_l_prot_ur = L2_L_PROT_UR_generic;
+ pte_l2_l_prot_uw = L2_L_PROT_UW_generic;
+ pte_l2_l_prot_kr = L2_L_PROT_KR_generic;
+ pte_l2_l_prot_kw = L2_L_PROT_KW_generic;
+ pte_l2_l_prot_mask = L2_L_PROT_MASK_generic;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_generic;
pte_l2_s_prot_uw = L2_S_PROT_UW_generic;
pte_l2_s_prot_kr = L2_S_PROT_KR_generic;
@@ -4542,6 +4554,12 @@ pmap_pte_init_armv7(void)
pte_l1_s_prot_kw = L1_S_PROT_KW_v7;
pte_l1_s_prot_mask = L1_S_PROT_MASK_v7;
+ pte_l2_l_prot_ur = L2_L_PROT_UR_v7;
+ pte_l2_l_prot_uw = L2_L_PROT_UW_v7;
+ pte_l2_l_prot_kr = L2_L_PROT_KR_v7;
+ pte_l2_l_prot_kw = L2_L_PROT_KW_v7;
+ pte_l2_l_prot_mask = L2_L_PROT_MASK_v7;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_v7;
pte_l2_s_prot_uw = L2_S_PROT_UW_v7;
pte_l2_s_prot_kr = L2_S_PROT_KR_v7;
@@ -4680,6 +4698,12 @@ pmap_pte_init_xscale(void)
pte_l1_s_prot_kw = L1_S_PROT_KW_xscale;
pte_l1_s_prot_mask = L1_S_PROT_MASK_xscale;
+ pte_l2_l_prot_ur = L2_L_PROT_UR_xscale;
+ pte_l2_l_prot_uw = L2_L_PROT_UW_xscale;
+ pte_l2_l_prot_kr = L2_L_PROT_KR_xscale;
+ pte_l2_l_prot_kw = L2_L_PROT_KW_xscale;
+ pte_l2_l_prot_mask = L2_L_PROT_MASK_xscale;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_xscale;
pte_l2_s_prot_uw = L2_S_PROT_UW_xscale;
pte_l2_s_prot_kr = L2_S_PROT_KR_xscale;
diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c
index 4ee104bda2b..73cae31757b 100644
--- a/sys/arch/arm/arm/pmap7.c
+++ b/sys/arch/arm/arm/pmap7.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap7.c,v 1.22 2016/01/31 00:14:50 jsg Exp $ */
+/* $OpenBSD: pmap7.c,v 1.23 2016/02/01 04:28:45 jsg Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -3337,6 +3337,12 @@ pt_entry_t pte_l1_s_prot_kr;
pt_entry_t pte_l1_s_prot_kw;
pt_entry_t pte_l1_s_prot_mask;
+pt_entry_t pte_l2_l_prot_ur;
+pt_entry_t pte_l2_l_prot_uw;
+pt_entry_t pte_l2_l_prot_kr;
+pt_entry_t pte_l2_l_prot_kw;
+pt_entry_t pte_l2_l_prot_mask;
+
pt_entry_t pte_l2_s_prot_ur;
pt_entry_t pte_l2_s_prot_uw;
pt_entry_t pte_l2_s_prot_kr;
@@ -3388,6 +3394,12 @@ pmap_pte_init_generic(void)
pte_l1_s_prot_kw = L1_S_PROT_KW_generic;
pte_l1_s_prot_mask = L1_S_PROT_MASK_generic;
+ pte_l2_l_prot_ur = L2_L_PROT_UR_generic;
+ pte_l2_l_prot_uw = L2_L_PROT_UW_generic;
+ pte_l2_l_prot_kr = L2_L_PROT_KR_generic;
+ pte_l2_l_prot_kw = L2_L_PROT_KW_generic;
+ pte_l2_l_prot_mask = L2_L_PROT_MASK_generic;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_generic;
pte_l2_s_prot_uw = L2_S_PROT_UW_generic;
pte_l2_s_prot_kr = L2_S_PROT_KR_generic;
@@ -3437,6 +3449,12 @@ pmap_pte_init_armv7(void)
pte_l1_s_prot_kw = L1_S_PROT_KW_v7;
pte_l1_s_prot_mask = L1_S_PROT_MASK_v7;
+ pte_l2_l_prot_ur = L2_L_PROT_UR_v7;
+ pte_l2_l_prot_uw = L2_L_PROT_UW_v7;
+ pte_l2_l_prot_kr = L2_L_PROT_KR_v7;
+ pte_l2_l_prot_kw = L2_L_PROT_KW_v7;
+ pte_l2_l_prot_mask = L2_L_PROT_MASK_v7;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_v7;
pte_l2_s_prot_uw = L2_S_PROT_UW_v7;
pte_l2_s_prot_kr = L2_S_PROT_KR_v7;
diff --git a/sys/arch/arm/include/pmap.h b/sys/arch/arm/include/pmap.h
index e5d3cd4ef3b..c409ad35a8e 100644
--- a/sys/arch/arm/include/pmap.h
+++ b/sys/arch/arm/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.34 2015/08/15 22:20:20 miod Exp $ */
+/* $OpenBSD: pmap.h,v 1.35 2016/02/01 04:28:45 jsg Exp $ */
/* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */
/*
@@ -431,6 +431,12 @@ extern pt_entry_t pte_l1_s_prot_kr;
extern pt_entry_t pte_l1_s_prot_kw;
extern pt_entry_t pte_l1_s_prot_mask;
+extern pt_entry_t pte_l2_l_prot_ur;
+extern pt_entry_t pte_l2_l_prot_uw;
+extern pt_entry_t pte_l2_l_prot_kr;
+extern pt_entry_t pte_l2_l_prot_kw;
+extern pt_entry_t pte_l2_l_prot_mask;
+
extern pt_entry_t pte_l2_s_prot_ur;
extern pt_entry_t pte_l2_s_prot_uw;
extern pt_entry_t pte_l2_s_prot_kr;
@@ -487,11 +493,23 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_COHERENT_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X))
#define L1_S_COHERENT_v7 (L1_S_C|L1_S_V7_TEX_MASK)
-#define L2_L_PROT_KR (L2_AP(0))
-#define L2_L_PROT_UR (L2_AP(AP_U))
-#define L2_L_PROT_KW (L2_AP(AP_W))
-#define L2_L_PROT_UW (L2_AP(AP_U|AP_W))
-#define L2_L_PROT_MASK (L2_AP(AP_U|AP_W))
+#define L2_L_PROT_KR_generic (L2_AP(0))
+#define L2_L_PROT_UR_generic (L2_AP(AP_U))
+#define L2_L_PROT_KW_generic (L2_AP(AP_W))
+#define L2_L_PROT_UW_generic (L2_AP(AP_U|AP_W))
+#define L2_L_PROT_MASK_generic (L2_AP(AP_U|AP_W))
+
+#define L2_L_PROT_KR_xscale (L2_AP(0))
+#define L2_L_PROT_UR_xscale (L2_AP(AP_U))
+#define L2_L_PROT_KW_xscale (L2_AP(AP_W))
+#define L2_L_PROT_UW_xscale (L2_AP(AP_U|AP_W))
+#define L2_L_PROT_MASK_xscale (L2_AP(AP_U|AP_W))
+
+#define L2_L_PROT_UR_v7 (L2_V7_AP(AP_KRWUR))
+#define L2_L_PROT_UW_v7 (L2_V7_AP(AP_KRWURW))
+#define L2_L_PROT_KR_v7 (L2_V7_AP(AP_V7_KR))
+#define L2_L_PROT_KW_v7 (L2_V7_AP(AP_KRW))
+#define L2_L_PROT_MASK_v7 (L2_V7_AP(0x07) | L2_V7_L_XN)
#define L2_L_CACHE_MASK_generic (L2_B|L2_C)
#define L2_L_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X))
@@ -553,6 +571,12 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_PROT_KW pte_l1_s_prot_kw
#define L1_S_PROT_MASK pte_l1_s_prot_mask
+#define L2_L_PROT_UR pte_l2_l_prot_ur
+#define L2_L_PROT_UW pte_l2_l_prot_uw
+#define L2_L_PROT_KR pte_l2_l_prot_kr
+#define L2_L_PROT_KW pte_l2_l_prot_kw
+#define L2_L_PROT_MASK pte_l2_l_prot_mask
+
#define L2_S_PROT_UR pte_l2_s_prot_ur
#define L2_S_PROT_UW pte_l2_s_prot_uw
#define L2_S_PROT_KR pte_l2_s_prot_kr
@@ -580,6 +604,12 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_PROT_KW L1_S_PROT_KW_generic
#define L1_S_PROT_MASK L1_S_PROT_MASK_generic
+#define L2_L_PROT_UR L2_L_PROT_UR_generic
+#define L2_L_PROT_UW L2_L_PROT_UW_generic
+#define L2_L_PROT_KR L2_L_PROT_KR_generic
+#define L2_L_PROT_KW L2_L_PROT_KW_generic
+#define L2_L_PROT_MASK L2_L_PROT_MASK_generic
+
#define L2_S_PROT_UR L2_S_PROT_UR_generic
#define L2_S_PROT_UW L2_S_PROT_UW_generic
#define L2_S_PROT_KR L2_S_PROT_KR_generic
@@ -607,6 +637,12 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_PROT_KW L1_S_PROT_KW_xscale
#define L1_S_PROT_MASK L1_S_PROT_MASK_xscale
+#define L2_L_PROT_UR L2_L_PROT_UR_xscale
+#define L2_L_PROT_UW L2_L_PROT_UW_xscale
+#define L2_L_PROT_KR L2_L_PROT_KR_xscale
+#define L2_L_PROT_KW L2_L_PROT_KW_xscale
+#define L2_L_PROT_MASK L2_L_PROT_MASK_xscale
+
#define L2_S_PROT_UR L2_S_PROT_UR_xscale
#define L2_S_PROT_UW L2_S_PROT_UW_xscale
#define L2_S_PROT_KR L2_S_PROT_KR_xscale
@@ -634,6 +670,12 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_PROT_KW L1_S_PROT_KW_v7
#define L1_S_PROT_MASK L1_S_PROT_MASK_v7
+#define L2_L_PROT_UR L2_L_PROT_UR_v7
+#define L2_L_PROT_UW L2_L_PROT_UW_v7
+#define L2_L_PROT_KR L2_L_PROT_KR_v7
+#define L2_L_PROT_KW L2_L_PROT_KW_v7
+#define L2_L_PROT_MASK L2_L_PROT_MASK_v7
+
#define L2_S_PROT_UR L2_S_PROT_UR_v7
#define L2_S_PROT_UW L2_S_PROT_UW_v7
#define L2_S_PROT_KR L2_S_PROT_KR_v7