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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [sh/] [vfork.S] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
2
   Copyright (C) 2001 Hewlett-Packard Australia
3
 
4
 This program is free software; you can redistribute it and/or modify it under
5
 the terms of the GNU Library General Public License as published by the Free
6
 Software Foundation; either version 2 of the License, or (at your option) any
7
 later version.
8
 
9
 This program is distributed in the hope that it will be useful, but WITHOUT
10
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
12
 details.
13
 
14
 You should have received a copy of the GNU Library General Public License
15
 along with this program; if not, write to the Free Software Foundation, Inc.,
16
 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
 
18
 Derived in part from the Linux-8086 C library, the GNU C Library, and several
19
 other sundry sources.  Files within this library are copyright by their
20
 respective copyright holders.
21
*/
22
 
23
#include 
24
#define _SYSCALL_H
25
#include 
26
#define _ERRNO_H        1
27
#include 
28
 
29
/* Clone the calling process, but without copying the whole address space.
30
   The calling process is suspended until the new process exits or is
31
   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
32
   and the process ID of the new process to the old process.  */
33
 
34
.text
35
.align 4
36
.type   __vfork,@function
37
.globl  __vfork;
38
__vfork:
39
        mov.w   .L2, r3
40
        trapa   #0x10
41
        mov     r0, r1
42
#ifdef __sh2__
43
// 12 arithmetic shifts for the crappy sh2, because shad doesn't exist!
44
        shar    r1
45
        shar    r1
46
        shar    r1
47
        shar    r1
48
        shar    r1
49
        shar    r1
50
        shar    r1
51
        shar    r1
52
        shar    r1
53
        shar    r1
54
        shar    r1
55
        shar    r1
56
#else
57
        mov     #-12, r2
58
        shad    r2, r1
59
#endif
60
 
61
        not     r1, r1                  // r1=0 means r0 = -1 to -4095
62
        tst     r1, r1                  // i.e. error in linux
63
        bf      2f
64
        mov.w   .L1, r1
65
        cmp/eq  r1, r0
66
        bf/s    __syscall_error
67
         mov    r0, r4
68
 
69
        /* If we don't have vfork, use fork.  */
70
        mov.w   .L3, r3
71
        trapa   #0x10
72
        mov     r0, r1
73
#ifdef __sh2__
74
// 12 arithmetic shifts for the crappy sh2, because shad doesn't exist!
75
        shar    r1
76
        shar    r1
77
        shar    r1
78
        shar    r1
79
        shar    r1
80
        shar    r1
81
        shar    r1
82
        shar    r1
83
        shar    r1
84
        shar    r1
85
        shar    r1
86
        shar    r1
87
#else
88
        mov     #-12, r2
89
        shad    r2, r1
90
#endif
91
 
92
        not     r1, r1                  // r1=0 means r0 = -1 to -4095
93
        tst     r1, r1                  // i.e. error in linux
94
        bt/s    __syscall_error
95
         mov    r0, r4
96
2:
97
        rts
98
         nop
99
 
100
        .align  2
101
.L1:
102
        .word   -ENOSYS
103
.L2:
104
        .word   __NR_vfork
105
.L3:
106
        .word   __NR_fork
107
        .size   __vfork, .-__vfork
108
.weak   vfork
109
        vfork =  __vfork
110
 
111
#include "syscall_error.S"
112
 

powered by: WebSVN 2.1.0

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