Subject: Re: illegal instruction trap booting -current kernel
To: Christian Groessler <cpg@aladdin.de>
From: Frederick Bruckman <fredb@immanent.net>
List: port-mac68k
Date: 03/04/2003 21:26:46
On 4 Mar 2003, Christian Groessler wrote:
> when I try to boot a -current kernel, I get early in the boot process
> a kernel panic: (this is typed from the screen)
>
> Kernel Illegal instruction Trap
> trap type 2, code = 0x0, v = 0x0
> kernel program counter = 0x37ac
Me too, on a Quadra 630. I guess you're working on an '040 Mac, too?
> Using the program counter as a hint I disassembled the kernel
> executable and the problem seems to be in the m68k_make_fpu_idle_frame
> function.
>
> 0x37ac seems to be the "fnop" after the "fmovecrx #15,%fp0" in
> sys/arch/m68k/m68k/switch_subr.s. (maybe the fmovecrx is the problem?)
I bet! fmovecrx is emulated on the 68040. Not good.
> With the following change the kernel boots.
Taking a hint from fpsp, I tried this, instead...
Index: switch_subr.s
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/m68k/switch_subr.s,v
retrieving revision 1.2
diff -u -r1.2 switch_subr.s
--- switch_subr.s 2003/01/17 23:18:28 1.2
+++ switch_subr.s 2003/03/05 02:59:33
@@ -519,8 +519,8 @@
frestore %sp@ | Effectively `resets' the FPU
fnop
- /* Loading '0.0' from the constant rom will change FPU to "idle". */
- fmovecrx #15,%fp0
+ /* Loading '0.0' will change FPU to "idle". */
+ fmove.x #0,%fp0
fnop
/* Save the resulting idle frame into the buffer */
With that, the emuspeed regression tests pass, and it can display
grayscale images with "xwud". (I disassembled "xwud", and it does
indeed use floating point.)
BTW, I also build the whole kernel without -msoft-float...
Index: Makefile.mac68k
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/conf/Makefile.mac68k,v
retrieving revision 1.85
diff -u -r1.85 Makefile.mac68k
--- Makefile.mac68k 2002/11/26 18:51:15 1.85
+++ Makefile.mac68k 2003/03/05 03:21:54
@@ -32,7 +32,7 @@
## (2) compile settings
##
CPPFLAGS+= -Dmac68k
-CFLAGS+= -msoft-float
+#CFLAGS+= -msoft-float
AFLAGS+= -x assembler-with-cpp -traditional-cpp
##
as it seems silly to me to hamper the compiler that way, when the
kernel is already riddled with floating point assembler anyhow.
Frederick