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 37LEAF_NOPROFILE(rom_halt) 38 addu sp, sp, -16 39 li a0, 8 # RB_HALT 40 sw a0, 0(sp) 41 li a0, SYS_reboot 42 move a1, sp 43 syscall 44 nop 45END(rom_halt) 46 47LEAF_NOPROFILE(rom_open) 48 addu sp, sp, -32 49 sw ra, 28(sp) 50 51 sw a0, 16(sp) 52 sw a1, 20(sp) 53 54 li a0, SYS_open 55 addu a1, sp, 16 56 syscall 57 nop 58 59 lw ra, 28(sp) 60 addu sp, sp, 32 61 j ra 62 nop 63END(rom_open) 64 65LEAF_NOPROFILE(rom_close) 66 addu sp, sp, -32 67 sw ra, 28(sp) 68 69 sw a0, 16(sp) 70 71 li a0, SYS_close 72 addu a1, sp, 16 73 syscall 74 nop 75 76 lw ra, 28(sp) 77 addu sp, sp, 32 78 j ra 79 nop 80END(rom_close) 81 82LEAF_NOPROFILE(rom_read) 83 addu sp, sp, -32 84 sw ra, 28(sp) 85 86 sw a0, 16(sp) 87 sw a1, 20(sp) 88 sw a2, 24(sp) 89 90 li a0, SYS_read 91 addu a1, sp, 16 92 syscall 93 nop 94 95 lw ra, 28(sp) 96 addu sp, sp, 32 97 j ra 98 nop 99END(rom_read) 100 101LEAF_NOPROFILE(rom_write) 102 addu sp, sp, -32 103 sw ra, 28(sp) 104 105 sw a0, 16(sp) 106 sw a1, 20(sp) 107 sw a2, 24(sp) 108 109 li a0, SYS_write 110 addu a1, sp, 16 111 syscall 112 nop 113 114 lw ra, 28(sp) 115 addu sp, sp, 32 116 j ra 117 nop 118END(rom_write) 119 120LEAF_NOPROFILE(rom_lseek) 121 addu sp, sp, -32 122 sw ra, 28(sp) 123 124 sw a0, 16(sp) 125 sw a1, 20(sp) 126 sw a2, 24(sp) 127 128 li a0, SYS_lseek 129 addu a1, sp, 16 130 syscall 131 nop 132 133 lw ra, 28(sp) 134 addu sp, sp, 32 135 j ra 136 nop 137END(rom_lseek) 138 139LEAF_NOPROFILE(rom_ioctl) 140 addu sp, sp, -32 141 sw ra, 28(sp) 142 143 sw a0, 16(sp) 144 sw a1, 20(sp) 145 sw a2, 24(sp) 146 147 li a0, SYS_ioctl 148 addu a1, sp, 16 149 syscall 150 nop 151 152 lw ra, 28(sp) 153 addu sp, sp, 32 154 j ra 155 nop 156END(rom_ioctl) 157