Update copyright notices with scripts/update-copyrights.
[glibc.git] / ports / sysdeps / unix / sysv / linux / alpha / rt_sigaction.S
blob3d291fd0b4ba253cccd00b8d7900707737ccf759
1 /* Copyright (C) 1998-2013 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         .align  4
88         cfi_startproc
89         cfi_return_column (64)
90         .cfi_signal_frame
91         SIGCONTEXT_REGS -648
93         cfi_def_cfa_offset (648)
94 __syscall_sigreturn:
95         mov     sp, a0
96         ldi     v0, __NR_sigreturn
97         callsys
98         .size   __syscall_sigreturn, .-__syscall_sigreturn
99         .type   __syscall_sigreturn, @function
101         .align 4
102         cfi_def_cfa_offset (176 + 648)
103 __syscall_rt_sigreturn:
104         mov     sp,a0
105         ldi     v0,__NR_rt_sigreturn
106         callsys
107         .size   __syscall_rt_sigreturn, .-__syscall_rt_sigreturn
108         .type   __syscall_rt_sigreturn, @function
110         cfi_endproc