public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] aarch64: Add setcontext support for SME
@ 2024-01-02 17:21 Szabolcs Nagy
  0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2024-01-02 17:21 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9d30e5cf9687559d942514c780332d53b0617f0b

commit 9d30e5cf9687559d942514c780332d53b0617f0b
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Fri Dec 17 17:14:59 2021 +0000

    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>

Diff:
---
 sysdeps/unix/sysv/linux/aarch64/setcontext.S | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-02 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 17:21 [glibc] aarch64: Add setcontext support for SME Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).