From: zippel@fh-brandenburg.de (Roman Zippel)
Subject: L68K: Linux 2.1.47
To: linux-m68k@phil.uni-sb.de
Date: Sat, 23 Aug 1997 17:49:24 +0200 (MET DST)
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: linux-m68k@phil.uni-sb.de

Hi,

The emulation traps for the 040/060 must be setup as early
as possible, otherwise it might happen that old code is
called that might already have been destroyed by the kernel
(That's why also amiga_sound_init() doesn't work always).
I think it's the best way to setup a basic trap table as
early as possible to avoid further problems and not to move
all problem functions after trap_init().

BTW I have a working lilo for 060 amigas, but I'd like to
get the latest linuxboot sources, that seemd to disappear in
2.1.47 (Geert?). Special future: no crosscompiler needed
anymore, long live Linux. :-)

BTW2 I have the same problem as Dave, I got at tuesday the
last mail from this list, I can read the list only on the web.

Roman

--- linux-2.1.47/arch/m68k/kernel/setup.c.old	Sat Aug 23 15:30:07 1997
+++ linux-2.1.47/arch/m68k/kernel/setup.c	Sat Aug 23 14:13:09 1997
@@ -88,6 +88,8 @@
 int *mach_sysrq_keys = NULL;
 #endif
 
+extern void base_trap_init(void);
+
 extern int amiga_parse_bootinfo(const struct bi_record *);
 extern int atari_parse_bootinfo(const struct bi_record *);
 
@@ -162,6 +164,8 @@
 		m68k_is040or060 = 4;
 	else if (CPU_IS_060)
 		m68k_is040or060 = 6;
+
+	base_trap_init();
 
 	/* clear the fpu if we have one */
 	if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
--- linux-2.1.47/arch/m68k/kernel/traps.c.old	Sat Aug 23 15:21:58 1997
+++ linux-2.1.47/arch/m68k/kernel/traps.c	Sat Aug 23 15:13:35 1997
@@ -64,23 +64,10 @@
     __ALIGN_STR "\n"
     SYMBOL_NAME_STR(nmihandler) ": rte");
 
-__initfunc(void trap_init (void))
+__initfunc(void base_trap_init(void))
 {
-	int i;
-
 	/* setup the exception vector table */
-	__asm__ volatile ("movec %0,%/vbr" : : "r" ((void*)vectors));
-
-	for (i = 48; i < 64; i++)
-		vectors[i] = trap;
-
-	for (i = 64; i < 256; i++)
-		vectors[i] = inthandler;
-
-        /* if running on an amiga, make the NMI interrupt do nothing */
-        if (MACH_IS_AMIGA) {
-                vectors[VEC_INT7] = nmihandler;
-        }
+	__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
 
 	if (CPU_IS_040) {
 		/* set up FPSP entry points */
@@ -131,6 +118,23 @@
 		/* set up ISP entry points */
 
 		vectors[VEC_UNIMPII] = unimp_vec;
+	}
+}
+
+__initfunc(void trap_init (void))
+{
+	int i;
+
+	for (i = 48; i < 64; i++)
+		if (!vectors[i])
+			vectors[i] = trap;
+
+	for (i = 64; i < 256; i++)
+		vectors[i] = inthandler;
+
+        /* if running on an amiga, make the NMI interrupt do nothing */
+	if (MACH_IS_AMIGA) {
+		vectors[VEC_INT7] = nmihandler;
 	}
 }
 
