1 /* Install given context.
2 Copyright (C) 2008-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Helge Deller <deller@gmx.de>, 2008.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <https://www.gnu.org/licenses/>. */
21 #include <libc-symbols.h>
23 #include "ucontext_i.h"
31 .cfi_def_cfa_offset -64
42 /* Set the current signal mask. */
43 /* sigprocmask(SIG_BLOCK, &ucp->uc_sigmask, NULL); */
45 ldo oSIGMASK(%r3), %r25
49 comib,<>,n 0,%ret0,.Lerror
56 /* Get the registers. */
59 /* ldw oR3(%r3), %r3 - used for ucp pointer. */
60 /* ldw oR4(%r3), %r4 - used for original %sp. */
61 /* ldw oR5(%r3), %r5 - used for %dp / %r27. */
62 /* ldw oR6(%r3), %r6 - used for %r19. */
78 /* ldw oR22(%r3), %r22 - dyncall arg. */
87 /* ldw oR31(%r3), %r31 - dyncall scratch register */
89 /* Restore floating-point registers. */
90 ldo oFPREGS31(%r3), %r22
92 fldds,mb -8(%r22), %fr30
93 fldds,mb -8(%r22), %fr29
94 fldds,mb -8(%r22), %fr28
95 fldds,mb -8(%r22), %fr27
96 fldds,mb -8(%r22), %fr26
97 fldds,mb -8(%r22), %fr25
98 fldds,mb -8(%r22), %fr24
99 fldds,mb -8(%r22), %fr23
100 fldds,mb -8(%r22), %fr22
101 fldds,mb -8(%r22), %fr21
102 fldds,mb -8(%r22), %fr20
103 fldds,mb -8(%r22), %fr19
104 fldds,mb -8(%r22), %fr18
105 fldds,mb -8(%r22), %fr17
106 fldds,mb -8(%r22), %fr16
107 fldds,mb -8(%r22), %fr15
108 fldds,mb -8(%r22), %fr14
109 fldds,mb -8(%r22), %fr13
110 fldds,mb -8(%r22), %fr12
111 fldds,mb -8(%r22), %fr11
112 fldds,mb -8(%r22), %fr10
113 fldds,mb -8(%r22), %fr9
114 fldds,mb -8(%r22), %fr8
115 fldds,mb -8(%r22), %fr7
116 fldds,mb -8(%r22), %fr6
117 fldds,mb -8(%r22), %fr5
118 fldds,mb -8(%r22), %fr4
119 fldds,mb -8(%r22), %fr3
120 fldds,mb -8(%r22), %fr2
121 fldds,mb -8(%r22), %fr1
122 fldds,mb -8(%r22), %fr0
124 /* Do not load oSS_SP into %sp. The value of oSS_SP indicates
125 the start of the user allocated stack, but not the sp that
126 should be used by the new context. In fact makecontext
127 will create a frame, and adjust sp as required. We do not
128 support calling getcontext and modifying ss_sp without
129 a call to makecontext to synchronize ss_sp into the machine
132 /* Call external function. */
137 /* We return here. Get new ucp in %r3, reload %sp. */
138 ldw oUC_LINK(%r3), %r3
143 /* Continue until ucp == NULL. */
144 comib,<> 0,%r3,.Lagain
147 /* No further context available. Exit now. */
148 bl HIDDEN_JUMPTARGET(exit), %r2
161 PSEUDO_END(__setcontext)
163 weak_alias(__setcontext, setcontext)