[libunwind] [libunwind] Call `__arm_za_disable` before entering EH (PR #160905)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 26 08:44:51 PDT 2025
================
@@ -198,6 +202,29 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_obj=%p)",
(void *)exception_object);
+#if defined(__aarch64__)
+ // The platform must ensure that all the following conditions are true on
+ // entry to EH:
+ //
+ // - PSTATE.SM is 0.
+ // - PSTATE.ZA is 0.
+ // - TPIDR2_EL0 is null.
+ //
+ // The first point is ensured by routines for throwing exceptions having a
+ // non-streaming interface. TPIDR2_EL0 is set to null and ZA disabled by
+ // calling __arm_za_disable.
+ //
+ // See:
+ // https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#exceptions
+ if (__arm_za_disable) {
+ // FIXME: Is SME is available and `__arm_za_disable` is not, this should
+ // abort.
----------------
sdesmalen-arm wrote:
nit: s/Is/If/
nit: this belongs in the `else` branch?
https://github.com/llvm/llvm-project/pull/160905
More information about the cfe-commits
mailing list