Port-sun3 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 4.01 panic/lock issues?



John Carr wrote:

> > Could you try this kernel (which has a debug printf in that path)?
> > http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-sun3-FPETEST-4.0.1.gz
> 
> Sure thing... I installed it and ran the mutt package from the m68k
> packages on ftp.netbsd.org... and it panic'd immediately, just as
> before:
> 
> fpu_emul_arith: FP instruction is not processed properly
> fpu_emul_arith: opcode=0xf200, word1=0x466

Okay, it looks an FDADD instruction which is available only on 040/060,
so I'm afraid all m68k 4.0 packages binaries on ftp might be built
with -m68040 or -m68060 and they won't run on 020/030 machines.

> vm_fault(0xe1774e0, 0x0, 0x1) -> 0xe
> trap type=0x8, code=0x145, v=0x4
> kernel: MMU fault trap
> pid = 678, lid = 1, pc = 0E120994, ps = 2000, sfc = 1, dfc = 1
 :
> panic: MMU fault
> Stopped in pid 678.1 (mutt) at  netbsd:cpu_Debugger+0x6:        unlk
> a6
> db> tr
> cpu_Debugger(2000,8,ef17170,f8c3db8,f8c3e1c) + 6
> panic(e15e641,4,4,466,f8c3fb4) + 11a
> trap(f8c3e34,8,145,4) + 244
> fpu_upd_fpsr(e17f598,0) + 18
> fpu_emulate(f8c3fb4,f8c0040,f8c3f70) + 676
> trap(f8c3fb4,10,0,0) + 548
> fault() + 10

...but a kernel should not panic even in that case.
Maybe no one has tried such instructions on 020/030?

Maybe it's trivial to make those instructions cause
SIGILL properly (attached), but I'm not sure if
we should also emulate 040/060 instructions for
68881/68882 machines...

---
Index: sys/arch/m68k/fpe/fpu_emulate.c
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/fpe/fpu_emulate.c,v
retrieving revision 1.26.24.1
diff -u -r1.26.24.1 fpu_emulate.c
--- sys/arch/m68k/fpe/fpu_emulate.c     31 Mar 2007 15:40:39 -0000      
1.26.24.1
+++ sys/arch/m68k/fpe/fpu_emulate.c     19 Jan 2009 11:38:47 -0000
@@ -753,8 +753,8 @@
      * pointer to the result.
      
      */
-    res = 0;
-    switch (word1 & 0x3f) {
+    res = NULL;
+    switch (word1 & 0x7f) {
     case 0x00:                 /* fmove */
        res = &fe->fe_f2;
        break;
@@ -910,7 +910,7 @@
        discard_result = 1;
        break;
 
-    default:
+    default:                   /* possibly 040/060 instructions */
 #ifdef DEBUG
        printf("fpu_emul_arith: bad opcode=0x%x, word1=0x%x\n",
               insn->is_opcode, insn->is_word1);
@@ -918,8 +918,15 @@
        sig = SIGILL;
     } /* switch (word1 & 0x3f) */
 
+    /* for sanity */
+    if (res == NULL)
+       sig = SIGILL;
+
     if (!discard_result && sig == 0) {
        fpu_implode(fe, res, FTYPE_EXT, &fpregs[regnum * 3]);
+
+       /* update fpsr according to the result of operation */
+       fpu_upd_fpsr(fe, res);
 #if DEBUG_FPE
        printf("fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n",
               fpregs[regnum*3], fpregs[regnum*3+1],
@@ -937,9 +944,6 @@
 #endif
     }
 
-    /* update fpsr according to the result of operation */
-    fpu_upd_fpsr(fe, res);
-
 #if DEBUG_FPE
     printf("fpu_emul_arith: FPSR = %08x, FPCR = %08x\n",
           fe->fe_fpsr, fe->fe_fpcr);

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index