xref: /netbsd/sys/arch/newsmips/stand/common/romcalls.S (revision bf9ec67e)
1/*	$NetBSD: romcalls.S,v 1.4 2002/04/13 07:56:03 tsutsui 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	rom_halt
38rom_halt:
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	.globl	rom_lseek
121rom_lseek:
122	addu	sp, sp, -32
123	sw	ra, 28(sp)
124
125	sw	a0, 16(sp)
126	sw	a1, 20(sp)
127	sw	a2, 24(sp)
128
129	li	a0, SYS_lseek
130	addu	a1, sp, 16
131	syscall
132	nop
133
134	lw	ra, 28(sp)
135	addu	sp, sp, 32
136	j	ra
137	nop
138
139	.globl	rom_ioctl
140rom_ioctl:
141	addu	sp, sp, -32
142	sw	ra, 28(sp)
143
144	sw	a0, 16(sp)
145	sw	a1, 20(sp)
146	sw	a2, 24(sp)
147
148	li	a0, SYS_ioctl
149	addu	a1, sp, 16
150	syscall
151	nop
152
153	lw	ra, 28(sp)
154	addu	sp, sp, 32
155	j	ra
156	nop
157