[libunwind] [libunwind][AArch64] Disable ZA before resuming from unwinding (on Linux) (PR #165451)
Benjamin Maxwell via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 10 02:40:07 PST 2025
================
@@ -1908,25 +1917,43 @@ class _LIBUNWIND_HIDDEN Registers_arm64 {
private:
uint64_t lazyGetVG() const;
+ void zaDisable() const {
+ if (!_misc_registers.__has_sme)
+ return;
+ if (!__libunwind_Registers_arm64_za_disable())
+ _LIBUNWIND_ABORT("SME ZA disable failed");
+ }
+
+ static bool checkHasSME() {
+#if defined(HAVE_SYS_AUXV_H)
+ constexpr int hwcap2_sme = (1 << 23);
+ unsigned long hwcap2 = getauxval(AT_HWCAP2);
+ return (hwcap2 & hwcap2_sme) != 0;
+#endif
+ // TODO: Support other platforms.
+ return false;
+ }
+
struct GPRs {
- uint64_t __x[29]; // x0-x28
- uint64_t __fp; // Frame pointer x29
- uint64_t __lr; // Link register x30
- uint64_t __sp; // Stack pointer x31
- uint64_t __pc; // Program counter
- uint64_t __ra_sign_state; // RA sign state register
+ uint64_t __x[29] = {}; // x0-x28
----------------
MacDue wrote:
It's to remove the constructor that memsets the whole `Registers_arm64` structure to zero, which would overwrite the `checkHasSME()` initialization.
https://github.com/llvm/llvm-project/pull/165451
More information about the cfe-commits
mailing list