]>
Commit | Line | Data |
---|---|---|
b168057a | 1 | /* Copyright (C) 2001-2015 Free Software Foundation, Inc. |
816fc1ed UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
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. | |
816fc1ed UD |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
816fc1ed | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
816fc1ed UD |
18 | |
19 | #include <sysdep.h> | |
20 | #include <features.h> | |
21 | ||
22 | #include "ucontext_i.h" | |
23 | ||
2f438e20 SL |
24 | #include <shlib-compat.h> |
25 | ||
816fc1ed UD |
26 | /* __getcontext (const ucontext_t *ucp) |
27 | ||
28 | Saves the machine context in UCP such that when it is activated, | |
58f46c79 | 29 | it appears as if __getcontext() returned again. |
816fc1ed UD |
30 | |
31 | This implementation is intended to be used for *synchronous* context | |
32 | switches only. Therefore, it does not have to save anything | |
33 | other than the PRESERVED state. */ | |
34 | ||
35 | ENTRY(__getcontext) | |
2f438e20 | 36 | lr %r1,%r2 |
816fc1ed | 37 | |
05d138ef | 38 | /* rt_sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask, sigsetsize). */ |
816fc1ed | 39 | la %r2,SIG_BLOCK |
2f438e20 | 40 | slr %r3,%r3 |
c3e94a95 | 41 | la %r4,SC_MASK(%r1) |
2f438e20 | 42 | lhi %r5,_NSIG8 |
816fc1ed UD |
43 | svc SYS_ify(rt_sigprocmask) |
44 | ||
45 | /* Store fpu context. */ | |
c3e94a95 AK |
46 | stfpc SC_FPC(%r1) |
47 | std %f0,SC_FPRS(%r1) | |
48 | std %f1,SC_FPRS+8(%r1) | |
49 | std %f2,SC_FPRS+16(%r1) | |
50 | std %f3,SC_FPRS+24(%r1) | |
51 | std %f4,SC_FPRS+32(%r1) | |
52 | std %f5,SC_FPRS+40(%r1) | |
53 | std %f6,SC_FPRS+48(%r1) | |
54 | std %f7,SC_FPRS+56(%r1) | |
55 | std %f8,SC_FPRS+64(%r1) | |
56 | std %f9,SC_FPRS+72(%r1) | |
57 | std %f10,SC_FPRS+80(%r1) | |
58 | std %f11,SC_FPRS+88(%r1) | |
59 | std %f12,SC_FPRS+96(%r1) | |
60 | std %f13,SC_FPRS+104(%r1) | |
61 | std %f14,SC_FPRS+112(%r1) | |
62 | std %f15,SC_FPRS+120(%r1) | |
816fc1ed | 63 | |
58f46c79 | 64 | /* Set __getcontext return value to 0. */ |
2f438e20 | 65 | slr %r2,%r2 |
05d138ef | 66 | |
8e294940 | 67 | /* Store access registers. */ |
c3e94a95 | 68 | stam %a0,%a15,SC_ACRS(%r1) |
8e294940 | 69 | |
816fc1ed | 70 | /* Store general purpose registers. */ |
2f438e20 | 71 | stm %r0,%r15,SC_GPRS(%r1) |
816fc1ed | 72 | |
58f46c79 | 73 | /* Return. */ |
816fc1ed UD |
74 | br %r14 |
75 | END(__getcontext) | |
76 | ||
1ab18a5b | 77 | weak_alias (__getcontext, getcontext) |
2f438e20 SL |
78 | |
79 | #if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20) | |
80 | /* In glibc release 2.19 a new version of getcontext was introduced, | |
81 | but was reverted before 2.20. Thus both versions are the same function. */ | |
82 | weak_alias (__getcontext, __v1__getcontext) | |
83 | weak_alias (__getcontext, __v2__getcontext) | |
84 | versioned_symbol (libc, __v1__getcontext, getcontext, GLIBC_2_1) | |
85 | compat_symbol (libc, __v2__getcontext, getcontext, GLIBC_2_19) | |
86 | #endif |