Skip to content

Commit

Permalink
drc: align tcache_default to 64k on arm
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
notaz authored and irixxxx committed Mar 9, 2024
1 parent 8cca318 commit eac7a97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cpu/drc/cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
#include <pico/pico_int.h>
#include "cmn.h"

u8 ALIGNED(4096) tcache_default[DRC_TCACHE_SIZE];
#if defined(__aarch64__) || defined(__VFP_FP__)
// might be running on a 64k-page kernel
#define PICO_PAGE_ALIGN 65536
#else
#define PICO_PAGE_ALIGN 4096
#endif
u8 ALIGNED(PICO_PAGE_ALIGN) tcache_default[DRC_TCACHE_SIZE];
u8 *tcache;

void drc_cmn_init(void)
Expand Down

0 comments on commit eac7a97

Please sign in to comment.