A common sequence of instructions is used in several places
in assembly files, so define it in one place as an assembly
macro.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit
b4b713bd8921aff04773557da94fabb5fb9dd705)
ENTRY (__longjmp)
#if IS_IN(libc)
- /* Disable ZA state of SME in libc.a and libc.so, but not in ld.so.
- The calling convention of __libc_arm_za_disable allows to do
- this thus allowing to avoid saving to and reading from stack.
- As a result we also don't need to sign the return address and
- check it after returning because it is not stored to stack. */
- mov x13, x30
- cfi_register (x30, x13)
- bl __libc_arm_za_disable
- mov x30, x13
- cfi_register (x13, x30)
+ /* Disable ZA state of SME in libc.a and libc.so, but not in ld.so. */
+ CALL_LIBC_ARM_ZA_DISABLE
#endif
cfi_def_cfa (x0, 0)
1:
#if IS_IN(libc)
- /* Disable ZA state of SME in libc.a and libc.so, but not in ld.so.
- The calling convention of __libc_arm_za_disable allows to do
- this thus allowing to avoid saving to and reading from stack.
- As a result we also don't need to sign the return address and
- check it after returning because it is not stored to stack. */
- mov x13, x30
- cfi_register (x30, x13)
- bl __libc_arm_za_disable
- mov x30, x13
- cfi_register (x13, x30)
+ /* Disable ZA state of SME in libc.a and libc.so, but not in ld.so. */
+ CALL_LIBC_ARM_ZA_DISABLE
#endif
stp x19, x20, [x0, #JB_X19<<3]
b C_SYMBOL_NAME (__syscall_error)
1:
/* Clear ZA state of SME. */
- /* The calling convention of __libc_arm_za_disable allows to do
- this thus allowing to avoid saving to and reading from stack.
- As a result we also don't need to sign the return address and
- check it after returning because it is not stored to stack. */
- mov x13, x30
- cfi_register (x30, x13)
- bl __libc_arm_za_disable
- mov x30, x13
- cfi_register (x13, x30)
+ CALL_LIBC_ARM_ZA_DISABLE
/* Restore the general purpose registers. */
mov x0, x9
cfi_def_cfa (x0, 0)
mov x8, SYS_ify (syscall_name); \
svc 0
+/* Clear ZA state of SME (ASM version). */
+/* The __libc_arm_za_disable function has special calling convention
+ that allows to call it without stack manipulation and preserving
+ most of the registers. */
+ .macro CALL_LIBC_ARM_ZA_DISABLE
+ mov x13, x30
+ .cfi_register x30, x13
+ bl __libc_arm_za_disable
+ mov x30, x13
+ .cfi_register x13, x30
+ .endm
+
#else /* not __ASSEMBLER__ */
# define VDSO_NAME "LINUX_2.6.39"