Rev 3424 | Rev 4377 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3424 | Rev 3425 | ||
|---|---|---|---|
| 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[]); |
|
| 53 | 55 | ||
| 54 | void _exit(int status) |
56 | void _exit(int status) |
| 55 | { |
57 | { |
| 56 | thread_exit(status); |
58 | thread_exit(status); |
| 57 | } |
59 | } |
| 58 | 60 | ||
| 59 | void __main(void) |
61 | void __main(void *pcb_ptr) |
| 60 | { |
62 | { |
| 61 | fibril_t *f; |
63 | fibril_t *f; |
| - | 64 | int argc; |
|
| - | 65 | char **argv; |
|
| 62 | 66 | ||
| 63 | (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); |
| 64 | _async_init(); |
68 | _async_init(); |
| 65 | f = fibril_setup(); |
69 | f = fibril_setup(); |
| 66 | __tcb_set(f->tcb); |
70 | __tcb_set(f->tcb); |
| 67 | 71 | ||
| 68 | 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); |
|
| 69 | } |
86 | } |
| 70 | 87 | ||
| 71 | void __exit(void) |
88 | void __exit(void) |
| 72 | { |
89 | { |
| 73 | fibril_teardown(__tcb_get()->fibril_data); |
90 | fibril_teardown(__tcb_get()->fibril_data); |