Rev 3022 | Rev 4420 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3022 | Rev 4055 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include <fibril.h> |
46 | #include <fibril.h> |
47 | #include <io/stream.h> |
47 | #include <io/stream.h> |
48 | #include <ipc/ipc.h> |
48 | #include <ipc/ipc.h> |
49 | #include <async.h> |
49 | #include <async.h> |
50 | #include <as.h> |
50 | #include <as.h> |
- | 51 | #include <loader/pcb.h> |
|
51 | 52 | ||
52 | extern char _heap; |
53 | extern char _heap; |
- | 54 | extern int main(int argc, char *argv[]); |
|
- | 55 | ||
- | 56 | int _errno; |
|
53 | 57 | ||
54 | void _exit(int status) |
58 | void _exit(int status) |
55 | { |
59 | { |
56 | thread_exit(status); |
60 | thread_exit(status); |
57 | } |
61 | } |
58 | 62 | ||
59 | void __main(void) |
63 | void __main(void *pcb_ptr) |
60 | { |
64 | { |
61 | fibril_t *f; |
65 | fibril_t *f; |
- | 66 | int argc; |
|
- | 67 | char **argv; |
|
62 | 68 | ||
63 | (void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ); |
69 | (void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ); |
64 | _async_init(); |
70 | _async_init(); |
65 | f = fibril_setup(); |
71 | f = fibril_setup(); |
66 | __tcb_set(f->tcb); |
72 | __tcb_set(f->tcb); |
- | 73 | ||
- | 74 | /* Save the PCB pointer */ |
|
- | 75 | __pcb = (pcb_t *)pcb_ptr; |
|
- | 76 | ||
- | 77 | if (__pcb == NULL) { |
|
- | 78 | argc = 0; |
|
- | 79 | argv = NULL; |
|
- | 80 | } else { |
|
- | 81 | argc = __pcb->argc; |
|
- | 82 | argv = __pcb->argv; |
|
67 | } |
83 | } |
68 | 84 | ||
69 | void __io_init(void) |
- | |
70 | { |
- | |
71 | open_stdin(); |
- | |
72 | open_stdout(); |
85 | main(argc, argv); |
73 | } |
86 | } |
74 | 87 | ||
75 | void __exit(void) |
88 | void __exit(void) |
76 | { |
89 | { |
77 | fibril_teardown(__tcb_get()->fibril_data); |
90 | fibril_teardown(__tcb_get()->fibril_data); |