Import 2.4.0-test4pre1
[davej-history.git] / arch / mips / orion / int-handler.S
blobe5023b96110e07d85a9d643789372c08948e56c6
1 #include <asm/asm.h>
2 #include <asm/mipsregs.h>
3 #include <asm/regdef.h>
4 #include <asm/stackframe.h>
6         .text
7         .set    mips1
8         .set    reorder
9         .set    macro
10         .set    noat
11         .align  5
13 NESTED(orionIRQ, PT_SIZE, sp)
14         SAVE_ALL
15         CLI                             # Important: mark KERNEL mode !
16         /*
17          * Get pending interrupts
18          */
19         mfc0    t0,CP0_CAUSE            # get pending interrupts
20         mfc0    t1,CP0_STATUS           # get enabled interrupts
21         and     t0,t1                   # isolate allowed ones
22         andi    t0,0xff00               # isolate pending bits
23         sll     t0,16                   # shift the pending bits down
24         beqz    t0,3f                   # no pending intrs, then spurious
25         nop                             # delay slot
26         
27         /*
28          * Find irq with highest priority
29          * FIXME: This is slow - use binary search
30          */
31         la      a0,7
32 1:      bltz    t0,2f                   # found pending irq
33         subu    a0,1
34         sll     t0,1
35         b       1b
36         nop                             # delay slot
38 call_do_IRQ:
39 2:      move    a1,sp
40         jal     do_IRQ
41         nop                             # delay slot
43         mfc0    t0,CP0_STATUS           # disable interrupts
44         ori     t0,1
45         xori    t0,1
46         mtc0    t0,CP0_STATUS
47         
48         la      a1, ret_from_irq
49         jr      a1
50         
51 3:      j       spurious_interrupt
52 END(orionIRQ)