initial commit
[glibc.git] / sysdeps / unix / sysv / linux / ia64 / __start_context.S
1 /* Copyright (C) 2001-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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 <https://www.gnu.org/licenses/>. */
17
18 #include <sysdep.h>
19 #include <features.h>
20
21 /* When a context set up by __makecontext() is activated, control
22 transfers to __start_context. When we get here:
23
24 b1 = entry point of function to call
25 in0 = address of UCP to resume after function returns
26 in1 = global pointer for __start_context
27 out0 .. outN = arguments for function */
28
29 ENTRY(__start_context)
30 .prologue
31 alloc r2 = ar.pfs, 2, 0, 8, 0
32
33 .save rp, r4 // terminate call chain with a NULL rp
34 mov r4 = r0
35 ;;
36
37 .body
38 br.call.sptk rp = b1
39 1:
40 mov gp = in1 // restore gp
41 cmp.ne p6,p0 = in0, r0 // uc_link != 0 ?
42 ;;
43 (p6) mov out0 = in0
44 (p6) br.call.sptk rp = __setcontext
45 .Lexit:
46 mov out0 = 0
47 br.call.sptk rp = HIDDEN_JUMPTARGET(exit)
48
49 1: br.cond.sptk .Lexit
50 END(__start_context)