Subject: Strange traps
To: None <port-mac68k@NetBSD.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: port-mac68k
Date: 01/31/2005 23:36:07
Hi again,

now that I'm able to boot NetBSD again on the Performa 630 (68LC040),
I'm observing strange behavior while booting a -current kernel (it's
customized, but shouldn't matter), as it always hangs when it reaches to
probe adb (after fpu).  What I'm going to ask below is not related to
adb, but to the "nested" traps that are happening here:

fpu0 at mainbus0 (emulator)
adb0uvm_fault(0x1b4400, 0x67216000, 0, 0x1) -> 0xe
  type 8, code [mmu,,ssw]: 1505
trap type 8, code = 0x1505, v = 0x67216d78
kernel program counter = 0xba5c8
kernel: MMU fault trap
pid = 0, lid = 1, pc = 000BA5C8, ps = 2609, Kernel FPU trap.
trap type 16, code = 0x0, v = 0x0
kernel program counter = 0x37b2
kernel: type 16 trap
panic: trap
Stopped in pid 0.1 (swapper) at netbsd:cpu_Debugger+0x6: unlk a6

First of all, you can see a trap of type 8.  Then, when it proceeds
to dump the registers (regdump.c in m68k), it shows pc and ps correctly,
and then tries to print the sfc and dfc.  But this doesn't happen.
At that point, the second trap happens, which says it's a FPU trap.

Ok, if I remove the calls to getsfc and getdfc, i.e., I comment out
lines 113 and 114 in regdump.c, I can see a complete register dump
without problems.

But, if instead of that, I go to mac68k's locore.s and change the
getsfc and getdfc functions to look like:

ENTRY_NOPROFILE(getsfc)
	moveq	#0,%d0
	rts

ENTRY_NOPROFILE(getdfc)
	moveq	#0,%d0
	rts

one could expect the regdump function to show 0 values for sfc and dfc,
right?  But what really happens is that none of the traps appear (I
can just see 'adb0' and the kernel hangs.)

Doesn't this sound strange?

BTW, what's the 'movc' instruction, which appears on the original
getsfc and getdfc functions?  I can't find it in the 68k reference
manual.

Thanks,

-- 
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/