Rev 3168 | Rev 3686 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3168 | Rev 3171 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | #include <async.h> |
49 | #include <async.h> |
50 | #include <as.h> |
50 | #include <as.h> |
51 | #include <loader/pcb.h> |
51 | #include <loader/pcb.h> |
52 | 52 | ||
53 | extern char _heap; |
53 | extern char _heap; |
- | 54 | extern int main(int argc, char *argv[]); |
|
54 | 55 | ||
55 | void _exit(int status) |
56 | void _exit(int status) |
56 | { |
57 | { |
57 | thread_exit(status); |
58 | thread_exit(status); |
58 | } |
59 | } |
59 | 60 | ||
60 | void __main(void *pcb_ptr) |
61 | void __main(void *pcb_ptr) |
61 | { |
62 | { |
62 | fibril_t *f; |
63 | fibril_t *f; |
- | 64 | int argc; |
|
- | 65 | char **argv; |
|
63 | 66 | ||
64 | (void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ); |
67 | (void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ); |
65 | _async_init(); |
68 | _async_init(); |
66 | f = fibril_setup(); |
69 | f = fibril_setup(); |
67 | __tcb_set(f->tcb); |
70 | __tcb_set(f->tcb); |
68 | 71 | ||
69 | open_console(); |
72 | open_console(); |
- | 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; |
|
- | 83 | } |
|
- | 84 | ||
- | 85 | main(argc, argv); |
|
70 | } |
86 | } |
71 | 87 | ||
72 | void __exit(void) |
88 | void __exit(void) |
73 | { |
89 | { |
74 | fibril_teardown(__tcb_get()->fibril_data); |
90 | fibril_teardown(__tcb_get()->fibril_data); |