git: db3a1eec371f - main - Rework the arm64 sigtramp code to be a trampoline

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 07 Mar 2022 11:19:50 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=db3a1eec371f8c2c060805dbe93eaf76aa92c5f8

commit db3a1eec371f8c2c060805dbe93eaf76aa92c5f8
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-12-29 17:40:42 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-03-07 10:03:07 +0000

    Rework the arm64 sigtramp code to be a trampoline
    
    To help with switching to a vdso sigtramp switch to passing through the
    sigcode function when entering a signal. This ensures the return address
    is within the function.
    
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D33690
---
 sys/arm64/arm64/exec_machdep.c | 5 ++---
 sys/arm64/arm64/sigtramp.S     | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c
index b60909c95945..c8e333f330cc 100644
--- a/sys/arm64/arm64/exec_machdep.c
+++ b/sys/arm64/arm64/exec_machdep.c
@@ -624,10 +624,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	tf->tf_x[0] = sig;
 	tf->tf_x[1] = (register_t)&fp->sf_si;
 	tf->tf_x[2] = (register_t)&fp->sf_uc;
-
-	tf->tf_elr = (register_t)catcher;
+	tf->tf_x[8] = (register_t)catcher;
 	tf->tf_sp = (register_t)fp;
-	tf->tf_lr = (register_t)p->p_sysent->sv_sigcode_base;
+	tf->tf_elr = (register_t)p->p_sysent->sv_sigcode_base;
 
 	/* Clear the single step flag while in the signal handler */
 	if ((td->td_pcb->pcb_flags & PCB_SINGLE_STEP) != 0) {
diff --git a/sys/arm64/arm64/sigtramp.S b/sys/arm64/arm64/sigtramp.S
index b06ec6fa109c..a9ad10da766c 100644
--- a/sys/arm64/arm64/sigtramp.S
+++ b/sys/arm64/arm64/sigtramp.S
@@ -31,6 +31,7 @@
 #include <machine/asm.h>
 
 ENTRY(sigcode)
+	blr	x8
 	mov	x0, sp
 	add	x0, x0, #SF_UC