OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [sparc/] [clone.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
2
   This file is part of the GNU C Library.
3
   Contributed by Richard Henderson (rth@tamu.edu).
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
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
18
   02111-1307 USA.  */
19
 
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.  */
22
 
23
#include 
24
#include 
25
 
26
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
27
 
28
        .text
29
        .align  4
30
        .globl  __clone
31
        .type   __clone,@function
32
 
33
__clone:
34
        save    %sp,-96,%sp
35
 
36
        /* sanity check arguments */
37
        tst     %i0
38
        be      .Lerror
39
         orcc   %i1,%g0,%o1
40
        be      .Lerror
41
         mov    %i2,%o0
42
 
43
        /* Do the system call */
44
        set     __NR_clone,%g1
45
        ta      0x10
46
        bcs     .Lerror
47
         tst    %o1
48
        bne     __thread_start
49
         nop
50
        ret
51
         restore %o0,%g0,%o0
52
 
53
.Lerror:
54
        call    __errno_location
55
         or     %g0,EINVAL,%i0
56
        st      %i0,[%o0]
57
        ret
58
         restore %g0,-1,%o0
59
 
60
        .size   __clone, .-__clone
61
 
62
        .type   __thread_start,@function
63
 
64
__thread_start:
65
        call    %i0
66
         mov    %i3,%o0
67
        call    _exit,0
68
         nop
69
 
70
        .size   __thread_start, .-__thread_start
71
 
72
.weak    clone    ;        clone    =   __clone

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.