summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-27 00:08:15 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-27 00:08:15 +0000
commit4ebeac03600bd0fda495c5c7752ca27dbdc2e8ed (patch)
tree968ad4816ae964363577a9ea06c6ccb3bc019912 /libc/sysdeps/linux
parent13e9f4cfbda8f54eb5f21d2e093d11b2cefad166 (diff)
try at crt1 code by tweaking crt0.c and utilizing the -S output of gcc
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/cris/crt1.S58
1 files changed, 58 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/cris/crt1.S b/libc/sysdeps/linux/cris/crt1.S
new file mode 100644
index 000000000..e0ba8a4dd
--- /dev/null
+++ b/libc/sysdeps/linux/cris/crt1.S
@@ -0,0 +1,58 @@
+/* Startup code compliant to the ELF CRIS ABI */
+
+#include <features.h>
+
+/* The first piece of initialized data. */
+.data
+.global __data_start
+.align 2
+.type __data_start, @object
+.size __data_start, 4
+__data_start:
+ .dword 0
+
+.text
+.align 1
+.global _start
+.type _start,%function
+#if defined(__UCLIBC_CTOR_DTOR__)
+.type _init,%function
+.type _fini,%function
+#else
+.weak _init
+.weak _fini
+#endif
+.type main,%function
+.type __uClibc_main,%function
+
+/*
+ * On the stack we have argc. We can calculate argv/envp
+ * from that and the succeeding stack location, but fix so
+ * we get the right calling convention (regs in r10/r11).
+ *
+ * Please view linux/fs/binfmt_elf.c for a complete
+ * understanding of this.
+ */
+
+/*
+ * Need to call __uClibc_main(main, argc, argv, _init, _fini)
+ */
+
+_start:
+ pop $r10
+ move.d $sp, $r11
+ jump .L1
+
+.L1:
+ Push $srp
+ Subq 4,$sp
+ move.d $r10,$r9
+ move.d $r11,$r12
+ move.d _fini,$r13
+ move.d $r13,[$sp]
+ move.d main,$r10
+ move.d $r9,$r11
+ move.d _init,$r13
+ /* Leave control to the libc */
+ jsr __uClibc_main
+.size _start,.-_start