Rev 713 | Rev 1079 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 713 | Rev 1065 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | * Copyright (C) 2005 Martin Decky |
2 | * Copyright (C) 2006 Jakub Jermar |
| 3 | * All rights reserved. |
3 | * All rights reserved. |
| 4 | * |
4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
7 | * are met: |
| Line 24... | Line 24... | ||
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
27 | */ |
| 28 | 28 | ||
| - | 29 | #include <thread.h> |
|
| 29 | #include <libc.h> |
30 | #include <libc.h> |
| 30 | #include <unistd.h> |
31 | #include <arch/faddr.h> |
| 31 | 32 | ||
| 32 | void _exit(int status) { |
33 | typedef void (* voidfunc_t)(void); |
| 33 | __SYSCALL0(SYS_CTL); |
- | |
| 34 | } |
- | |
| 35 | 34 | ||
| 36 | void __main(void) { |
35 | int thread_create(void (* function)(void *), void *arg, void *stack, char *name) |
| - | 36 | { |
|
| - | 37 | return __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) FADDR((voidfunc_t) function), (sysarg_t) arg, (sysarg_t) stack, (sysarg_t) name); |
|
| 37 | } |
38 | } |
| 38 | 39 | ||
| 39 | void __exit(void) { |
40 | void thread_exit(int status) |
| 40 | _exit(0); |
41 | { |
| - | 42 | __SYSCALL1(SYS_THREAD_EXIT, (sysarg_t) status); |
|
| 41 | } |
43 | } |
| - | 44 | ||