1 /* Copyright (C) 1997, 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Richard Henderson (rth@tamu.edu).
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
20 /* clone() is even more special than fork() as it mucks with stacks
21 and invokes a function in the right context after its all over. */
23 #include <asm/errno.h>
24 #include <asm/unistd.h>
26 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
31 .type __clone,@function
36 /* sanity check arguments */
38 mov %i0, %l0 /* save fn */
40 mov %i3, %l3 /* save arg */
42 /* Do the system call */
49 brnz,pn %o1, __thread_start
54 #ifndef _LIBC_REENTRANT
57 sethi %hi(_GLOBAL_OFFSET_TABLE_-(99b-.)), %l7
58 1: or %l7, %lo(_GLOBAL_OFFSET_TABLE_-(99b-.)), %l7
62 or %g2, %lo(errno), %g2
67 st %i0, [%g2+%lo(errno)]
76 .size __clone, .-__clone
78 .type __thread_start,@function
80 mov %g0, %fp /* terminate backtrace */
81 sub %sp, 6*8, %sp /* provide arg storage */
86 .size __thread_start, .-__thread_start
88 weak_alias(__clone, clone)