xref: /netbsd-src/sys/arch/newsmips/stand/common/romcalls.S (revision 8a8f936f250a330d54f8a24ed0e92aadf9743a7b)
1/*	$NetBSD: romcalls.S,v 1.2 1999/12/17 07:33:20 tsubai Exp $	*/
2
3/*-
4 * Copyright (C) 1999 Tsubai Masanari.  All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 *    derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <mips/asm.h>
30#include <mips/cpuregs.h>
31#include <machine/romcall.h>
32
33	.text
34	.align	2
35	.set	noreorder
36
37	.globl	halt
38halt:
39	addu	sp, sp, -16
40	li	a0, 8		# RB_HALT
41	sw	a0, 0(sp)
42	li	a0, SYS_reboot
43	move	a1, sp
44	syscall
45	nop
46
47	.globl	rom_open
48rom_open:
49	addu	sp, sp, -32
50	sw	ra, 28(sp)
51
52	sw	a0, 16(sp)
53	sw	a1, 20(sp)
54
55	li	a0, SYS_open
56	addu	a1, sp, 16
57	syscall
58	nop
59
60	lw	ra, 28(sp)
61	addu	sp, sp, 32
62	j	ra
63	nop
64
65	.globl	rom_close
66rom_close:
67	addu	sp, sp, -32
68	sw	ra, 28(sp)
69
70	sw	a0, 16(sp)
71
72	li	a0, SYS_close
73	addu	a1, sp, 16
74	syscall
75	nop
76
77	lw	ra, 28(sp)
78	addu	sp, sp, 32
79	j	ra
80	nop
81
82	.globl	rom_read
83rom_read:
84	addu	sp, sp, -32
85	sw	ra, 28(sp)
86
87	sw	a0, 16(sp)
88	sw	a1, 20(sp)
89	sw	a2, 24(sp)
90
91	li	a0, SYS_read
92	addu	a1, sp, 16
93	syscall
94	nop
95
96	lw	ra, 28(sp)
97	addu	sp, sp, 32
98	j	ra
99	nop
100
101	.globl	rom_write
102rom_write:
103	addu	sp, sp, -32
104	sw	ra, 28(sp)
105
106	sw	a0, 16(sp)
107	sw	a1, 20(sp)
108	sw	a2, 24(sp)
109
110	li	a0, SYS_write
111	addu	a1, sp, 16
112	syscall
113	nop
114
115	lw	ra, 28(sp)
116	addu	sp, sp, 32
117	j	ra
118	nop
119
120
121	.globl	rom_lseek
122rom_lseek:
123	addu	sp, sp, -32
124	sw	ra, 28(sp)
125
126	sw	a0, 16(sp)
127	sw	a1, 20(sp)
128	sw	a2, 24(sp)
129
130	li	a0, SYS_lseek
131	addu	a1, sp, 16
132	syscall
133	nop
134
135	lw	ra, 28(sp)
136	addu	sp, sp, 32
137	j	ra
138	nop
139