aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2021-12-17 17:14:59 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2024-01-02 15:43:30 +0000
commit9d30e5cf9687559d942514c780332d53b0617f0b (patch)
treefeea322faaf19730aedbe8433822fff9fa9677c5 /sysdeps/unix/sysv/linux
parenta7373e457f0b5953d230f7756627036b1711dcc3 (diff)
downloadglibc-9d30e5cf9687559d942514c780332d53b0617f0b.tar
glibc-9d30e5cf9687559d942514c780332d53b0617f0b.tar.gz
glibc-9d30e5cf9687559d942514c780332d53b0617f0b.tar.bz2
glibc-9d30e5cf9687559d942514c780332d53b0617f0b.zip
aarch64: Add setcontext support for SME
For the ZA lazy saving scheme to work, setcontext has to call __libc_arm_za_disable. Also fixes swapcontext which uses setcontext internally. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/setcontext.S19
1 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
index 699c31189f..ba659438c5 100644
--- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
@@ -49,6 +49,25 @@ ENTRY (__setcontext)
cbz x0, 1f
b C_SYMBOL_NAME (__syscall_error)
1:
+ /* Disable ZA of SME. */
+#if HAVE_AARCH64_PAC_RET
+ PACIASP
+ cfi_window_save
+#endif
+ stp x29, x30, [sp, -16]!
+ cfi_adjust_cfa_offset (16)
+ cfi_rel_offset (x29, 0)
+ cfi_rel_offset (x30, 8)
+ mov x29, sp
+ bl __libc_arm_za_disable
+ ldp x29, x30, [sp], 16
+ cfi_adjust_cfa_offset (-16)
+ cfi_restore (x29)
+ cfi_restore (x30)
+#if HAVE_AARCH64_PAC_RET
+ AUTIASP
+ cfi_window_save
+#endif
/* Restore the general purpose registers. */
mov x0, x9
cfi_def_cfa (x0, 0)