From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 2414838582A7; Tue, 2 Jan 2024 17:21:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2414838582A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1704216117; bh=c3TvuTeQuIJOAgyvih0UHEmL6xJzjViFls8w2B+C7ks=; h=From:To:Subject:Date:From; b=HYa24MnMNDJkR6k/zoH66Z/peyLHc52fEBSTa27zpHMYn4dxwt07J3Qyxkg2sa0Vo 9SWTUUpLdJqDumuozR9Pp5/i2ZKxZqfB8nS2hxMxVkAeXfoFhTnL0matOXyYAGHDPF mB9hLx3Ca62iGVKDzbQ+4Ncd+9Gp+Ri0D9Dj/log= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc] aarch64: Add setcontext support for SME X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/master X-Git-Oldrev: a7373e457f0b5953d230f7756627036b1711dcc3 X-Git-Newrev: 9d30e5cf9687559d942514c780332d53b0617f0b Message-Id: <20240102172157.2414838582A7@sourceware.org> Date: Tue, 2 Jan 2024 17:21:56 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9d30e5cf9687559d942514c780332d53b0617f0b commit 9d30e5cf9687559d942514c780332d53b0617f0b Author: Szabolcs Nagy 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 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)