]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/x86_64/__start_context.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / x86_64 / __start_context.S
CommitLineData
d4697bc9 1/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
c816e074
AJ
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@suse.de>, 2002.
4
5 The GNU C Library is free software; you can redistribute it and/or
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.
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
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
c816e074
AJ
18
19#include <sysdep.h>
20
21/* This is the helper code which gets called if a function which is
22 registered with 'makecontext' returns. In this case we have to
23 install the context listed in the uc_link element of the context
24 'makecontext' manipulated at the time of the 'makecontext' call.
25 If the pointer is NULL the process must terminate. */
26
27
28ENTRY(__start_context)
29 /* This removes the parameters passed to the function given to
30 'makecontext' from the stack. RBX contains the address
31 on the stack pointer for the next context. */
32 movq %rbx, %rsp
33
34 popq %rdi /* This is the next context. */
0e328c85 35 cfi_adjust_cfa_offset(-8)
c816e074
AJ
36 testq %rdi, %rdi
37 je 2f /* If it is zero exit. */
38
39 call JUMPTARGET(__setcontext)
40 /* If this returns (which can happen if the syscall fails) we'll
41 exit the program with the return error value (-1). */
f7db3170 42 movq %rax,%rdi
c816e074 43
f7db3170 442:
ea493b56 45 call HIDDEN_JUMPTARGET(exit)
c816e074
AJ
46 /* The 'exit' call should never return. In case it does cause
47 the process to terminate. */
48 hlt
49END(__start_context)