From 55e8ffd122a73164c64bd1356be02949a54858c0 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 15 May 2023 20:29:59 +0200 Subject: [PATCH] Kernel/aarch64: Make REGISTER_STATE_SIZE a multiple of 16 bytes This ensure that the stack pointer also stays 16 byte aligned. This fixes a baremetal issue when getting an exception. --- Kernel/Arch/aarch64/vector_table.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Kernel/Arch/aarch64/vector_table.S b/Kernel/Arch/aarch64/vector_table.S index b284962bc7..ceaa0213aa 100644 --- a/Kernel/Arch/aarch64/vector_table.S +++ b/Kernel/Arch/aarch64/vector_table.S @@ -6,7 +6,13 @@ .section .text.vector_table -#define REGISTER_STATE_SIZE 264 +// NOTE: This size must be a multiple of 16 bytes, to ensure that the stack pointer +// stays 16 byte aligned. +#define REGISTER_STATE_SIZE 272 +#if REGISTER_STATE_SIZE % 16 != 0 +# error "REGISTER_STATE_SIZE is not a multiple of 16 bytes!" +#endif + #define SPSR_EL1_SLOT (31 * 8) #define ELR_EL1_SLOT (32 * 8) #define SP_EL0_SLOT (33 * 8)