xref: /openbsd/sys/arch/loongson/stand/boot/start.S (revision f6aab3d8)
1/*	$OpenBSD: start.S,v 1.4 2021/02/17 14:42:20 visa Exp $	*/
2
3/*
4 * Copyright (c) 2010 Miodrag Vallat.
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <machine/asm.h>
20#include <machine/regdef.h>
21#include <mips64/mips_cpu.h>
22
23	.set	noreorder
24	.set	mips3
25
26	.data
27pmon_ra:
28	.dword	0
29pmon_sp:
30	.dword	0
31
32	.text
33
34	.globl	__start
35	.ent	__start, 0
36__start:
37	LA	t0, __start - FRAMESZ(CF_SZ)
38	PTR_S	ra, pmon_ra		# save pmon return address
39	PTR_S	sp, pmon_sp		# and stack
40	move	sp, t0
41	jal	pmon_init		# pmon_init(argc, argv, envp, callvec,
42	mfc0	a4, COP_0_PRID		#     prid)
43	jal	pmon_probe_abi
44	nop
45	jal	main
46	nop
47	/* FALLTHROUGH */
48	.end	__start
49
50	.globl	_rtt
51	.ent	_rtt,0
52_rtt:
53	PTR_L	ra, pmon_ra
54	PTR_L	sp, pmon_sp
55	jr	ra
56	nop
57	.end	_rtt
58