]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/tile/getcontext.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / tile / getcontext.S
CommitLineData
b168057a 1/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
63d143a2
CM
2 This file is part of the GNU C Library.
3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
4
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.
9
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.
14
15 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
63d143a2
CM
18
19#include <sysdep.h>
20#include <arch/abi.h>
21
22#include "ucontext_i.h"
23
24/* int getcontext (ucontext_t *ucp) */
25
26 .text
27ENTRY (__getcontext)
28 FEEDBACK_ENTER(__getcontext)
29
30 /* Save the callee-saved GPRs. There's no need to save the
31 caller-saved GPRs since the eventual setcontext() or
32 swapcontext() will assume those registers are all dead.
33 Save value "1" to uc_flags to later recognize getcontext(). */
34 { movei r11, 1; ADDI_PTR r10, r0, UC_FLAGS_OFFSET }
0adc5f38 35 { ST_PTR r10, r11; addli r10, r0, UC_REG(30) }
63d143a2
CM
36 { ST r10, r30; ADDI_PTR r10, r10, REGSIZE }
37 { ST r10, r31; ADDI_PTR r10, r10, REGSIZE }
38 { ST r10, r32; ADDI_PTR r10, r10, REGSIZE }
39 { ST r10, r33; ADDI_PTR r10, r10, REGSIZE }
40 { ST r10, r34; ADDI_PTR r10, r10, REGSIZE }
41 { ST r10, r35; ADDI_PTR r10, r10, REGSIZE }
42 { ST r10, r36; ADDI_PTR r10, r10, REGSIZE }
43 { ST r10, r37; ADDI_PTR r10, r10, REGSIZE }
44 { ST r10, r38; ADDI_PTR r10, r10, REGSIZE }
45 { ST r10, r39; ADDI_PTR r10, r10, REGSIZE }
46 { ST r10, r40; ADDI_PTR r10, r10, REGSIZE }
47 { ST r10, r41; ADDI_PTR r10, r10, REGSIZE }
48 { ST r10, r42; ADDI_PTR r10, r10, REGSIZE }
49 { ST r10, r43; ADDI_PTR r10, r10, REGSIZE }
50 { ST r10, r44; ADDI_PTR r10, r10, REGSIZE }
51 { ST r10, r45; ADDI_PTR r10, r10, REGSIZE }
52 { ST r10, r46; ADDI_PTR r10, r10, REGSIZE }
53 { ST r10, r47; ADDI_PTR r10, r10, REGSIZE }
54 { ST r10, r48; ADDI_PTR r10, r10, REGSIZE }
55 { ST r10, r49; ADDI_PTR r10, r10, REGSIZE }
56 { ST r10, r50; ADDI_PTR r10, r10, REGSIZE }
57 { ST r10, r51; ADDI_PTR r10, r10, REGSIZE }
58 { ST r10, r52; ADDI_PTR r10, r10, REGSIZE }
59 { ST r10, tp; ADDI_PTR r10, r10, REGSIZE }
60 { ST r10, sp; ADDI_PTR r10, r10, REGSIZE }
61 { ST r10, lr; ADDI_PTR r10, r10, REGSIZE }
62 lnk r11 /* Point PC at the "jrp lr" instruction. */
63 addli r11, r11, .Lreturn - .
64 { ST r10, r11; ADDI_PTR r10, r10, REGSIZE }
65 mfspr r11, INTERRUPT_CRITICAL_SECTION
66 {
67 ST r10, r11
68 movei r1, 0
69 }
70
71 /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG / 8) */
72 {
73 movei r3, _NSIG / 8
74 addli r2, r0, UC_SIGMASK_OFFSET
75 }
76 {
77 movei r0, SIG_BLOCK
78 moveli TREG_SYSCALL_NR_NAME, __NR_rt_sigprocmask
79 }
80 swint1
81 BNEZ r1, .Lsyscall_error
82
83.Lreturn:
84 {
85 movei r0, 0
86 jrp lr
87 }
88
89.Lsyscall_error:
90 j SYSCALL_ERROR_NAME
91
92END (__getcontext)
93.hidden __getcontext
94
95weak_alias (__getcontext, getcontext)