1*ce099b40Smartin/* $NetBSD: start64.S,v 1.3 2008/04/28 20:23:34 martin Exp $ */ 28a3d53f3Ssekiya 38a3d53f3Ssekiya/*- 48a3d53f3Ssekiya * Copyright (c) 1999 The NetBSD Foundation, Inc. 58a3d53f3Ssekiya * All rights reserved. 68a3d53f3Ssekiya * 78a3d53f3Ssekiya * This code is derived from software contributed to The NetBSD Foundation 88a3d53f3Ssekiya * by Jonathan Stone, Michael Hitch and Simon Burge. 98a3d53f3Ssekiya * 108a3d53f3Ssekiya * Redistribution and use in source and binary forms, with or without 118a3d53f3Ssekiya * modification, are permitted provided that the following conditions 128a3d53f3Ssekiya * are met: 138a3d53f3Ssekiya * 1. Redistributions of source code must retain the above copyright 148a3d53f3Ssekiya * notice, this list of conditions and the following disclaimer. 158a3d53f3Ssekiya * 2. Redistributions in binary form must reproduce the above copyright 168a3d53f3Ssekiya * notice, this list of conditions and the following disclaimer in the 178a3d53f3Ssekiya * documentation and/or other materials provided with the distribution. 188a3d53f3Ssekiya * 198a3d53f3Ssekiya * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 208a3d53f3Ssekiya * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 218a3d53f3Ssekiya * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 228a3d53f3Ssekiya * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 238a3d53f3Ssekiya * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 248a3d53f3Ssekiya * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 258a3d53f3Ssekiya * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 268a3d53f3Ssekiya * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 278a3d53f3Ssekiya * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 288a3d53f3Ssekiya * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 298a3d53f3Ssekiya * POSSIBILITY OF SUCH DAMAGE. 308a3d53f3Ssekiya */ 318a3d53f3Ssekiya 328a3d53f3Ssekiya/* 338a3d53f3Ssekiya * Copyright (c) 1992, 1993 348a3d53f3Ssekiya * The Regents of the University of California. All rights reserved. 358a3d53f3Ssekiya * 368a3d53f3Ssekiya * This code is derived from software contributed to Berkeley by 378a3d53f3Ssekiya * Ralph Campbell. 388a3d53f3Ssekiya * 398a3d53f3Ssekiya * Redistribution and use in source and binary forms, with or without 408a3d53f3Ssekiya * modification, are permitted provided that the following conditions 418a3d53f3Ssekiya * are met: 428a3d53f3Ssekiya * 1. Redistributions of source code must retain the above copyright 438a3d53f3Ssekiya * notice, this list of conditions and the following disclaimer. 448a3d53f3Ssekiya * 2. Redistributions in binary form must reproduce the above copyright 458a3d53f3Ssekiya * notice, this list of conditions and the following disclaimer in the 468a3d53f3Ssekiya * documentation and/or other materials provided with the distribution. 478a3d53f3Ssekiya * 3. Neither the name of the University nor the names of its contributors 488a3d53f3Ssekiya * may be used to endorse or promote products derived from this software 498a3d53f3Ssekiya * without specific prior written permission. 508a3d53f3Ssekiya * 518a3d53f3Ssekiya * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 528a3d53f3Ssekiya * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 538a3d53f3Ssekiya * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 548a3d53f3Ssekiya * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 558a3d53f3Ssekiya * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 568a3d53f3Ssekiya * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 578a3d53f3Ssekiya * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 588a3d53f3Ssekiya * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 598a3d53f3Ssekiya * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 608a3d53f3Ssekiya * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 618a3d53f3Ssekiya * SUCH DAMAGE. 628a3d53f3Ssekiya * 638a3d53f3Ssekiya * @(#)start.s 8.2 (Berkeley) 1/21/94 648a3d53f3Ssekiya */ 658a3d53f3Ssekiya 668a3d53f3Ssekiya/* 678a3d53f3Ssekiya * start.s - 688a3d53f3Ssekiya * 698a3d53f3Ssekiya * Contains code that is the first executed at boot time. 708a3d53f3Ssekiya * 718a3d53f3Ssekiya * Copyright (C) 1989 Digital Equipment Corporation. 728a3d53f3Ssekiya * Permission to use, copy, modify, and distribute this software and 738a3d53f3Ssekiya * its documentation for any purpose and without fee is hereby granted, 748a3d53f3Ssekiya * provided that the above copyright notice appears in all copies. 758a3d53f3Ssekiya * Digital Equipment Corporation makes no representations about the 768a3d53f3Ssekiya * suitability of this software for any purpose. It is provided "as is" 778a3d53f3Ssekiya * without express or implied warranty. 788a3d53f3Ssekiya * 798a3d53f3Ssekiya * from: Header: /sprite/src/boot/decprom/ds3100.md/RCS/start.s, 808a3d53f3Ssekiya * v 1.1 90/02/16 16:19:39 shirriff Exp SPRITE (DECWRL) 818a3d53f3Ssekiya */ 828a3d53f3Ssekiya 838a3d53f3Ssekiya#include <mips/asm.h> 848a3d53f3Ssekiya#include <mips/cpuregs.h> 858a3d53f3Ssekiya 868a3d53f3Ssekiya# .extern ARCBIOS, 4 878a3d53f3Ssekiya 888a3d53f3Ssekiya .globl start 898a3d53f3Ssekiyastart: 908a3d53f3Ssekiya .set noreorder 918a3d53f3Ssekiya#ifdef __GP_SUPPORT__ 928a3d53f3Ssekiya dla gp, _C_LABEL (_gp) 938a3d53f3Ssekiya#endif 948a3d53f3Ssekiya daddi sp, - (CALLFRAME_SIZ * 2) 958a3d53f3Ssekiya sd ra, CALLFRAME_RA * 2(sp) # Save RA 968a3d53f3Ssekiya sd a0, 0(sp) # save argc 978a3d53f3Ssekiya sd a1, 8(sp) # save argv 988a3d53f3Ssekiya sd a2, 16(sp) # save envp 998a3d53f3Ssekiya dla v0, 0xa800000000001000 # ARCBIOS_SPB 1008a3d53f3Ssekiya dla a0, _C_LABEL (edata) # clear BSS 1018a3d53f3Ssekiya ld v0, 64(v0) # FirmwareVector (64-bit offset) 1028a3d53f3Ssekiya move a1, zero 1038a3d53f3Ssekiya sd v0, _C_LABEL(ARCBIOS) # save ARCBIOS 1048a3d53f3Ssekiya dla a2, _C_LABEL (end) 1058a3d53f3Ssekiya jal _C_LABEL(memset) # memset(edata, 0, end - edata) 1068a3d53f3Ssekiya dsubu a2, a2, a0 1078a3d53f3Ssekiya ld a0, 0(sp) # restore argc 1088a3d53f3Ssekiya ld a1, 8(sp) # restore argv 1098a3d53f3Ssekiya jal _C_LABEL(main) # main(argc, argv) 1108a3d53f3Ssekiya ld a2, 16(sp) # restore envp 1118a3d53f3Ssekiya ld ra, CALLFRAME_RA * 2(sp) # restore RA 1128a3d53f3Ssekiya j ra # return to PROM 1138a3d53f3Ssekiya daddi sp, CALLFRAME_SIZ * 2 # BDslot: adjust stack 1148a3d53f3Ssekiya 1158a3d53f3Ssekiya .globl _rtt 1168a3d53f3Ssekiya_rtt: 1178a3d53f3Ssekiya j ra # XXXX return to PROM? 1188a3d53f3Ssekiya 1198a3d53f3Ssekiya .data 1208a3d53f3Ssekiya .global ARCBIOS 1218a3d53f3SsekiyaARCBIOS: .data 0 122