]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / s390 / s390-64 / getcontext.S
CommitLineData
04277e02 1/* Copyright (C) 2001-2019 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 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://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
35ENTRY(__getcontext)
c3e94a95 36 lgr %r1,%r2
816fc1ed 37
05d138ef 38 /* rt_sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask, sigsetsize). */
816fc1ed 39 la %r2,SIG_BLOCK
cec75f99 40 slgr %r3,%r3
c3e94a95
AK
41 la %r4,SC_MASK(%r1)
42 lghi %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. */
cec75f99 65 slgr %r2,%r2
58f46c79 66
8e294940 67 /* Store access registers. */
c3e94a95 68 stam %a0,%a15,SC_ACRS(%r1)
8e294940 69
816fc1ed 70 /* Store general purpose registers. */
c3e94a95 71 stmg %r0,%r15,SC_GPRS(%r1)
816fc1ed 72
58f46c79 73 /* Return. */
816fc1ed
UD
74 br %r14
75END(__getcontext)
76
2f438e20
SL
77#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
78/* In glibc release 2.19 a new version of getcontext was introduced,
79 but was reverted before 2.20. Thus both versions are the same function. */
80weak_alias (__getcontext, __v1__getcontext)
81weak_alias (__getcontext, __v2__getcontext)
82versioned_symbol (libc, __v1__getcontext, getcontext, GLIBC_2_1)
83compat_symbol (libc, __v2__getcontext, getcontext, GLIBC_2_19)
37d13b17
SL
84
85#else
86
87weak_alias (__getcontext, getcontext)
88
89#endif /* !(defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)) */