1 /* $NetBSD: machdep.c,v 1.6 2005/12/11 12:18:29 christos Exp $ */
3 * Copyright (c) 1998 Darrin Jewell
4 * Copyright (c) 1994 Rolf Grossmann
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Rolf Grossmann.
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.
33 #include <sys/types.h>
36 #include <next68k/next68k/nextrom.h>
40 #define MON(type, off) (*(type *)((u_int) (mg) + off))
42 extern int entry_point
;
51 #define DPRINTF(x) printf x
57 machdep_start(char *entry
, int howto
, char *loadaddr
, char *ssym
, char *esym
)
59 DPRINTF(("machdep_start(entry=%p,howto=0x%x,loadaddr=%p,ssym=%p,esym=%p\n",
60 entry
, howto
, loadaddr
, ssym
, esym
));
61 MON(int,MG_boot_how
) = howto
;
62 entry_point
= (int)entry
+ (int)loadaddr
;
63 DPRINTF(("start=0x%lx\n", (u_long
)entry_point
));
65 /* @@@ hack to pass esym to kernel */
66 *((u_int
*)loadaddr
) = (u_int
)esym
;
68 /* return to exec, so that main can return entry point */
71 typedef int (*getcptr
)(void);
72 typedef int (*putcptr
)(int);
77 return(MON(getcptr
,MG_getc
)());
83 MON(putcptr
,MG_putc
)(c
);
89 extern __dead
void _halt(void);
91 printf("Press any key to halt.\n");
105 } __attribute__ ((packed
));
107 int trap(struct trapframe
*);
110 trap(struct trapframe
*fp
)
112 static int intrap
= 0;
117 printf("Got unexpected trap: format=%x vector=%x sr=%x pc=%x\n",
118 fp
->fmt
, fp
->vec
, fp
->sr
, fp
->pc
);
119 printf("dregs: %x %x %x %x %x %x %x %x\n",
120 fp
->dregs
[0], fp
->dregs
[1], fp
->dregs
[2], fp
->dregs
[3],
121 fp
->dregs
[4], fp
->dregs
[5], fp
->dregs
[6], fp
->dregs
[7]);
122 printf("aregs: %x %x %x %x %x %x %x %x\n",
123 fp
->aregs
[0], fp
->aregs
[1], fp
->aregs
[2], fp
->aregs
[3],
124 fp
->aregs
[4], fp
->aregs
[5], fp
->aregs
[6], fp
->aregs
[7]);
132 for (i
= 0; i
< 64; i
++) {
134 printf ("\npc %x: ", (int)&p
[i
-16]);
135 printf ("%x ", p
[i
]);
137 p
= (int *)(fp
->info
);
138 for (i
= 0; i
< 64; i
++) {
140 printf ("\nstk %x: ", (int)&p
[i
-16]);
141 printf ("%x ", p
[i
]);
146 printf("Halting.\n");