diff options
author | H. Peter Anvin <hpa@zytor.com> | 2002-08-12 05:50:49 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2002-08-12 05:50:49 +0000 |
commit | 2435704db44896a8b4c8f8fec419e43b334f01f5 (patch) | |
tree | b8da2d5c16448e8a8fc75b4a6351a6fd9e5e876c | |
parent | 1322aeac5fa07d2219e3ca5b0fca834b1ae04620 (diff) | |
download | klibc-2435704db44896a8b4c8f8fec419e43b334f01f5.tar.gz |
README file for portingklibc-0.21
-rw-r--r-- | arch/README | 35 | ||||
-rw-r--r-- | klibc/arch/README | 35 |
2 files changed, 70 insertions, 0 deletions
diff --git a/arch/README b/arch/README new file mode 100644 index 0000000000000..1442c419b9bfa --- /dev/null +++ b/arch/README @@ -0,0 +1,35 @@ +Each architecture needs a crt0.S file. The crt0.S assembly routine +typically corresponds to the following pseudo-C code. In addition, +each architecture needs any support routines that gcc-generated code +expects to find in the system library -- Alpha, for example, needs +divide subroutines. + + +extern char **environ; +extern int main(int, char **, char **); +extern __noreturn exit(int); + +__noreturn _start(void) +{ + intptr_t *argptr = __stack_pointer(); /* Usually -- e.g. SPARC is special */ + int argc; + char **argv, **envp; + +#if STACK_GROWS_UP + argc = (int)*argptr--; + argv = (char **)argptr; + envp = argv-(argc+1); +#else + argc = (int)*argptr++; + argv = (char **)argptr; + envp = argv+(argc+1); +#endif + + environ = envp; + + exit(main(argc, argv, envp)); +} + + + + diff --git a/klibc/arch/README b/klibc/arch/README new file mode 100644 index 0000000000000..1442c419b9bfa --- /dev/null +++ b/klibc/arch/README @@ -0,0 +1,35 @@ +Each architecture needs a crt0.S file. The crt0.S assembly routine +typically corresponds to the following pseudo-C code. In addition, +each architecture needs any support routines that gcc-generated code +expects to find in the system library -- Alpha, for example, needs +divide subroutines. + + +extern char **environ; +extern int main(int, char **, char **); +extern __noreturn exit(int); + +__noreturn _start(void) +{ + intptr_t *argptr = __stack_pointer(); /* Usually -- e.g. SPARC is special */ + int argc; + char **argv, **envp; + +#if STACK_GROWS_UP + argc = (int)*argptr--; + argv = (char **)argptr; + envp = argv-(argc+1); +#else + argc = (int)*argptr++; + argv = (char **)argptr; + envp = argv+(argc+1); +#endif + + environ = envp; + + exit(main(argc, argv, envp)); +} + + + + |