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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [sysdeps/] [_clone.S] - Blame information for rev 523

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

Line No. Rev Author Line
1 199 simons
/* Adapted from glibc */
2
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. */
3
 
4
/* clone is even more special than fork as it mucks with stacks
5
   and invokes a function in the right context after its all over.  */
6
 
7
#include 
8
#include 
9
 
10
/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
11
 
12
        .text
13
ENTRY (_clone)
14
 
15
        /* Sanity check arguments.  */
16
        l.addi  r11,r0,-EINVAL
17
        l.sfeqi r3,0
18
        l.bf    syscall_error
19
        l.nop
20
        l.sfeqi r4,0
21
        l.bf    syscall_error
22
        l.nop
23
 
24
        /* Do the system call */
25
        l.addi  r7,r3,0                 /* save r3 (fn) */
26
        l.addi  r3,r5,0
27
        l.addi  r11,r0,__NR_clone
28
        l.sys   1
29
        l.nop
30
        l.sfeqi r11,0
31
        l.bf    thread_start
32
        l.nop
33 523 simons
        l.jr    r9
34 199 simons
        l.nop
35
 
36
syscall_error:
37 523 simons
        l.jr    r9
38 199 simons
        l.nop
39
 
40
thread_start:
41
        l.addi  r3,r6,0
42
        l.jalr  r7
43
        l.nop
44
        l.addi  r3,r11,0
45
        l.addi  r11,r0,__NR_exit
46
        l.sys   1
47
        l.nop
48
 

powered by: WebSVN 2.1.0

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