]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Shrink v850 exception-trap handling code a bit
authorMiles Bader <miles@lsi.nec.co.jp>
Tue, 26 Nov 2002 13:21:35 +0000 (05:21 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 26 Nov 2002 13:21:35 +0000 (05:21 -0800)
Shrink v850 exception-trap handling code a bit

arch/v850/kernel/entry.S
arch/v850/kernel/intv.S

index 1bc7747ca5f4096eb68b53a13fecaad5bc97bc9d..e5442bde9a7ade0858d51d7d2cf149cc33dc5849 100644 (file)
@@ -657,6 +657,12 @@ G_ENTRY(irq):
        shl     16, r6                  // clear upper 16 bits
        shr     20, r6                  // shift back, and remove lower nibble
        add     -8, r6                  // remove bias for irqs
+
+       // If the IRQ index is negative, it's actually one of the exception
+       // traps below 0x80 (currently, the illegal instruction trap, and
+       // the `debug trap').  Handle these separately.
+       bn      exception
+
        // Call the high-level interrupt handling code.
        jarl    CSYM(handle_irq), lp
        // fall through
@@ -665,6 +671,23 @@ G_ENTRY(irq):
    handlers, below).  */
 ret_from_irq:
        RETURN(IRQ)
+
+exception:
+       mov     hilo(ret_from_irq), lp  // where the handler should return
+       
+       cmp     -2, r6
+       bne     1f
+       // illegal instruction exception
+       addi    SIGILL, r0, r6          // Arg 0: signal number
+       mov     CURRENT_TASK, r7        // Arg 1: task
+       jr      CSYM(force_sig)         // tail call
+
+1:     cmp     -1, r6
+       bne     bad_trap_wrapper
+       // `dbtrap' exception
+       movea   PTO, sp, r6             // Arg 0: user regs
+       jr      CSYM(debug_trap)        // tail call
+
 END(irq)
 
 
@@ -692,44 +715,7 @@ G_ENTRY(nmi):
        jarl    CSYM(handle_irq), lp
 
        RETURN(NMI)
-END(nmi0)
-
-
-/*
- * Illegal instruction trap.
- *
- * The stack-pointer (r3) should have already been saved to the memory
- * location ENTRY_SP (the reason for this is that the interrupt vectors may be
- * beyond a 22-bit signed offset jump from the actual interrupt handler, and
- * this allows them to save the stack-pointer and use that register to do an
- * indirect jump).
- */
-G_ENTRY(illegal_instruction):
-       SAVE_STATE (IRQ, r0, ENTRY_SP)  // Save registers. 
-       ei
-       addi    SIGILL, r0, r6          // Arg 0: signal number
-       mov     CURRENT_TASK, r7        // Arg 1: task
-       mov     hilo(ret_from_irq), lp  // where the handler should return
-       jr      CSYM(force_sig)
-END(illegal_instruction)
-
-
-/*
- * `Debug' trap
- *
- * The stack-pointer (r3) should have already been saved to the memory
- * location ENTRY_SP (the reason for this is that the interrupt vectors may be
- * beyond a 22-bit signed offset jump from the actual interrupt handler, and
- * this allows them to save the stack-pointer and use that register to do an
- * indirect jump).
- */
-G_ENTRY(dbtrap):
-       SAVE_STATE (IRQ, r0, ENTRY_SP)  // Save registers. 
-       ei
-       movea   PTO, sp, r6             // Arg 0: user regs
-       mov     hilo(ret_from_irq), lp  // where the handler should return
-       jr      CSYM(debug_trap)
-END(dbtrap)
+END(nmi)
 
 
 /*
index 5a118fc29d1b0a2a80c2134bafee3ffd66225b6a..8d125d2422c60cf0e5fac287c57a14621bb2477a 100644 (file)
        JUMP_TO_HANDLER (trap, ENTRY_SP)        // TRAP1n
 
        .balign 0x10
-       JUMP_TO_HANDLER (illegal_instruction, ENTRY_SP) // illegal insn trap
+       JUMP_TO_HANDLER (irq, ENTRY_SP)         // illegal insn trap
 
        .balign 0x10
-       JUMP_TO_HANDLER (dbtrap, ENTRY_SP)      // DBTRAP insn
+       JUMP_TO_HANDLER (irq, ENTRY_SP)         // DBTRAP insn
 
 
        /* Hardware interrupt vectors.  */