Shuffle armv7 access permission bits around to something that is compatible
authorkettenis <kettenis@openbsd.org>
Wed, 10 Aug 2016 21:22:43 +0000 (21:22 +0000)
committerkettenis <kettenis@openbsd.org>
Wed, 10 Aug 2016 21:22:43 +0000 (21:22 +0000)
with setting the Access Flag Enable bit in the System Control Register.
The new settings mean that read-only userland pages are no longer writable
by the kernel, which is a good thing.  Set the Access Flag Enable bit.

ok patrick@

sys/arch/arm/arm/cpufunc.c
sys/arch/arm/include/pmap.h
sys/arch/arm/include/pte.h

index 92dec59..667a9ca 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpufunc.c,v 1.43 2016/08/03 07:05:05 kettenis Exp $   */
+/*     $OpenBSD: cpufunc.c,v 1.44 2016/08/10 21:22:43 kettenis Exp $   */
 /*     $NetBSD: cpufunc.c,v 1.65 2003/11/05 12:53:15 scw Exp $ */
 
 /*
@@ -581,7 +581,8 @@ armv7_setup()
            | CPU_CONTROL_AFLT_ENABLE
            | CPU_CONTROL_DC_ENABLE
            | CPU_CONTROL_BPRD_ENABLE
-           | CPU_CONTROL_IC_ENABLE;
+           | CPU_CONTROL_IC_ENABLE
+           | CPU_CONTROL_AFE;
 
        if (vector_page == ARM_VECTORS_HIGH)
                cpuctrl |= CPU_CONTROL_VECRELOC;
index 393b548..c3a1729 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pmap.h,v 1.41 2016/08/08 14:47:52 kettenis Exp $      */
+/*     $OpenBSD: pmap.h,v 1.42 2016/08/10 21:22:43 kettenis Exp $      */
 /*     $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $       */
 
 /*
@@ -470,7 +470,7 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
 #define        L1_S_PROT_KW_xscale     (L1_S_AP(AP_W))
 #define        L1_S_PROT_MASK_xscale   (L1_S_AP(0x03))
 
-#define        L1_S_PROT_UR_v7         (L1_S_V7_AP(AP_KRWUR))
+#define        L1_S_PROT_UR_v7         (L1_S_V7_AP(AP_V7_KRUR))
 #define        L1_S_PROT_UW_v7         (L1_S_V7_AP(AP_KRWURW))
 #define        L1_S_PROT_KR_v7         (L1_S_V7_AP(AP_V7_KR))
 #define        L1_S_PROT_KW_v7         (L1_S_V7_AP(AP_KRW))
@@ -496,7 +496,7 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
 #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_UR_v7         (L2_V7_AP(AP_V7_KRUR))
 #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))
@@ -522,7 +522,7 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
 #define        L2_S_PROT_KW_xscale     (L2_AP0(AP_W))
 #define        L2_S_PROT_MASK_xscale   (L2_AP0(AP_U|AP_W))
 
-#define        L2_S_PROT_UR_v7         (L2_V7_AP(AP_KRWUR))
+#define        L2_S_PROT_UR_v7         (L2_V7_AP(AP_V7_KRUR))
 #define        L2_S_PROT_UW_v7         (L2_V7_AP(AP_KRWURW))
 #define        L2_S_PROT_KR_v7         (L2_V7_AP(AP_V7_KR))
 #define        L2_S_PROT_KW_v7         (L2_V7_AP(AP_KRW))
index 4a1cf99..6cc5ff3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pte.h,v 1.4 2013/04/26 05:05:34 patrick Exp $ */
+/*     $OpenBSD: pte.h,v 1.5 2016/08/10 21:22:43 kettenis Exp $        */
 /*     $NetBSD: pte.h,v 1.6 2003/04/18 11:08:28 scw Exp $      */
 
 /*
@@ -238,6 +238,7 @@ typedef uint32_t    pt_entry_t;     /* L2 table entry */
 #define        AP_V7_KR        0x05
 #define        AP_KRW          0x01            /* kernel read/write */
 #define        AP_KRWUR        0x02            /* kernel read/write usr read */
+#define        AP_V7_KRUR      0x07            /* kernel read usr read */
 #define        AP_KRWURW       0x03            /* kernel read/write usr read/write */
 
 /*