1/* $NetBSD: arcbios_stubs.S,v 1.1 2020/08/14 16:53:06 skrll Exp $ */ 2 3/*- 4 * Copyright (c) 1996 M. Warner Losh. All rights reserved. 5 * Copyright (c) 1996, 1997, 1998 Per Fogelstrom. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of the University nor the names of its contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <machine/asm.h> 33 34/* 35 * ARC Bios trampoline code. 36 * Note we have to save/restore reserved MIPS_CURLWP register. 37 */ 38#define ARC_Call(Name,Offset) \ 39 .text ;\ 40 .ent Name ;\ 41 .align 3 ;\ 42 .set noreorder ;\ 43 .globl Name ;\ 44Name: ;\ 45 subu $29, CALLFRAME_SIZ ;\ 46 sw $31, CALLFRAME_RA($29) ;\ 47 sw $16, CALLFRAME_SP($29) ;\ 48 lw $2, 0x80001020 ;\ 49 lw $2, Offset($2) ;\ 50 jalr $2 ;\ 51 move $16, MIPS_CURLWP ;\ 52 move MIPS_CURLWP, $16 ;\ 53 lw $31, CALLFRAME_RA($29) ;\ 54 lw $16, CALLFRAME_SP($29) ;\ 55 j $31 ;\ 56 addu $29, CALLFRAME_SIZ ;\ 57 .end Name 58 59#define ARC_Call5(Name,Offset) \ 60 .text ;\ 61 .ent #Name ;\ 62 .align 3 ;\ 63 .set noreorder ;\ 64 .globl Name ;\ 65Name: ;\ 66 subu $29, CALLFRAME_SIZ + 4 ;\ 67 sw $31, CALLFRAME_RA + 4($29) ;\ 68 sw $16, CALLFRAME_SP + 4($29) ;\ 69 lw $12, CALLFRAME_SIZ + 4 + 16($29) ;\ 70 sw $12, 16($29) ;\ 71 lw $2, 0x80001020 ;\ 72 lw $2, Offset($2) ;\ 73 jalr $2 ;\ 74 move $16, MIPS_CURLWP ;\ 75 move MIPS_CURLWP, $16 ;\ 76 lw $31, CALLFRAME_RA + 4($29) ;\ 77 lw $16, CALLFRAME_SP + 4($29) ;\ 78 j $31 ;\ 79 addu $29, CALLFRAME_SIZ + 4 ;\ 80 .end Name 81 82ARC_Call(Bios_Load, 0x00); 83ARC_Call5(Bios_Invoke, 0x04); 84ARC_Call(Bios_Execute, 0x08); 85ARC_Call(Bios_Halt, 0x0c); 86ARC_Call(Bios_PowerDown, 0x10); 87ARC_Call(Bios_Restart, 0x14); 88ARC_Call(Bios_Reboot, 0x18); 89ARC_Call(Bios_EnterInteractiveMode, 0x1c); 90ARC_Call(Bios_Unused1, 0x20); /* return_from_main? */ 91ARC_Call(Bios_GetPeer, 0x24); 92ARC_Call(Bios_GetChild, 0x28); 93ARC_Call(Bios_GetParent, 0x2c); 94ARC_Call(Bios_GetConfigurationData, 0x30); 95ARC_Call(Bios_AddChild, 0x34); 96ARC_Call(Bios_DeleteComponent, 0x38); 97ARC_Call(Bios_GetComponent, 0x3c); 98ARC_Call(Bios_SaveConfiguration, 0x40); 99ARC_Call(Bios_GetSystemId, 0x44); 100ARC_Call(Bios_GetMemoryDescriptor, 0x48); 101ARC_Call(Bios_Unused2, 0x4c); /* signal??? */ 102ARC_Call(Bios_GetTime, 0x50); 103ARC_Call(Bios_GetRelativeTime, 0x54); 104ARC_Call(Bios_GetDirectoryEntry, 0x58); 105ARC_Call(Bios_Open, 0x5c); 106ARC_Call(Bios_Close, 0x60); 107ARC_Call(Bios_Read, 0x64); 108ARC_Call(Bios_GetReadStatus, 0x68); 109ARC_Call(Bios_Write, 0x6c); 110ARC_Call(Bios_Seek, 0x70); 111ARC_Call(Bios_Mount, 0x74); 112ARC_Call(Bios_GetEnvironmentVariable, 0x78); 113ARC_Call(Bios_SetEnvironmentVariable, 0x7c); 114ARC_Call(Bios_GetFileInformation, 0x80); 115ARC_Call(Bios_SetFileInformation, 0x84); 116ARC_Call(Bios_FlushAllCaches, 0x88); 117/* note: the followings don't exist on SGI */ 118#ifdef arc 119ARC_Call(Bios_TestUnicodeCharacter, 0x8c); 120ARC_Call(Bios_GetDisplayStatus, 0x90); 121#endif 122 123