diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-12-04 22:02:51 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-12-04 22:02:51 +0100 |
commit | f48f1a324aaad4616b93ec595d5e0f2e22d12bc4 (patch) | |
tree | 6481066d6ec62f330f6453cbe8462efb6343fc31 | |
parent | c9570c14af7780384df818c94700dc8a18a29423 (diff) |
bcm: use extended small pages so XN bit can work
the change to support no-execute bits broke the original
raspberry pi1, as it uses backwards compatible page table
format.
to use the XN bit, subpage AP bits have to be disabled
using the XP bit in CP15 Control Register c1 Bit 23.
-rw-r--r-- | sys/src/9/bcm/archbcm.c | 6 | ||||
-rw-r--r-- | sys/src/9/bcm/archbcm2.c | 6 | ||||
-rw-r--r-- | sys/src/9/bcm/arm.h | 5 | ||||
-rw-r--r-- | sys/src/9/bcm/armv6.s | 2 | ||||
-rw-r--r-- | sys/src/9/bcm/fns.h | 1 | ||||
-rw-r--r-- | sys/src/9/bcm/mkfile | 1 | ||||
-rw-r--r-- | sys/src/9/bcm/mmu.c | 1 |
7 files changed, 5 insertions, 17 deletions
diff --git a/sys/src/9/bcm/archbcm.c b/sys/src/9/bcm/archbcm.c index dd480bc43..d2e138330 100644 --- a/sys/src/9/bcm/archbcm.c +++ b/sys/src/9/bcm/archbcm.c @@ -116,12 +116,6 @@ archbcmlink(void) } int -l2ap(int ap) -{ - return (AP(3, (ap))|AP(2, (ap))|AP(1, (ap))|AP(0, (ap))); -} - -int cmpswap(long *addr, long old, long new) { return cas32(addr, old, new); diff --git a/sys/src/9/bcm/archbcm2.c b/sys/src/9/bcm/archbcm2.c index 05c7e9d55..510abdb8f 100644 --- a/sys/src/9/bcm/archbcm2.c +++ b/sys/src/9/bcm/archbcm2.c @@ -221,12 +221,6 @@ archbcm2link(void) addclock0link(wdogfeed, HZ); } -int -l2ap(int ap) -{ - return (AP(0, (ap))); -} - void cpustart(int cpu) { diff --git a/sys/src/9/bcm/arm.h b/sys/src/9/bcm/arm.h index cc032cccd..3a1f10860 100644 --- a/sys/src/9/bcm/arm.h +++ b/sys/src/9/bcm/arm.h @@ -123,6 +123,7 @@ #define CpCha (1<<17) /* HA: hw access flag enable */ #define CpCdz (1<<19) /* DZ: divide by zero fault enable */ #define CpCfi (1<<21) /* FI: fast intrs */ +#define CpCxp (1<<23) /* XP: subpage AP bits disabled */ #define CpCve (1<<24) /* VE: intr vectors enable */ #define CpCee (1<<25) /* EE: exception endianness */ #define CpCnmfi (1<<27) /* NMFI: non-maskable fast intrs. */ @@ -309,8 +310,8 @@ #define F(v, o, w) (((v) & ((1<<(w))-1))<<(o)) #define AP(n, v) F((v), ((n)*2)+4, 2) -#define L1AP(ap) (AP(3, (ap))) -/* L2AP differs between armv6 and armv7 -- see l2ap in arch*.c */ +#define L1AP(ap) AP(3, (ap)) +#define L2AP(ap) AP(0, (ap)) #define DAC(n, v) F((v), (n)*2, 2) #define HVECTORS 0xffff0000 diff --git a/sys/src/9/bcm/armv6.s b/sys/src/9/bcm/armv6.s index 68714f924..3eae17b83 100644 --- a/sys/src/9/bcm/armv6.s +++ b/sys/src/9/bcm/armv6.s @@ -57,7 +57,7 @@ _ramZ: * enable caches, mmu, and high vectors */ MRC CpSC, 0, R0, C(CpCONTROL), C(0), CpMainctl - ORR $(CpChv|CpCdcache|CpCicache|CpCpredict|CpCmmu), R0 + ORR $(CpCxp|CpChv|CpCdcache|CpCicache|CpCpredict|CpCmmu), R0 MCR CpSC, 0, R0, C(CpCONTROL), C(0), CpMainctl ISB diff --git a/sys/src/9/bcm/fns.h b/sys/src/9/bcm/fns.h index 125dd4f4c..a2b8d16f8 100644 --- a/sys/src/9/bcm/fns.h +++ b/sys/src/9/bcm/fns.h @@ -99,7 +99,6 @@ extern void wdogoff(void); extern void wdogfeed(void); extern void writeconf(void); extern void vtable(void); -extern int l2ap(int); extern uint getcputemp(void); extern char *cputype2name(char *buf, int size); extern uint getboardrev(void); diff --git a/sys/src/9/bcm/mkfile b/sys/src/9/bcm/mkfile index 7ce2c07ff..eb7cad035 100644 --- a/sys/src/9/bcm/mkfile +++ b/sys/src/9/bcm/mkfile @@ -112,6 +112,7 @@ armv7.$O: cache.v7.s main.$O: errstr.h init.h reboot.h devmouse.$O mouse.$O screen.$O: screen.h usbdwc.$O: dwcotg.h ../port/usb.h +arch.$O archbcm.$O archbcm2.$O clock.$O coproc.$O fpiarn.$O mmu.$O trap.$O vfp3.$O: arm.h mem.h init.h:D: ../port/initcode.c init9.s $CC ../port/initcode.c diff --git a/sys/src/9/bcm/mmu.c b/sys/src/9/bcm/mmu.c index 7de489456..864757079 100644 --- a/sys/src/9/bcm/mmu.c +++ b/sys/src/9/bcm/mmu.c @@ -9,7 +9,6 @@ #define FEXT(d, o, w) (((d)>>(o)) & ((1<<(w))-1)) #define L1X(va) FEXT((va), 20, 12) #define L2X(va) FEXT((va), 12, 8) -#define L2AP(ap) l2ap(ap) #define L1ptedramattrs soc.l1ptedramattrs #define L2ptedramattrs soc.l2ptedramattrs #define PTEDRAM (PHYSDRAM|Dom0|L1AP(Krw)|Section|L1ptedramattrs) |