2 * $NetBSD: main.c,v 1.8 2009/01/12 07:42:30 tsutsui Exp $
5 * Copyright (c) 1996,1999 Ignatios Souvatzis
6 * Copyright (c) 1994 Michael L. Hitch
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/cdefs.h>
32 #include <sys/reboot.h>
33 #include <sys/types.h>
35 #include <sys/exec_aout.h>
37 #include <amiga/cfdev.h>
38 #include <amiga/memlist.h>
39 #include <include/cpu.h>
42 #include <lib/libsa/stand.h>
43 #include <lib/libkern/libkern.h>
46 #include "samachdep.h"
49 #define AOUT_LDPGSZ 8192
52 #define DRACOREVISION (*(u_int8_t *)0x02000009)
53 #define DRACOMMUMARGIN 0x200000
54 #define DRACOZ2OFFSET 0x3000000
55 #define DRACOZ2MAX 0x1000000
60 * vers.c (generated by newvers.sh)
62 extern const char bootprog_rev
[];
64 void startit(void *, void *, void *);
68 extern void *ConsoleBase
;
78 extern u_int16_t timelimit
;
82 if (consinit(NULL
)) /* Initialize fresh console */
86 printf("NetBSD/AmigaPPC " NETBSD_VERS
" Primary Bootstrap %s\n", bootprog_rev
);
88 printf("NetBSD/Amiga " NETBSD_VERS
" Primary Bootstrap %s\n", bootprog_rev
);
90 io
= open("/boot.amiga", 0); /* Try /boot.amiga first */
92 io
= open("/boot", 0); /* Fallback to /boot */
94 io
= open("/boot.ami", 0); /* 8.3 name? */
101 /* get size of file? */
104 /* allocate memory for file */
107 printf("Bad size, using 32K\n"); /* XXX debug? */
115 /* read file into memory */
116 if (read(io
, kp
, ksize
) != ksize
) {
120 /* validate boot: DOS\0 and checksum? */
121 if (strcmp(kp
, "DOS") != 0 &&
122 (*(u_int32_t
*)kp
) != 0x424f4f54) {
126 /* call boot+12(aio, sysbase); */
128 startit(kp
, aio
, ConsoleBase
);
134 printf("Error %ld\n", (long)errno
);