]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/nios2/vfork.S
Inital import
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / nios2 / vfork.S
1 /*
2  * libc/sysdeps/linux/nios2/vfork.S -- `vfork' syscall for linux/nios2
3  *
4  *  Copyright (C) 2004  Microtronix Datacom Ltd
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License.  See the file COPYING.LIB in the main
8  * directory of this archive for more details.
9  * 
10  * Written by Wentao Xu <wentao@microtronix.com>
11  */
12
13 #include <features.h>
14
15 #define _ERRNO_H
16 #include <bits/errno.h>
17 #include <asm/unistd.h>
18
19 #ifndef __NR_vfork
20 #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
21 #endif
22
23 .text
24 .global __vfork
25 .hidden __vfork
26 .type   __vfork,%function
27 .align 4
28 __vfork:
29     movui   r2, TRAP_ID_SYSCALL
30     movui   r3, __NR_vfork
31     trap
32     movi    r8, -4096
33     bltu    r8, r2, fix_errno
34     ret
35 fix_errno:
36     sub     r8, r0, r2
37     
38     addi    sp, sp, -8
39     stw     ra, 4(sp)
40     stw     r8, 0(sp)
41 #ifndef __PIC__
42     call    __errno_location
43 #else
44     
45 #endif
46     ldw     ra, 4(sp)
47     ldw     r8, 0(sp)
48     stw     r8, 0(r2)
49     
50     addi    r2, r0, -1
51     addi  sp, sp, 8
52     ret
53
54 .size __vfork,.-__vfork
55 weak_alias(__vfork,vfork)
56 libc_hidden_weak(vfork)