1 /* $NetBSD: SRT1.c,v 1.7 2008/04/28 20:23:39 martin Exp $ */
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 /* SRT1.c - Stand-alone Run-time startup code, part 1 */
34 #include <sys/types.h>
35 #include <sun68k/mon.h>
42 struct sunromvec
*_romvec
= 0;
43 void *chain_to_func
= 0;
46 * These are the function pointers for sun2 vs sun3 vs sun3x stuff.
48 char * (*dev_mapin_p
)(int, u_long
, int);
49 char * (*dvma_alloc_p
)(int);
50 void (*dvma_free_p
)(char *, int);
51 char * (*dvma_mapin_p
)(char *, int);
52 void (*dvma_mapout_p
)(char *, int);
55 * This is called by SRT0.S
56 * to do final prep for main
65 * Determine sun2 vs sun3 vs sun3x by looking where the
66 * vector base register points. The PROM always
67 * points that somewhere into [MONSTART..MONEND]
68 * which is a different range on each.
72 x
= (int)vbr
& 0xFFF00000;
73 if (x
== SUN3X_MONSTART
)
78 /* Find the PROM vector. */
85 _romvec
= ((struct sunromvec
*) x
);
87 /* Setup trap 14 for use as a breakpoint. */
88 vbr
[32+14] = _romvec
->abortEntry
;
90 /* Initialize sun3 vs sun3x function pointers. */
105 __asm
volatile ("trap #14");
113 * If set, this pointer is jumped-to by exit
114 * after carefully restoring the PROM stack.
116 chain_to_func
= func
;