1 /* Copyright (C) 2004 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <ucontext-offsets.h>
33 /* Compute top of stack, including arguments. */
34 ldq $1, UC_STACK+SS_SP($16)
35 ldq $2, UC_STACK+SS_SIZE($16)
42 /* Copy all parameters. Switch statement header here. */
43 ldah $3, $jumptable($29) !gprelhigh
48 ldl $4, $jumptable($3) !gprellow
65 /* Here we process arguments 7 through N. This is a straight
66 stack-to-stack copy. */
81 /* Here we process arguments 6 through 0. This involves
82 copying into the register save areas of the ucontext. */
86 stq $0, UC_SIGCTX+SC_REGS+21*8($16)
88 stq $0, UC_SIGCTX+SC_FPREGS+21*8($16)
91 stq $0, UC_SIGCTX+SC_REGS+20*8($16)
93 stq $0, UC_SIGCTX+SC_FPREGS+20*8($16)
96 stq $0, UC_SIGCTX+SC_REGS+19*8($16)
98 stq $0, UC_SIGCTX+SC_FPREGS+19*8($16)
101 stq $21, UC_SIGCTX+SC_REGS+18*8($16)
103 stt $f21, UC_SIGCTX+SC_FPREGS+18*8($16)
106 stq $20, UC_SIGCTX+SC_REGS+17*8($16)
108 stt $f20, UC_SIGCTX+SC_FPREGS+17*8($16)
111 stq $19, UC_SIGCTX+SC_REGS+16*8($16)
113 stt $f19, UC_SIGCTX+SC_FPREGS+16*8($16)
116 /* Set up the registers ready to invoke __startcontext.
117 We seed $27 with the target function address, and $9
118 with the link from ucp. */
119 ldah $0, __startcontext($29) !gprelhigh
121 lda $0, __startcontext($0) !gprellow
122 stq $17, UC_SIGCTX+SC_REGS+27*8($16)
123 stq $8, UC_SIGCTX+SC_REGS+30*8($16)
124 stq $0, UC_SIGCTX+SC_PC($16)
125 stq $1, UC_SIGCTX+SC_REGS+9*8($16)
127 /* No return value from makecontext. */
131 weak_alias (__makecontext, makecontext)
133 /* This function is where a new makecontext "thread" begins life.
134 We have already set up $27 for calling the target function, and
135 we've set $9 to the UC_LINK of the parent context.
137 If the function returns, we either jump to the linked context
138 (if non-null) or exit. */
143 .frame $31, 0, $31, 0
152 bsr $26, __setcontext !samegp
154 bsr $26, HIDDEN_JUMPTARGET(exit) !samegp
156 jsr $26, __setcontext
159 jsr $26, HIDDEN_JUMPTARGET(exit)