Skip to content

Commit 9dcb875

Browse files
committed
drc: align tcache_default to 64k on arm
Newer arm64 hw supports 64k pages, and recent Linux distros provide kernel packages like linux-image-generic-64k (can be used on r-pi4 with Ubuntu for example). It affects 32bit mode also, so assume that an arm32 binary compiled for vfp may be used on such kernel. Without this mprotect() fails to set exec permission because of bad alignment.
1 parent 8cca318 commit 9dcb875

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cpu/drc/cmn.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
#include <pico/pico_int.h>
1111
#include "cmn.h"
1212

13-
u8 ALIGNED(4096) tcache_default[DRC_TCACHE_SIZE];
13+
#if defined(__aarch64__) || defined(__VFP_FP__)
14+
// might be running on a 64k-page kernel
15+
#define PICO_PAGE_ALIGN 65536
16+
#else
17+
#define PICO_PAGE_ALIGN 4096
18+
#endif
19+
u8 ALIGNED(PICO_PAGE_ALIGN) tcache_default[DRC_TCACHE_SIZE];
1420
u8 *tcache;
1521

1622
void drc_cmn_init(void)

0 commit comments

Comments
 (0)