Module Name: src
Committed By: skrll
Date: Thu Jul 6 15:07:56 UTC 2017
Modified Files:
src/sys/arch/arm/include/arm32: pmap.h
Log Message:
Re-define the L*_PROT_RO for MMUs that don't really support RO mapping
and adjust l2pte_set_{writeable,readony} to the new values.
This allows RO mappings for MMUs that actually support them.
To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/arm/include/arm32/pmap.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/include/arm32/pmap.h
diff -u src/sys/arch/arm/include/arm32/pmap.h:1.148 src/sys/arch/arm/include/arm32/pmap.h:1.149
--- src/sys/arch/arm/include/arm32/pmap.h:1.148 Thu Jul 6 06:31:24 2017
+++ src/sys/arch/arm/include/arm32/pmap.h Thu Jul 6 15:07:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.148 2017/07/06 06:31:24 skrll Exp $ */
+/* $NetBSD: pmap.h,v 1.149 2017/07/06 15:07:56 skrll Exp $ */
/*
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -728,12 +728,12 @@ extern void (*pmap_zero_page_func)(paddr
*/
#define L1_S_PROT_U_generic (L1_S_AP(AP_U))
#define L1_S_PROT_W_generic (L1_S_AP(AP_W))
-#define L1_S_PROT_RO_generic (0)
+#define L1_S_PROT_RO_generic (L1_S_AP(AP_R)) /* AP_W == AP_R */
#define L1_S_PROT_MASK_generic (L1_S_PROT_U|L1_S_PROT_W|L1_S_PROT_RO)
#define L1_S_PROT_U_xscale (L1_S_AP(AP_U))
#define L1_S_PROT_W_xscale (L1_S_AP(AP_W))
-#define L1_S_PROT_RO_xscale (0)
+#define L1_S_PROT_RO_xscale (L1_S_AP(AP_R)) /* AP_W == AP_R */
#define L1_S_PROT_MASK_xscale (L1_S_PROT_U|L1_S_PROT_W|L1_S_PROT_RO)
#define L1_S_PROT_U_armv6 (L1_S_AP(AP_R) | L1_S_AP(AP_U))
@@ -754,12 +754,12 @@ extern void (*pmap_zero_page_func)(paddr
#define L2_L_PROT_U_generic (L2_AP(AP_U))
#define L2_L_PROT_W_generic (L2_AP(AP_W))
-#define L2_L_PROT_RO_generic (0)
+#define L2_L_PROT_RO_generic (L2_AP(AP_R))
#define L2_L_PROT_MASK_generic (L2_L_PROT_U|L2_L_PROT_W|L2_L_PROT_RO)
#define L2_L_PROT_U_xscale (L2_AP(AP_U))
#define L2_L_PROT_W_xscale (L2_AP(AP_W))
-#define L2_L_PROT_RO_xscale (0)
+#define L2_L_PROT_RO_xscale (L2_AP(AP_R))
#define L2_L_PROT_MASK_xscale (L2_L_PROT_U|L2_L_PROT_W|L2_L_PROT_RO)
#define L2_L_PROT_U_armv6n (L2_AP0(AP_R) | L2_AP0(AP_U))
@@ -780,12 +780,12 @@ extern void (*pmap_zero_page_func)(paddr
#define L2_S_PROT_U_generic (L2_AP(AP_U))
#define L2_S_PROT_W_generic (L2_AP(AP_W))
-#define L2_S_PROT_RO_generic (0)
+#define L2_S_PROT_RO_generic (L2_AP(AP_R))
#define L2_S_PROT_MASK_generic (L2_S_PROT_U|L2_S_PROT_W|L2_S_PROT_RO)
#define L2_S_PROT_U_xscale (L2_AP0(AP_U))
#define L2_S_PROT_W_xscale (L2_AP0(AP_W))
-#define L2_S_PROT_RO_xscale (0)
+#define L2_S_PROT_RO_xscale (L2_AP(AP_R))
#define L2_S_PROT_MASK_xscale (L2_S_PROT_U|L2_S_PROT_W|L2_S_PROT_RO)
#define L2_S_PROT_U_armv6n (L2_AP0(AP_R) | L2_AP0(AP_U))
@@ -1023,11 +1023,15 @@ extern void (*pmap_zero_page_func)(paddr
*/
#define l1pte_set_writable(pte) (((pte) & ~L1_S_PROT_RO) | L1_S_PROT_W)
#define l1pte_set_readonly(pte) (((pte) & ~L1_S_PROT_W) | L1_S_PROT_RO)
-#define l2pte_set_writable(pte) (((pte) & ~L2_S_PROT_RO) | L2_S_PROT_W)
-#define l2pte_set_readonly(pte) (((pte) & ~L2_S_PROT_W) | L2_S_PROT_RO)
+
+#define l2pte_set_writable(pte) (L2_S_PROT_W == L2_S_PROT_RO ? \
+ ((pte) | L2_S_PROT_W) : (((pte) & ~L2_S_PROT_RO) | L2_S_PROT_W))
+
+#define l2pte_set_readonly(pte) (L2_S_PROT_W == L2_S_PROT_RO ? \
+ ((pte) & ~L2_S_PROT_RO) : (((pte) & ~L2_S_PROT_W) | L2_S_PROT_RO))
#define l2pte_writable_p(pte) (((pte) & L2_S_PROT_W) == L2_S_PROT_W && \
- (L2_S_PROT_RO == 0 || \
+ (L2_S_PROT_W == L2_S_PROT_RO || \
((pte) & L2_S_PROT_RO) != L2_S_PROT_RO))
/*