From 13f5aa81e39981de28e380753ea89b2b7ef85393 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Sat, 18 Feb 2023 11:08:02 +0100 Subject: [PATCH] Kernel/aarch64: Disable memory access alignment check Even though we currently build all of Userland and the Kernel with the -mstrict-align flag, the compiler will still emit unaligned memory accesses. To work around this, we disable the check for now. See https://github.com/SerenityOS/serenity/issues/17516 for the relevant issue. --- Kernel/Arch/aarch64/Exceptions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Kernel/Arch/aarch64/Exceptions.cpp b/Kernel/Arch/aarch64/Exceptions.cpp index af95df6d85..8b6005fbed 100644 --- a/Kernel/Arch/aarch64/Exceptions.cpp +++ b/Kernel/Arch/aarch64/Exceptions.cpp @@ -74,7 +74,10 @@ static void setup_el1() system_control_register_el1.UMA = 1; // Don't trap access to DAIF (debugging) flags of EFLAGS register system_control_register_el1.SA0 = 1; // Enable stack access alignment check for EL0 system_control_register_el1.SA = 1; // Enable stack access alignment check for EL1 - system_control_register_el1.A = 1; // Enable memory access alignment check + + // FIXME: Enable memory access alignment check when userspace will not execute unaligned memory accesses anymore. + // See: https://github.com/SerenityOS/serenity/issues/17516 + system_control_register_el1.A = 0; // Disable memory access alignment check Aarch64::SCTLR_EL1::write(system_control_register_el1);