more changes on original files
[linux-2.4.git] / arch / mips / hp-lj / int-handler.S
1 #include <asm/asm.h>
2
3 #include <asm/mipsregs.h>
4 #include <asm/regdef.h>
5 #include <asm/stackframe.h>
6
7         .text
8         .set    mips1
9         .set    reorder
10         .set    macro
11         .set    noat
12         .align  5
13
14 # MIPS has 16 exception vectors numbered 0 to 15
15 # vector number 0 is for interrupts and the others are for various exceptions
16 # The following code is installed as the handler for exception 0
17 # There are 8 possible interrupts that can cause this exception.
18 # The cause register indicates which are pending
19 # The status register indicates which are enabled
20 # This code segment basically will decipher which interrup occurred (7 downto 0)
21 # and pass an integer indicating which was the highest priority pending interrupt
22 # to the do_IRQ routine.
23
24 NESTED(hpIRQ, PT_SIZE, sp)
25         SAVE_ALL
26         CLI                             # Important: mark KERNEL mode !
27         /*
28          * Get pending interrupts
29          */
30
31         mfc0    t0,CP0_CAUSE            # get pending interrupts
32         mfc0    t1,CP0_STATUS           # get enabled interrupts
33         and     t0,t1                   # isolate allowed ones
34         andi    t0,0xff00               # isolate pending bits
35         sll     t0,16                   # shift the pending bits down
36         beqz    t0,3f                   # no pending intrs, then spurious
37         nop                             # delay slot
38
39         /*
40          * Find irq with highest priority
41          * FIXME: This is slow - use binary search
42          */
43
44         la      a0,7
45 1:      bltz    t0,2f                   # found pending irq
46         subu    a0,1
47         sll     t0,1
48         b       1b
49         nop                             # delay slot
50
51
52 call_do_IRQ:
53 2:      move    a1,sp
54         jal     do_IRQ
55         nop                             # delay slot
56         j       ret_from_irq
57         nop
58
59 /*
60         mfc0    t0,CP0_STATUS           # disable interrupts
61         ori     t0,1
62         xori    t0,1
63         mtc0    t0,CP0_STATUS
64
65         la      a1, ret_from_irq
66         jr      a1
67 */
68 3:      j       spurious_interrupt
69 END(hpIRQ)
70