summaryrefslogtreecommitdiff
path: root/sys/arch/loongson/stand/boot/start.S
blob: b6023e2bea57248850931c60d145185f39cf6b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*	$OpenBSD: start.S,v 1.1 2010/02/14 22:39:33 miod Exp $	*/

/*
 * Copyright (c) 2010 Miodrag Vallat.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <machine/asm.h>
#include <machine/regdef.h>

	.set	noreorder
	.set	mips3

	.data
pmon_ra:
	.dword	0
pmon_sp:
	.dword	0

	.text

	.globl	__start
	.ent	__start, 0
__start:
	LA	t0, __start - FRAMESZ(CF_SZ)
	LA	gp, _gp
	PTR_S	ra, pmon_ra		# save pmon return address
	PTR_S	sp, pmon_sp		# and stack
	move	sp, t0
	jal	pmon_init		# pmon_init(argc, argv, envp, callvec)
	nop
	jal	main
	nop
	/* FALLTHROUGH */
	.end	__start

	.globl	_rtt
	.ent	_rtt,0
_rtt:
	PTR_L	ra, pmon_ra
	PTR_L	sp, pmon_sp
	jr	ra
	nop
	.end	_rtt