xref: /original-bsd/lib/csu/mips/crt0.s (revision 860e07fc)
1/*
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Ralph Campbell.
7 *
8 * %sccs.include.redist.c%
9 *
10 *	@(#)crt0.s	5.3 (Berkeley) 07/27/92
11 */
12
13#include <machine/regdef.h>
14#include <machine/machAsmDefs.h>
15
16	.comm	environ, 4
17
18NON_LEAF(__start, 24, ra)
19	li	v0, 45		# illegal ULTRIX system call to switch to BSD
20	syscall			#   system call numbers.
21	lw	a0, 0(sp)	# get argc from stack
22	la	gp, _gp		# init gp pointer
23	addu	a1, sp, 4	# get pointer to argv
24	addu	a2, a1, 4	# skip null pointer on stack
25	sll	v0, a0, 2	# add number of argv pointers
26	addu	a2, a2, v0	# final pointer to environment list
27	sw	a2, environ	# save environment pointer
28	subu	sp, sp, 24	# allocate standard frame
29	.mask	0x80000000, -4
30	sw	zero, 20(sp)	# clear return address for debugging
31	jal	main		# v0 = main(argc, argv, env);
32	move	a0, v0
33	jal	exit		# exit(v0);
34	break	0
35END(__start)
36
37LEAF(moncontrol)
38	j	ra
39END(moncontrol)
40
41LEAF(_mcount)
42	j	ra
43END(_mcount)
44