From ac79ab0b4569975eda83c49e52840a07fddca7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Holz?= Date: Sat, 16 Dec 2023 17:22:28 +0100 Subject: [PATCH] Kernel/riscv64: Specify correct alignment for `FPUState` struct The signal handling code (and possibly other code as well) expects this struct to have an alignment of 16 bytes, as it pushes this struct on the stack. --- Kernel/Arch/riscv64/FPUState.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kernel/Arch/riscv64/FPUState.h b/Kernel/Arch/riscv64/FPUState.h index bae39b1733..a33fd4bbe1 100644 --- a/Kernel/Arch/riscv64/FPUState.h +++ b/Kernel/Arch/riscv64/FPUState.h @@ -13,7 +13,9 @@ VALIDATE_IS_RISCV64() namespace Kernel { -struct FPUState { +// This struct will get pushed on the stack by the signal handling code. +// Therefore, it has to be aligned to a 16-byte boundary. +struct [[gnu::aligned(16)]] FPUState { u64 f[32]; u64 fcsr; };