Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / alpha / rt_sigaction.S
blob2cde160ec37695ca1027ebfa3fcbbfd91f7469fe
1 /* Copyright (C) 1998-2014 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Richard Henderson <rth@cygnus.com>, 1998
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <http://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
21 /* On Alpha we desparately want to avoid having to issue an imb.  Ordinarily
22    the kernel would have to issue one after setting up the signal return
23    stack, but the Linux rt_sigaction syscall is prepared to accept a pointer
24    to the sigreturn syscall, instead of inlining it on the stack.
26    This just about halves signal delivery time.  */
28         .text
30 ENTRY(__syscall_rt_sigaction)
31         cfi_startproc
32         ldgp    gp,0(pv)
33 #ifdef PROF
34         .set noat
35         lda     AT, _mcount
36         jsr     AT, (AT), _mcount
37         .set at
38 #endif
39         .prologue 1
41         beq     a1, 0f
42         ldl     t0, 8(a1)                               # sa_flags
44         ldah    a4, __syscall_sigreturn(gp)             !gprelhigh
45         ldah    t1, __syscall_rt_sigreturn(gp)          !gprelhigh
46         lda     a4, __syscall_sigreturn(a4)             !gprellow
47         lda     t1, __syscall_rt_sigreturn(t1)          !gprellow
48         and     t0, 0x40, t0                            # SA_SIGINFO
49         cmovne  t0, t1, a4
51 0:      ldi     v0, __NR_rt_sigaction
52         callsys
53         bne     a3, SYSCALL_ERROR_LABEL
54         ret
55         cfi_endproc
56 PSEUDO_END(__syscall_rt_sigaction)
58 /* To enable unwinding through the signal frame without special hackery
59    elsewhere, describe the entire struct sigcontext with unwind info.
61    In order to minimize the size of the encoding, we set the CFA to the
62    end of the sigcontext, which makes all of the registers have small
63    negative offsets from that.  */
65         .macro SIGCONTEXT_REGS_I base, from=0
66         cfi_offset (\from, \base + (4 + \from) * 8)
67         .if     30-\from
68         SIGCONTEXT_REGS_I \base, "(\from+1)"
69         .endif
70         .endm
72         .macro SIGCONTEXT_REGS_F base, from=32
73         cfi_offset (\from, \base + (4 + 1 + \from) * 8)
74         .if     62-\from
75         SIGCONTEXT_REGS_F \base, "(\from+1)"
76         .endif
77         .endm
79         .macro SIGCONTEXT_REGS base
80         SIGCONTEXT_REGS_I \base
81         SIGCONTEXT_REGS_F \base
82         cfi_offset (63, \base + (4 + 32 + 1 + 32) * 8)
83         cfi_offset (64, \base + 2 * 8)
84         .endm
86         cfi_startproc
87         cfi_return_column (64)
88         .cfi_signal_frame
89         SIGCONTEXT_REGS -648
90         cfi_def_cfa_offset (648)
92         /* While this frame is marked as a signal frame, that only applies
93            to how this return address is handled for the outer frame.
94            The return address that arrived here, from the inner frame, is
95            not marked as a signal frame and so the unwinder still tries to
96            subtract 1 to examine the presumed call insn.  Thus we must
97            extend the unwind info to a nop before the start.  */
98         nop
99         .align 4
101 __syscall_sigreturn:
102         mov     sp, a0
103         ldi     v0, __NR_sigreturn
104         callsys
105         .size   __syscall_sigreturn, .-__syscall_sigreturn
106         .type   __syscall_sigreturn, @function
108         /* See above wrt including the nop.  */
109         cfi_def_cfa_offset (176 + 648)
110         nop
111         .align 4
113 __syscall_rt_sigreturn:
114         mov     sp,a0
115         ldi     v0,__NR_rt_sigreturn
116         callsys
117         .size   __syscall_rt_sigreturn, .-__syscall_rt_sigreturn
118         .type   __syscall_rt_sigreturn, @function
120         cfi_endproc