1 /* $NetBSD: start.S,v 1.12.36.3 2004/09/21 13:12:02 skrll Exp $ */
4 * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Christopher G. Demetriou
17 * for the NetBSD Project.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * Mach Operating System
35 * Copyright (c) 1992 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
59 #include "include/asm.h"
63 * Entry point for boot/standalone programs.
65 * Unified and Primary Bootstrap arguments:
68 * Secondary Bootstrap arguments:
69 * a0 first free physical page
71 * Standalone program arguments:
73 * a0 first free physical page
74 * a1 page table base register (PTBR)
75 * a2 bootinfo magic number
76 * a3 pointer to the bootinfo structure
77 * a4 bootinfo version number
79 * All bootstrap and standalone programs leave exception and interrupt
80 * handling to the firmware, and run from the firmware-provided stack.
81 * To return to the firmware, these programs simply invoke the 'halt'
84 * Bootstrap programs have to clear their own BSS. Standalone programs
85 * have their BSS cleared by the bootstraps.
88 .set noreorder /* don't reorder instructions */
90 #define ENTRY_FRAME 32
92 NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
97 #if defined(STANDALONE_PROGRAM)
100 * save the arguments, invoke init_prom_calls() to set up console
101 * callbacks and output, then restore the arguments.
108 CALL(init_prom_calls)
115 #else /* defined(STANDALONE_PROGRAM) */
117 #if !defined(PRIMARY_BOOTBLOCK) && !defined(UNIFIED_BOOTBLOCK)
118 lda sp,start /* start stack below text */
119 lda sp,-ENTRY_FRAME(sp)
122 #endif /* !defined(PRIMARY_BOOTBLOCK) && !defined(UNIFIED_BOOTBLOCK) */
128 #if !defined(PRIMARY_BOOTBLOCK) && !defined(UNIFIED_BOOTBLOCK)
130 #endif /* !defined(PRIMARY_BOOTBLOCK) && !defined(UNIFIED_BOOTBLOCK) */
132 #endif /* defined(STANDALONE_PROGRAM) */
134 CALL(main) /* transfer to C */
138 call_pal PAL_halt /* halt if we ever return */