void _netbsd_init(void) { thestrings.ps_argvstr = (void *)((char *)&myaux - 2); __ps_strings = &thestrings; pthread__stacksize = 2*STACK_SIZE; rump_boot_setsigmodel(RUMP_SIGMODEL_IGNORE); rump_init(); environ = the_env; _lwp_rumpxen_scheduler_init(); runinit(); _libc_init(); /* XXX: we should probably use csu, but this is quicker for now */ __progname = "rumpxenstack"; #ifdef RUMP_SYSPROXY rump_init_server("tcp://0:12345"); #endif /* * give all threads a chance to run, and ensure that the main * thread has gone through a context switch */ sched_yield(); }
void __start(int argc, char **argv, char **envp, void (*cleanup)(void), /* from shared loader */ const Obj_Entry *obj, /* from shared loader */ struct ps_strings *ps_strings) { environ = envp; if ((__progname = argv[0]) != NULL) { /* NULL ptr if argc = 0 */ if ((__progname = _strrchr(__progname, '/')) == NULL) __progname = argv[0]; else __progname++; } if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; #ifdef DYNAMIC if (&rtld_DYNAMIC != NULL) _rtld_setup(cleanup, obj); #endif _libc_init(); #ifdef MCRT0 atexit(_mcleanup); monstartup((u_long)&_eprol, (u_long)&_etext); #endif atexit(_fini); _init(); exit(main(argc, argv, environ)); }
void _start(int argc, char **argv, char **envp, const Obj_Entry *obj, /* from shared loader */ void (*cleanup)(void), /* from shared loader */ struct ps_strings *ps_strings) /* NetBSD extension */ { char *namep; /* * Initialize the Small Data Area registers. * _SDA_BASE is defined in the SVR4 ABI for PPC. * * Do the initialization in a PIC manner. */ __asm( "bcl 20,31,1f;" "1: mflr 11;" "addis 13,11,rtld_SDA_BASE_-1b@ha;" "addi 13,13,rtld_SDA_BASE_-1b@l;" ::: "lr" ); if ((namep = argv[0]) != NULL) { /* NULL ptr if argc = 0 */ if ((__progname = _strrchr(namep, '/')) == NULL) __progname = namep; else __progname++; } environ = envp; if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; #ifdef DYNAMIC if (&rtld_DYNAMIC != NULL) _rtld_setup(cleanup, obj); #endif _libc_init(); #ifdef MCRT0 atexit(_mcleanup); monstartup((u_long)&_eprol, (u_long)&_etext); #endif atexit(_fini); _init(); exit(main(argc, argv, environ)); }
void ___start(char **sp, void (*cleanup)(void), /* from shared loader */ const Obj_Entry *obj, /* from shared loader */ struct ps_strings *ps_strings) { long argc; char **argv, *namep; argc = *(long *)sp; argv = sp + 1; environ = sp + 2 + argc; /* 2: argc + NULL ending argv */ if ((namep = argv[0]) != NULL) { /* NULL ptr if argc = 0 */ if ((__progname = _strrchr(namep, '/')) == NULL) __progname = namep; else __progname++; } if (ps_strings != (struct ps_strings *)0 && ps_strings != (struct ps_strings *)0xbabefacedeadbeef) __ps_strings = ps_strings; #ifdef DYNAMIC if (&rtld_DYNAMIC != NULL) _rtld_setup(cleanup, obj); #endif _libc_init(); #ifdef MCRT0 atexit(_mcleanup); monstartup((u_long)&_eprol, (u_long)&_etext); #endif atexit(_fini); _init(); exit(main(argc, argv, environ)); }