forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/powerpc/kernel/vdso64/sigtramp.S
....@@ -1,15 +1,12 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Signal trampoline for 64 bits processes in a ppc64 kernel for
34 * use in the vDSO
45 *
56 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
67 * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp.
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * as published by the Free Software Foundation; either version
11
- * 2 of the License, or (at your option) any later version.
128 */
9
+#include <asm/cache.h> /* IFETCH_ALIGN_BYTES */
1310 #include <asm/processor.h>
1411 #include <asm/ppc_asm.h>
1512 #include <asm/unistd.h>
....@@ -18,21 +15,26 @@
1815
1916 .text
2017
21
-/* The nop here is a hack. The dwarf2 unwind routines subtract 1 from
22
- the return address to get an address in the middle of the presumed
23
- call instruction. Since we don't have a call here, we artificially
24
- extend the range covered by the unwind info by padding before the
25
- real start. */
26
- nop
18
+/*
19
+ * __kernel_start_sigtramp_rt64 and __kernel_sigtramp_rt64 together
20
+ * are one function split in two parts. The kernel jumps to the former
21
+ * and the signal handler indirectly (by blr) returns to the latter.
22
+ * __kernel_sigtramp_rt64 needs to point to the return address so
23
+ * glibc can correctly identify the trampoline stack frame.
24
+ */
2725 .balign 8
26
+ .balign IFETCH_ALIGN_BYTES
27
+V_FUNCTION_BEGIN(__kernel_start_sigtramp_rt64)
28
+.Lsigrt_start:
29
+ bctrl /* call the handler */
30
+V_FUNCTION_END(__kernel_start_sigtramp_rt64)
2831 V_FUNCTION_BEGIN(__kernel_sigtramp_rt64)
29
-.Lsigrt_start = . - 4
3032 addi r1, r1, __SIGNAL_FRAMESIZE
3133 li r0,__NR_rt_sigreturn
3234 sc
3335 .Lsigrt_end:
3436 V_FUNCTION_END(__kernel_sigtramp_rt64)
35
-/* The ".balign 8" above and the following zeros mimic the old stack
37
+/* The .balign 8 above and the following zeros mimic the old stack
3638 trampoline layout. The last magic value is the ucontext pointer,
3739 chosen in such a way that older libgcc unwind code returns a zero
3840 for a sigcontext pointer. */