/branches/dynload/uspace/lib/libc/include/loader/pcb.h |
---|
49,6 → 49,11 |
/** Program entry point */ |
entry_point_t entry; |
/** Number of command-line arguments */ |
int argc; |
/** Command-line arguments */ |
char **argv; |
/* |
* ELF-specific data |
*/ |
60,13 → 65,8 |
uintptr_t rtld_bias; |
} pcb_t; |
// FIXME |
#define PCB_ADDRESS 0x6fff0000 |
extern pcb_t *__pcb; |
static inline pcb_t *__pcb_get(void) { |
return (pcb_t *)PCB_ADDRESS; |
} |
#endif |
/** |
/branches/dynload/uspace/lib/libc/generic/libc.c |
---|
51,6 → 51,7 |
#include <loader/pcb.h> |
extern char _heap; |
extern int main(int argc, char *argv[]); |
void _exit(int status) |
{ |
60,6 → 61,8 |
void __main(void *pcb_ptr) |
{ |
fibril_t *f; |
int argc; |
char **argv; |
(void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ); |
_async_init(); |
67,6 → 70,19 |
__tcb_set(f->tcb); |
open_console(); |
/* Save the PCB pointer */ |
__pcb = (pcb_t *)pcb_ptr; |
if (__pcb == NULL) { |
argc = 0; |
argv = NULL; |
} else { |
argc = __pcb->argc; |
argv = __pcb->argv; |
} |
main(argc, argv); |
} |
void __exit(void) |
/branches/dynload/uspace/lib/libc/Makefile |
---|
53,6 → 53,7 |
generic/cap.c \ |
generic/string.c \ |
generic/fibril.c \ |
generic/pcb.c \ |
generic/thread.c \ |
generic/tls.c \ |
generic/task.c \ |
/branches/dynload/uspace/lib/libc/arch/sparc64/src/entry.s |
---|
44,8 → 44,5 |
call __main |
or %l7, %lo(_gp), %l7 |
call main |
nop |
call __exit |
nop |
/branches/dynload/uspace/lib/libc/arch/ia64/src/entry.s |
---|
44,6 → 44,4 |
mov out0 = r2 |
br.call.sptk.many b0 = __main |
0: |
br.call.sptk.many b0 = main |
1: |
br.call.sptk.many b0 = __exit |
/branches/dynload/uspace/lib/libc/arch/arm32/src/entry.s |
---|
41,5 → 41,4 |
mov r0, r1 |
bl __main |
bl main |
bl __exit |
/branches/dynload/uspace/lib/libc/arch/ppc32/src/entry.s |
---|
41,5 → 41,4 |
# Since the first argument is passed in r3, no operation is needed. |
bl __main |
bl main |
bl __exit |
/branches/dynload/uspace/lib/libc/arch/amd64/src/entry.s |
---|
41,5 → 41,4 |
# Pass PCB pointer to __main (no operation) |
call __main |
call main |
call __exit |
/branches/dynload/uspace/lib/libc/arch/ppc64/src/entry.s |
---|
31,7 → 31,6 |
.org 0 |
.globl __entry |
.globl __entry_driver |
## User-space task entry point |
# |
38,11 → 37,4 |
# |
__entry: |
bl __main |
bl __io_init |
bl main |
bl __exit |
__entry_driver: |
bl __main |
bl main |
bl __exit |
/branches/dynload/uspace/lib/libc/arch/mips32/src/entry.s |
---|
56,9 → 56,6 |
jal __main |
nop |
jal main |
nop |
jal __exit |
nop |
.end |
/branches/dynload/uspace/lib/libc/arch/ia32/src/entry.s |
---|
47,5 → 47,4 |
pushl %ebx |
call __main |
call main |
call __exit |
/branches/dynload/uspace/srv/loader/main.c |
---|
131,6 → 131,9 |
// printf("Create PCB\n"); |
elf_create_pcb(&prog_info, &pcb); |
pcb.argc = 0; |
pcb.argv = NULL; |
if (prog_info.interp == NULL) { |
/* Statically linked program */ |
// printf("Run statically linked program\n"); |