summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/mips/crt0.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/mips/crt0.S')
-rw-r--r--usr/klibc/arch/mips/crt0.S22
1 files changed, 22 insertions, 0 deletions
diff --git a/usr/klibc/arch/mips/crt0.S b/usr/klibc/arch/mips/crt0.S
new file mode 100644
index 0000000..47d7d8f
--- /dev/null
+++ b/usr/klibc/arch/mips/crt0.S
@@ -0,0 +1,22 @@
+#
+# arch/mips/crt0.S
+#
+# Does arch-specific initialization and invokes __libc_init
+# with the appropriate arguments.
+#
+# See __static_init.c or __shared_init.c for the expected
+# arguments.
+#
+
+#include <machine/asm.h>
+
+NESTED(__start, 0, ra)
+ move a0, sp # Pointer to ELF entry structure
+ move a1, v0 # Kernel-provided atexit() pointer
+ and sp, -8 # Align stack to 8 bytes
+ subu sp, 16 # Allocate 16 bytes for function call
+
+ jal __libc_init
+ teq zero, zero # Crash if we return
+
+ END(__start)