1/* Copyright (C) 1998-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <sysdep.h>
19
20/* To enable unwinding through the signal frame without special hackery
21 elsewhere, describe the entire struct sigcontext with unwind info.
22
23 In order to minimize the size of the encoding, we set the CFA to the
24 end of the sigcontext, which makes all of the registers have small
25 negative offsets from that. */
26
27 .macro SIGCONTEXT_REGS_I base, from=0
28 cfi_offset (\from, \base + (4 + \from) * 8)
29 .if 30-\from
30 SIGCONTEXT_REGS_I \base, "(\from+1)"
31 .endif
32 .endm
33
34 .macro SIGCONTEXT_REGS_F base, from=32
35 cfi_offset (\from, \base + (4 + 1 + \from) * 8)
36 .if 62-\from
37 SIGCONTEXT_REGS_F \base, "(\from+1)"
38 .endif
39 .endm
40
41 .macro SIGCONTEXT_REGS base
42 SIGCONTEXT_REGS_I \base
43 SIGCONTEXT_REGS_F \base
44 cfi_offset (63, \base + (4 + 32 + 1 + 32) * 8)
45 cfi_offset (64, \base + 2 * 8)
46 .endm
47
48 cfi_startproc
49 cfi_return_column (64)
50 .cfi_signal_frame
51 SIGCONTEXT_REGS -648
52 cfi_def_cfa_offset (648)
53
54 /* While this frame is marked as a signal frame, that only applies
55 to how this return address is handled for the outer frame.
56 The return address that arrived here, from the inner frame, is
57 not marked as a signal frame and so the unwinder still tries to
58 subtract 1 to examine the presumed call insn. Thus we must
59 extend the unwind info to a nop before the start. */
60 nop
61 .align 4
62
63__syscall_sigreturn:
64 mov sp, a0
65 ldi v0, __NR_sigreturn
66 callsys
67 .size __syscall_sigreturn, .-__syscall_sigreturn
68 .type __syscall_sigreturn, @function
69 .global __syscall_sigreturn;
70 .hidden __syscall_sigreturn;
71
72 /* See above wrt including the nop. */
73 cfi_def_cfa_offset (176 + 648)
74 nop
75 .align 4
76
77__syscall_rt_sigreturn:
78 mov sp,a0
79 ldi v0,__NR_rt_sigreturn
80 callsys
81 .size __syscall_rt_sigreturn, .-__syscall_rt_sigreturn
82 .type __syscall_rt_sigreturn, @function
83 .global __syscall_rt_sigreturn;
84 .hidden __syscall_rt_sigreturn;
85
86 cfi_endproc
87

source code of glibc/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S