From: kettenis Date: Wed, 10 Aug 2016 21:22:43 +0000 (+0000) Subject: Shuffle armv7 access permission bits around to something that is compatible X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f976bc9b4ba95328314f5f4fd83216d50bafd383;p=openbsd Shuffle armv7 access permission bits around to something that is compatible 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@ --- diff --git a/sys/arch/arm/arm/cpufunc.c b/sys/arch/arm/arm/cpufunc.c index 92dec5951ba..667a9ca17d0 100644 --- a/sys/arch/arm/arm/cpufunc.c +++ b/sys/arch/arm/arm/cpufunc.c @@ -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; diff --git a/sys/arch/arm/include/pmap.h b/sys/arch/arm/include/pmap.h index 393b5484373..c3a1729846f 100644 --- a/sys/arch/arm/include/pmap.h +++ b/sys/arch/arm/include/pmap.h @@ -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)) diff --git a/sys/arch/arm/include/pte.h b/sys/arch/arm/include/pte.h index 4a1cf99d9c2..6cc5ff30192 100644 --- a/sys/arch/arm/include/pte.h +++ b/sys/arch/arm/include/pte.h @@ -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 */ /*