1 /* Copyright (C) 2004-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <http://www.gnu.org/licenses/>. */
19 #include <ucontext-offsets.h>
32 /* Compute top of stack, including arguments. */
33 ldq $1, UC_STACK+SS_SP($16)
34 ldq $2, UC_STACK+SS_SIZE($16)
41 /* Copy all parameters. Switch statement header here. */
42 ldah $3, $jumptable($29) !gprelhigh
47 ldl $4, $jumptable($3) !gprellow
64 /* Here we process arguments 7 through N. This is a straight
65 stack-to-stack copy. */
80 /* Here we process arguments 6 through 0. This involves
81 copying into the register save areas of the ucontext. */
85 stq $0, UC_SIGCTX+SC_REGS+21*8($16)
87 stq $0, UC_SIGCTX+SC_FPREGS+21*8($16)
90 stq $0, UC_SIGCTX+SC_REGS+20*8($16)
92 stq $0, UC_SIGCTX+SC_FPREGS+20*8($16)
95 stq $0, UC_SIGCTX+SC_REGS+19*8($16)
97 stq $0, UC_SIGCTX+SC_FPREGS+19*8($16)
100 stq $21, UC_SIGCTX+SC_REGS+18*8($16)
102 stt $f21, UC_SIGCTX+SC_FPREGS+18*8($16)
105 stq $20, UC_SIGCTX+SC_REGS+17*8($16)
107 stt $f20, UC_SIGCTX+SC_FPREGS+17*8($16)
110 stq $19, UC_SIGCTX+SC_REGS+16*8($16)
112 stt $f19, UC_SIGCTX+SC_FPREGS+16*8($16)
115 /* Set up the registers ready to invoke __startcontext.
116 We seed $27 with the target function address, and $9
117 with the link from ucp. */
118 ldah $0, __startcontext($29) !gprelhigh
120 lda $0, __startcontext($0) !gprellow
121 stq $17, UC_SIGCTX+SC_REGS+27*8($16)
122 stq $8, UC_SIGCTX+SC_REGS+30*8($16)
123 stq $0, UC_SIGCTX+SC_PC($16)
124 stq $1, UC_SIGCTX+SC_REGS+9*8($16)
126 /* No return value from makecontext. */
130 weak_alias (__makecontext, makecontext)
132 /* This function is where a new makecontext "thread" begins life.
133 We have already set up $27 for calling the target function, and
134 we've set $9 to the UC_LINK of the parent context.
136 If the function returns, we either jump to the linked context
137 (if non-null) or exit. */
142 .frame $31, 0, $31, 0
151 bsr $26, __setcontext !samegp
153 bsr $26, HIDDEN_JUMPTARGET(exit) !samegp
155 jsr $26, __setcontext
158 jsr $26, HIDDEN_JUMPTARGET(exit)