diff options
author | peter <peter@FreeBSD.org> | 2003-04-30 19:27:07 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-04-30 19:27:07 +0000 |
commit | 665ad725f77c4c56579e14fe3e8bc3efc359f982 (patch) | |
tree | 572878ee8fc71e8c42b136a7a7f7d5a155324f3e /lib/csu | |
parent | eb8fd40b315819809376614f22aeb2ae611227c3 (diff) | |
download | FreeBSD-src-665ad725f77c4c56579e14fe3e8bc3efc359f982.zip FreeBSD-src-665ad725f77c4c56579e14fe3e8bc3efc359f982.tar.gz |
Update for AMD64. repocopied from i386-elf/crt1.c. Deal with regparm
argument passing rather than stack based args. The kernel passes the
base of the argument/env vector in %rdi (arg1).
Diffstat (limited to 'lib/csu')
-rw-r--r-- | lib/csu/amd64/crt1.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/lib/csu/amd64/crt1.c b/lib/csu/amd64/crt1.c index 15a544c..15aec44 100644 --- a/lib/csu/amd64/crt1.c +++ b/lib/csu/amd64/crt1.c @@ -43,7 +43,7 @@ typedef void (*fptr)(void); extern void _fini(void); extern void _init(void); extern int main(int, char **, char **); -extern void _start(char *, ...); +extern void _start(char **, void (*)(void)); #ifdef GCRT extern void _mcleanup(void); @@ -55,33 +55,18 @@ extern int etext; char **environ; const char *__progname = ""; -static __inline fptr -get_rtld_cleanup(void) -{ - fptr retval; - -#ifdef __GNUC__ - __asm__("movl %%edx,%0" : "=rm"(retval)); -#else - retval = (fptr)0; /* XXXX Fix this for other compilers */ -#endif - return(retval); -} - /* The entry function. */ void -_start(char *ap, ...) +_start(char **ap, void (*cleanup)(void)) { - fptr cleanup; int argc; char **argv; char **env; const char *s; - cleanup = get_rtld_cleanup(); - argv = ≈ - argc = *(long *)(void *)(argv - 1); - env = argv + argc + 1; + argc = *(long *)(void *)ap; + argv = ap + 1; + env = ap + 2 + argc; environ = env; if (argc > 0 && argv[0] != NULL) { __progname = argv[0]; |