Port-mips archive

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

Does umimplemnted insn emulation work in -current?



I notice FPInterrupt() in locore.S has the following code:

---
 *      MachFPInterrupt(status, cause, pc, frame)

 :

 * fetch the instruction and emulate the instruction.
 */
        bgez            a1, 1f                  # Check the branch delay bit.
        nop
/*
 * The instruction is in the branch delay slot.
 */
        b               2f
        lw              a0, 4(a2)               # a0 = coproc instruction
/*
 * This is not in the branch delay slot so calculate the resulting
 * PC (epc + 4) into v0 and continue to MachEmulateFP().
 */
1:
        lw              a0, 4(a2)               # a0 = coproc instruction
2:
        move            a2, a1
---

So address of the umimplemented instruction is always (PC+4)
regardless of the branch delay bit.

The offset value for non-BDslot case was changed from 0 to 4
in rev 1.171:
---
diff -u -p -r1.170 -r1.171
--- src/sys/arch/mips/mips/locore.S     2009/12/10 05:10:02     1.170
+++ src/sys/arch/mips/mips/locore.S     2009/12/14 00:46:06     1.171

 :

 /*
  * This is not in the branch delay slot so calculate the resulting
  * PC (epc + 4) into v0 and continue to MachEmulateFP().
  */
 1:
-       lw      a0, 0(a2)                       # a0 = coproc instruction
+       lw              a0, 4(a2)               # a0 = coproc instruction
 2:

---

Was this change intentional?
Does the umimplemented insn emulation in mips_emul.c work as expected?

Note "... so calculate the resulting PC (epc + 4) into v0 and continue
 to MachEmulateFP()" comment is just leftover that should have been
removed in rev 1.82:
http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/arch/mips/mips/locore.S#rev1.82
and there are more comments that should be updated.
(coproc insn -> umimplemented insn etc)
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index