1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Signal trampolines for 32 bit processes.
5 * Copyright (C) 2006 Randolph Chung <tausq@debian.org>
6 * Copyright (C) 2018-2022 Helge Deller <deller@gmx.de>
7 * Copyright (C) 2022 John David Anglin <dave.anglin@bell.net>
9 #include <asm/unistd.h>
10 #include <linux/linkage.h>
11 #include <generated/asm-offsets.h>
15 /* Gdb expects the trampoline is on the stack and the pc is offset from
16 a 64-byte boundary by 0, 4 or 5 instructions. Since the vdso trampoline
17 is not on the stack, we need a new variant with different offsets and
18 data to tell gdb where to find the signal context on the stack.
20 Here we put the offset to the context data at the start of the trampoline
21 region and offset the first trampoline by 2 instructions. Please do
22 not change the trampoline as the code in gdb depends on the following
23 instruction sequence exactly.
26 .word SIGFRAME_CONTEXT_REGS32
28 /* The nop here is a hack. The dwarf2 unwind routines subtract 1 from
29 the return address to get an address in the middle of the presumed
30 call instruction. Since we don't have a call here, we artifically
31 extend the range covered by the unwind info by adding a nop before
36 .globl __kernel_sigtramp_rt
37 .type __kernel_sigtramp_rt, @function
40 .callinfo FRAME=ASM_SIGFRAME_SIZE32,CALLS,SAVE_RP
44 0: ldi 0, %r25 /* (in_syscall=0) */
45 ldi __NR_rt_sigreturn, %r20
49 1: ldi 1, %r25 /* (in_syscall=1) */
50 ldi __NR_rt_sigreturn, %r20
56 .size __kernel_sigtramp_rt,.-__kernel_sigtramp_rt
59 .section .eh_frame,"a",@progbits
61 /* This is where the mcontext_t struct can be found on the stack. */
62 #define PTREGS SIGFRAME_CONTEXT_REGS32 /* 32-bit process offset is -672 */
64 /* Register REGNO can be found at offset OFS of the mcontext_t structure. */
65 .macro rsave regno,ofs
66 .byte 0x05 /* DW_CFA_offset_extended */
67 .uleb128 \regno; /* regno */
68 .uleb128 \ofs /* factored offset */
72 .long .Lcie_end - .Lcie_start
75 .byte 1 /* Version number */
76 .stringz "zRS" /* NUL-terminated augmentation string */
77 .uleb128 4 /* Code alignment factor */
78 .sleb128 4 /* Data alignment factor */
79 .byte 89 /* Return address register column, iaoq[0] */
80 .uleb128 1 /* Augmentation value length */
81 .byte 0x1b /* DW_EH_PE_pcrel | DW_EH_PE_sdata4. */
82 .byte 0x0f /* DW_CFA_def_cfa_expresion */
83 .uleb128 9f - 1f /* length */
85 .byte 0x8e /* DW_OP_breg30 */
91 .long .Lfde0_end - .Lfde0_start
93 .long .Lfde0_start - .Lcie /* CIE pointer. */
94 .long .Lsigrt_start - . /* PC start, length */
95 .long .Lsigrt_end - .Lsigrt_start
96 .uleb128 0 /* Augmentation */
98 /* General registers */
131 /* Floating-point registers */
192 /* iaoq[0] return address register */