summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/mips/crt0.S
blob: 47d7d8fd2bb76c5ce4b3577a5826ef262d553aa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)