1 /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@suse.de>, 2002.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 /* This is the helper code which gets called if a function which is
23 registered with 'makecontext' returns. In this case we have to
24 install the context listed in the uc_link element of the context
25 'makecontext' manipulated at the time of the 'makecontext' call.
26 If the pointer is NULL the process must terminate. */
29 ENTRY(__start_context)
30 /* This removes the parameters passed to the function given to
31 'makecontext' from the stack. RBX contains the address
32 on the stack pointer for the next context. */
35 popq %rdi /* This is the next context. */
36 cfi_adjust_cfa_offset(-8)
38 je 2f /* If it is zero exit. */
40 call JUMPTARGET(__setcontext)
41 /* If this returns (which can happen if the syscall fails) we'll
42 exit the program with the return error value (-1). */
45 call HIDDEN_JUMPTARGET(exit)
46 /* The 'exit' call should never return. In case it does cause
47 the process to terminate. */