git: 20daa209e449 - stable/13 - linux: implement set_upcall on aarch64

From: Edward Tomasz Napierala <trasz_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 15:53:50 UTC
The branch stable/13 has been updated by trasz:

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

commit 20daa209e4499bb0ba84f75d6fa8dc709fe14624
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-06-15 12:01:02 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2022-02-14 00:08:11 +0000

    linux: implement set_upcall on aarch64
    
    This fixes "git diff" (git-1:2.25.1-1ubuntu3).
    
    Sponsored By:   EPSRC
    Differential Revision:  https://reviews.freebsd.org/D30509
    
    (cherry picked from commit e505c3066bbdb96dd28ff4634a315346490b9b33)
---
 sys/arm64/linux/linux_machdep.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c
index 711ccb4fd63d..80597a2922a7 100644
--- a/sys/arm64/linux/linux_machdep.c
+++ b/sys/arm64/linux/linux_machdep.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
 
 /* DTrace probes */
-LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall, todo);
 LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo);
 LIN_SDT_PROBE_DEFINE0(machdep, linux_rt_sigsuspend, todo);
 LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo);
@@ -84,13 +83,19 @@ linux_execve(struct thread *td, struct linux_execve_args *uap)
 	return (error);
 }
 
-/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall */
 int
 linux_set_upcall(struct thread *td, register_t stack)
 {
 
-	LIN_SDT_PROBE0(machdep, linux_set_upcall, todo);
-	return (EDOOFUS);
+	if (stack)
+		td->td_frame->tf_sp = stack;
+
+	/*
+	 * The newly created Linux thread returns
+	 * to the user space by the same path that a parent does.
+	 */
+	td->td_frame->tf_x[0] = 0;
+	return (0);
 }
 
 /* LINUXTODO: deduplicate arm64 linux_mmap2 */