2 * linux/arch/arm/kernel/entry-armv.S
4 * Copyright (C) 1996,1997,1998 Russell King.
5 * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * Low-level vector interface routines
13 * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction that causes
14 * it to save wrong values... Be aware!
16 #include <linux/config.h>
17 #include <linux/init.h>
19 #include <asm/thread_info.h>
21 #include <asm/ptrace.h>
22 #include <asm/vfpmacros.h>
24 #include "entry-header.S"
27 /* IOC / IOMD based hardware */
28 #include <asm/hardware/iomd.h>
30 .equ ioc_base_high, IOC_BASE & 0xff000000
31 .equ ioc_base_low, IOC_BASE & 0x00ff0000
33 mov r12, #ioc_base_high
35 orr r12, r12, #ioc_base_low
37 strb r12, [r12, #0x38] @ Disable FIQ register
40 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
41 mov r4, #ioc_base_high @ point at IOC
43 orr r4, r4, #ioc_base_low
45 ldrb \irqstat, [r4, #IOMD_IRQREQB] @ get high priority first
46 ldr \base, =irq_prio_h
49 ldreqb \irqstat, [r4, #IOMD_DMAREQ] @ get dma
50 addeq \base, \base, #256 @ irq_prio_h table size
54 ldreqb \irqstat, [r4, #IOMD_IRQREQA] @ get low priority
55 addeq \base, \base, #256 @ irq_prio_d table size
58 ldreqb \irqstat, [r4, #IOMD_IRQREQC]
59 addeq \base, \base, #256 @ irq_prio_l table size
63 ldreqb \irqstat, [r4, #IOMD_IRQREQD]
64 addeq \base, \base, #256 @ irq_prio_lc table size
67 2406: ldrneb \irqnr, [\base, \irqstat] @ get IRQ number
71 * Interrupt table (incorporates priority). Please note that we
72 * rely on the order of these tables (see above code).
75 irq_prio_h: .byte 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
76 .byte 12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
77 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
78 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
79 .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
80 .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
81 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
82 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
83 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
84 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
85 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
86 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
87 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
88 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
89 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
90 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
92 irq_prio_d: .byte 0,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
93 .byte 20,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
94 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
95 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
96 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
97 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
98 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
99 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
100 .byte 23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
101 .byte 23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
102 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
103 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
104 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
105 .byte 22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
106 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
107 .byte 21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
109 irq_prio_l: .byte 0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
110 .byte 4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
111 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
112 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
113 .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
114 .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
115 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
116 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
117 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
118 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
119 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
120 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
121 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
122 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
123 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
124 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
126 irq_prio_lc: .byte 24,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
127 .byte 28,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
128 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
129 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
130 .byte 30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
131 .byte 30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
132 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
133 .byte 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
134 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
135 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
136 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
137 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
138 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
139 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
140 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
141 .byte 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
144 irq_prio_ld: .byte 40,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
145 .byte 44,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
146 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
147 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
148 .byte 46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
149 .byte 46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
150 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
151 .byte 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
152 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
153 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
154 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
155 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
156 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
157 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
158 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
159 .byte 47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
163 #elif defined(CONFIG_ARCH_EBSA110)
165 #define IRQ_STAT 0xff000000 /* read */
170 .macro get_irqnr_and_base, irqnr, stat, base, tmp
172 ldrb \stat, [\base] @ get interrupts
175 addeq \irqnr, \irqnr, #4
176 moveq \stat, \stat, lsr #4
178 addeq \irqnr, \irqnr, #2
179 moveq \stat, \stat, lsr #2
181 addeq \irqnr, \irqnr, #1
182 moveq \stat, \stat, lsr #1
183 tst \stat, #1 @ bit 0 should be set
186 .macro irq_prio_table
189 #elif defined(CONFIG_ARCH_SHARK)
194 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
198 strb \irqstat, [r4, #0x20] @outb(0x0C, 0x20) /* Poll command */
199 ldrb \irqnr, [r4, #0x20] @irq = inb(0x20) & 7
200 and \irqstat, \irqnr, #0x80
203 and \irqnr, \irqnr, #7
206 43: mov \irqstat, #0x0C
207 strb \irqstat, [r4, #0xa0] @outb(0x0C, 0xA0) /* Poll command */
208 ldrb \irqnr, [r4, #0xa0] @irq = (inb(0xA0) & 7) + 8
209 and \irqstat, \irqnr, #0x80
212 and \irqnr, \irqnr, #7
213 add \irqnr, \irqnr, #8
217 .macro irq_prio_table
220 #elif defined(CONFIG_FOOTBRIDGE)
221 #include <asm/hardware/dec21285.h>
226 .equ dc21285_high, ARMCSR_BASE & 0xff000000
227 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff
229 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
230 mov r4, #dc21285_high
232 orr r4, r4, #dc21285_low
234 ldr \irqstat, [r4, #0x180] @ get interrupts
236 mov \irqnr, #IRQ_SDRAMPARITY
237 tst \irqstat, #IRQ_MASK_SDRAMPARITY
240 tst \irqstat, #IRQ_MASK_UART_RX
241 movne \irqnr, #IRQ_CONRX
244 tst \irqstat, #IRQ_MASK_DMA1
245 movne \irqnr, #IRQ_DMA1
248 tst \irqstat, #IRQ_MASK_DMA2
249 movne \irqnr, #IRQ_DMA2
252 tst \irqstat, #IRQ_MASK_IN0
253 movne \irqnr, #IRQ_IN0
256 tst \irqstat, #IRQ_MASK_IN1
257 movne \irqnr, #IRQ_IN1
260 tst \irqstat, #IRQ_MASK_IN2
261 movne \irqnr, #IRQ_IN2
264 tst \irqstat, #IRQ_MASK_IN3
265 movne \irqnr, #IRQ_IN3
268 tst \irqstat, #IRQ_MASK_PCI
269 movne \irqnr, #IRQ_PCI
272 tst \irqstat, #IRQ_MASK_DOORBELLHOST
273 movne \irqnr, #IRQ_DOORBELLHOST
276 tst \irqstat, #IRQ_MASK_I2OINPOST
277 movne \irqnr, #IRQ_I2OINPOST
280 tst \irqstat, #IRQ_MASK_TIMER1
281 movne \irqnr, #IRQ_TIMER1
284 tst \irqstat, #IRQ_MASK_TIMER2
285 movne \irqnr, #IRQ_TIMER2
288 tst \irqstat, #IRQ_MASK_TIMER3
289 movne \irqnr, #IRQ_TIMER3
292 tst \irqstat, #IRQ_MASK_UART_TX
293 movne \irqnr, #IRQ_CONTX
296 tst \irqstat, #IRQ_MASK_PCI_ABORT
297 movne \irqnr, #IRQ_PCI_ABORT
300 tst \irqstat, #IRQ_MASK_PCI_SERR
301 movne \irqnr, #IRQ_PCI_SERR
304 tst \irqstat, #IRQ_MASK_DISCARD_TIMER
305 movne \irqnr, #IRQ_DISCARD_TIMER
308 tst \irqstat, #IRQ_MASK_PCI_DPERR
309 movne \irqnr, #IRQ_PCI_DPERR
312 tst \irqstat, #IRQ_MASK_PCI_PERR
313 movne \irqnr, #IRQ_PCI_PERR
317 .macro irq_prio_table
320 #elif defined(CONFIG_ARCH_NEXUSPCI)
325 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
326 ldr \irqstat, =INTCONT_BASE
327 ldr \base, =soft_irq_mask
328 ldr \irqstat, [\irqstat] @ get interrupts
331 and \irqstat, \irqstat, \base @ mask out disabled ones
332 1001: tst \irqstat, #1
333 addeq \irqnr, \irqnr, #1
334 moveq \irqstat, \irqstat, lsr #1
340 .macro irq_prio_table
348 #elif defined(CONFIG_ARCH_TBOX)
353 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
354 ldr \irqstat, =0xffff7000
355 ldr \irqstat, [\irqstat] @ get interrupts
356 ldr \base, =soft_irq_mask
359 and \irqstat, \irqstat, \base @ mask out disabled ones
360 1001: tst \irqstat, #1
361 addeq \irqnr, \irqnr, #1
362 moveq \irqstat, \irqstat, lsr #1
368 .macro irq_prio_table
376 #elif defined(CONFIG_ARCH_SA1100)
381 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
382 mov r4, #0xfa000000 @ ICIP = 0xfa050000
383 add r4, r4, #0x00050000
384 ldr \irqstat, [r4] @ get irqs
385 ldr \irqnr, [r4, #4] @ ICMR = 0xfa050004
386 ands \irqstat, \irqstat, \irqnr
390 moveq \irqstat, \irqstat, lsr #8
391 addeq \irqnr, \irqnr, #8
392 tsteq \irqstat, #0xff
393 moveq \irqstat, \irqstat, lsr #8
394 addeq \irqnr, \irqnr, #8
395 tsteq \irqstat, #0xff
396 moveq \irqstat, \irqstat, lsr #8
397 addeq \irqnr, \irqnr, #8
399 moveq \irqstat, \irqstat, lsr #4
400 addeq \irqnr, \irqnr, #4
402 moveq \irqstat, \irqstat, lsr #2
403 addeq \irqnr, \irqnr, #2
405 addeqs \irqnr, \irqnr, #1
409 .macro irq_prio_table
412 #elif defined(CONFIG_ARCH_L7200)
413 #include <asm/hardware.h>
415 .equ irq_base_addr, IO_BASE_2
420 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
421 mov \irqstat, #irq_base_addr @ Virt addr IRQ regs
422 add \irqstat, \irqstat, #0x00001000 @ Status reg
423 ldr \irqstat, [\irqstat, #0] @ get interrupts
425 1001: tst \irqstat, #1
426 addeq \irqnr, \irqnr, #1
427 moveq \irqstat, \irqstat, lsr #1
433 .macro irq_prio_table
436 #elif defined(CONFIG_ARCH_INTEGRATOR)
441 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
442 /* FIXME: should not be using soo many LDRs here */
443 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE)
444 mov \irqnr, #IRQ_PIC_START
445 ldr \irqstat, [\base, #IRQ_STATUS] @ get masked status
446 ldr \base, =IO_ADDRESS(INTEGRATOR_HDR_BASE)
448 ldreq \irqstat, [\base, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)]
449 moveq \irqnr, #IRQ_CIC_START
451 1001: tst \irqstat, #15
453 add \irqnr, \irqnr, #4
454 movs \irqstat, \irqstat, lsr #4
456 1002: tst \irqstat, #1
458 add \irqnr, \irqnr, #1
459 movs \irqstat, \irqstat, lsr #1
461 1003: /* EQ will be set if no irqs pending */
464 .macro irq_prio_table
467 #elif defined(CONFIG_ARCH_VERSATILE_PB)
472 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
473 ldr \base, =IO_ADDRESS(VERSATILE_VIC_BASE)
474 ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get masked status
479 1001: tst \irqstat, #15
481 add \irqnr, \irqnr, #4
482 movs \irqstat, \irqstat, lsr #4
484 1002: tst \irqstat, #1
486 add \irqnr, \irqnr, #1
487 movs \irqstat, \irqstat, lsr #1
489 1003: /* EQ will be set if no irqs pending */
491 @ clz \irqnr, \irqstat
492 @1003: /* EQ will be set if we reach MAXIRQNUM */
495 .macro irq_prio_table
498 #elif defined(CONFIG_ARCH_CLPS711X)
500 #include <asm/hardware/clps7111.h>
505 #if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
506 #error INTSR stride != INTMR stride
509 .macro get_irqnr_and_base, irqnr, stat, base, mask
510 mov \base, #CLPS7111_BASE
511 ldr \stat, [\base, #INTSR1]
512 ldr \mask, [\base, #INTMR1]
514 mov \mask, \mask, lsl #16
515 and \stat, \stat, \mask, lsr #16
516 movs \stat, \stat, lsr #4
519 add \base, \base, #INTSR2 - INTSR1
520 ldr \stat, [\base, #INTSR1]
521 ldr \mask, [\base, #INTMR1]
523 mov \mask, \mask, lsl #16
524 and \stat, \stat, \mask, lsr #16
526 1001: tst \stat, #255
527 addeq \irqnr, \irqnr, #8
528 moveq \stat, \stat, lsr #8
530 addeq \irqnr, \irqnr, #4
531 moveq \stat, \stat, lsr #4
533 addeq \irqnr, \irqnr, #2
534 moveq \stat, \stat, lsr #2
536 addeq \irqnr, \irqnr, #1
537 moveq \stat, \stat, lsr #1
538 tst \stat, #1 @ bit 0 should be set
541 .macro irq_prio_table
544 #elif defined (CONFIG_ARCH_CAMELOT)
545 #include <asm/arch/platform.h>
546 #undef IRQ_MODE /* same name defined in asm/proc/ptrace.h */
547 #include <asm/arch/int_ctrl00.h>
552 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
554 ldr \irqstat, =INT_ID(IO_ADDRESS(EXC_INT_CTRL00_BASE))
555 ldr \irqnr,[\irqstat]
557 subne \irqnr,\irqnr,#1
562 .macro irq_prio_table
565 #elif defined(CONFIG_ARCH_IOP321)
570 * Note: only deal with normal interrupts, not FIQ
572 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
574 mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC
579 subs \irqnr,\base,\irqnr
580 add \irqnr,\irqnr,#IRQ_IOP321_DMA0_EOT
584 .macro irq_prio_table
587 #elif defined(CONFIG_ARCH_IOP331)
592 * Note: only deal with normal interrupts, not FIQ
594 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
596 mrc p6, 0, \irqstat, c4, c0, 0 @ Read IINTSRC0
599 mrc p6, 0, \irqstat, c5, c0, 0 @ Read IINTSRC1
605 * subs \irqnr,\base,\irqnr
607 rsbs \irqnr,\irqnr,#31 @ recommend by RMK
608 add \irqnr,\irqnr,#IRQ_IOP331_XINT8
610 1002: clz \irqnr, \irqstat
612 subs \irqnr,\base,\irqnr
613 add \irqnr,\irqnr,#IRQ_IOP331_DMA0_EOT
617 .macro irq_prio_table
620 #elif defined(CONFIG_ARCH_PXA)
625 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
627 mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP
628 mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR
630 mov \base, #io_p2v(0x40000000) @ IIR Ctl = 0x40d00000
631 add \base, \base, #0x00d00000
632 ldr \irqstat, [\base, #0] @ ICIP
633 ldr \irqnr, [\base, #4] @ ICMR
635 ands \irqnr, \irqstat, \irqnr
637 rsb \irqstat, \irqnr, #0
638 and \irqstat, \irqstat, \irqnr
640 rsb \irqnr, \irqnr, #(31 - PXA_IRQ_SKIP)
644 .macro irq_prio_table
647 #elif defined(CONFIG_ARCH_IXP2000)
652 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
654 mov \irqnr, #0x0 @clear out irqnr as default
655 mov \base, #0xfe000000
656 orr \base, \base, #0x00ff0000
657 orr \base, \base, #0x0000a000
658 orr \base, \base, #0x08
659 ldr \irqstat, [\base] @ get interrupts
660 mov \tmp, #IXP2000_VALID_IRQ_MASK & 0xff000000
661 orr \tmp, \tmp, #IXP2000_VALID_IRQ_MASK & 0x00ff0000
662 orr \tmp, \tmp, #IXP2000_VALID_IRQ_MASK & 0x0000ff00
663 orr \tmp, \tmp, #IXP2000_VALID_IRQ_MASK & 0x000000ff
664 and \irqstat, \irqstat, \tmp
671 subs \irqnr, \base, \irqnr
674 * We handle PCIA and PCIB here so we don't have an
675 * extra layer of code just to check these two bits.
677 cmp \irqnr, #IRQ_IXP2000_PCI
680 mov \base, #0xfe000000
681 orr \base, \base, #0x00fd0000
682 orr \base, \base, #0x0000e100
683 orr \base, \base, #0x00000058
684 ldr \irqstat, [\base]
688 movne \irqnr, #IRQ_IXP2000_PCIA
693 movne \irqnr, #IRQ_IXP2000_PCIB
698 .macro irq_prio_table
701 #elif defined (CONFIG_ARCH_IXP4XX)
706 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
707 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)
708 ldr \irqstat, [\irqstat] @ get interrupts
713 subs \irqnr, \base, \irqnr
716 1001: tst \irqstat, #1
717 addeq \irqnr, \irqnr, #1
718 moveq \irqstat, \irqstat, lsr #1
726 .macro irq_prio_table
729 #elif defined(CONFIG_ARCH_OMAP)
734 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
735 ldr \base, =IO_ADDRESS(OMAP_IH1_BASE)
736 ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET]
737 ldr \tmp, [\base, #IRQ_MIR_REG_OFFSET]
738 mov \irqstat, #0xffffffff
739 bic \tmp, \irqstat, \tmp
743 ldr \irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET]
745 ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
746 cmpeq \irqnr, #INT_IH2_IRQ
747 ldreq \base, =IO_ADDRESS(OMAP_IH2_BASE)
748 ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
749 addeqs \irqnr, \irqnr, #32
753 .macro irq_prio_table
756 #elif defined(CONFIG_ARCH_S3C2410)
757 /* S3C2410X IRQ Handler, <ben@simtec.co.uk> */
759 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
762 mov \tmp, #S3C2410_VA_IRQ
763 ldr \irqnr, [ \tmp, #0x14 ] @ get irq no
766 beq 1002f @ external irq reg
768 beq 1003f @ lcd controller
770 @ debug check to see if interrupt reported is the same
775 ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
776 mov \irqstat, \irqstat, lsr \irqnr
781 stmfd r13!, { r0 - r4 , r14 }
782 ldr r1, [ \tmp, #0x14 ] @ intoffset
783 ldr r2, [ \tmp, #0x10 ] @ INTPND
784 ldr r3, [ \tmp, #0x00 ] @ SRCPND
790 .ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n"
795 mov \tmp, #S3C2410_VA_IRQ
796 ldmfd r13!, { r0 - r4 , r14 }
798 @ try working out interript number for ourselves
800 ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
802 movs \irqstat, \irqstat, lsr#1
803 bcs 30000b @ try and re-start the proccess
804 add \irqnr, \irqnr, #1
808 @ found no interrupt, set Z flag and leave
814 @ we base the s3c2410x interrupts at 16 and above to allow
815 @ isa peripherals to have their standard interrupts, also
816 @ ensure that Z flag is un-set on exit
818 @ note, we cannot be sure if we get IRQ_EINT0 (0) that
819 @ there is simply no interrupt pending, so in all other
820 @ cases we jump to say we have found something, otherwise
821 @ we check to see if the interrupt really is assrted
822 adds \irqnr, \irqnr, #IRQ_EINT0
823 teq \irqnr, #IRQ_EINT0
825 ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
830 @ we get here from no main or external interrupts pending
832 add \tmp, \tmp, #S3C2410_VA_GPIO - S3C2410_VA_IRQ
833 ldr \irqstat, [ \tmp, # 0xa8 ] @ EXTINTPEND
834 ldr \irqnr, [ \tmp, # 0xa4 ] @ EXTINTMASK
836 bic \irqstat, \irqstat, \irqnr @ clear masked irqs
838 mov \irqnr, #IRQ_EINT4 @ start extint nos
839 mov \irqstat, \irqstat, lsr#4 @ ignore bottom 4 bits
841 movs \irqstat, \irqstat, lsr#1
843 add \irqnr, \irqnr, #1
844 cmp \irqnr, #IRQ_EINT23
847 @ found no interrupt, set Z flag and leave
852 @ lcd interrupt has been asserted...
853 add \tmp, \tmp, #S3C2410_VA_LCD - S3C2410_VA_IRQ
854 ldr \irqstat, [ \tmp, # 0x54 ] @ lcd int pending
857 movne \irqnr, #IRQ_LCD_FRAME
859 movne \irqnr, #IRQ_LCD_FIFO
861 @ fall through to exit with flags updated
863 1004: @ ensure Z flag clear in case our MOVS shifted out the last bit
870 /* currently don't need an disable_fiq macro */
875 /* we don't have an irq priority table */
876 .macro irq_prio_table
879 #elif defined(CONFIG_ARCH_LH7A400)
881 # if defined (CONFIG_ARCH_LH7A404)
882 # error "LH7A400 and LH7A404 are mutually exclusive"
887 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
889 mov \base, #io_p2v(0x80000000) @ APB registers
890 ldr \irqstat, [\base, #0x500] @ PIC INTSR
892 1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
893 bcs 1008f @ Bit set; irq found
894 add \irqnr, \irqnr, #1
895 bne 1001b @ Until no bits
896 b 1009f @ Nothing? Hmm.
897 1008: movs \irqstat, #1 @ Force !Z
901 .macro irq_prio_table
904 #elif defined(CONFIG_ARCH_LH7A404)
909 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
910 mov \irqnr, #0 @ VIC1 irq base
911 mov \base, #io_p2v(0x80000000) @ APB registers
912 add \base, \base, #0x8000
913 ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR
914 tst \tmp, #VA_VECTORED @ Direct vectored
916 tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1
917 ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS
919 add \base, \base, #(0xa000 - 0x8000)
920 ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR
921 tst \tmp, #VA_VECTORED @ Direct vectored
923 ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS
924 mov \irqnr, #32 @ VIC2 irq base
926 1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
927 bcs 1008f @ Bit set; irq found
928 add \irqnr, \irqnr, #1
929 bne 1001b @ Until no bits
930 b 1009f @ Nothing? Hmm.
931 1002: and \irqnr, \tmp, #0x3f @ Mask for valid bits
932 1008: movs \irqstat, #1 @ Force !Z
933 str \tmp, [\base, #0x0030] @ Clear vector
937 .macro irq_prio_table
940 #elif defined(CONFIG_ARCH_IMX)
944 #define AITC_NIVECSR 0x40
945 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
946 ldr \irqstat, =IO_ADDRESS(IMX_AITC_BASE)
947 @ Load offset & priority of the highest priority
949 ldr \irqnr, [\irqstat, #AITC_NIVECSR]
950 @ Shift off the priority leaving the offset or
952 mov \irqnr, \irqnr, lsr #16
953 ldr \irqstat, =1 @ dummy compare
954 ldr \base, =0xFFFF // invalid interrupt
959 tst \irqstat, #1 @ to make the condition code = TRUE
962 .macro irq_prio_table
965 #elif defined(CONFIG_ARCH_H720X)
970 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
971 #if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202)
972 @ we could use the id register on H7202, but this is not
973 @ properly updated when we come back from asm_do_irq
974 @ without a previous return from interrupt
975 @ (see loops below in irq_svc, irq_usr)
976 @ We see unmasked pending ints only, as the masked pending ints
977 @ are not visible here
979 mov \base, #0xf0000000 @ base register
980 orr \base, \base, #0x24000 @ irqbase
981 ldr \irqstat, [\base, #0x04] @ get interrupt status
982 #if defined (CONFIG_CPU_H7201)
983 ldr \tmp, =0x001fffff
985 mvn \tmp, #0xc0000000
987 and \irqstat, \irqstat, \tmp @ mask out unused ints
991 orr \tmp, \tmp, #0xff
993 addeq \irqnr, \irqnr, #16
994 moveq \irqstat, \irqstat, lsr #16
996 addeq \irqnr, \irqnr, #8
997 moveq \irqstat, \irqstat, lsr #8
999 addeq \irqnr, \irqnr, #4
1000 moveq \irqstat, \irqstat, lsr #4
1002 addeq \irqnr, \irqnr, #2
1003 moveq \irqstat, \irqstat, lsr #2
1005 addeq \irqnr, \irqnr, #1
1006 moveq \irqstat, \irqstat, lsr #1
1007 tst \irqstat, #1 @ bit 0 should be set
1010 .macro irq_prio_table
1014 #error hynix processor selection missmatch
1017 #error Unknown architecture
1021 * Invalid mode handlers
1023 __pabt_invalid: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
1024 stmia sp, {r0 - lr} @ Save XXX r0 - lr
1026 mov r1, #BAD_PREFETCH
1029 __dabt_invalid: sub sp, sp, #S_FRAME_SIZE
1030 stmia sp, {r0 - lr} @ Save SVC r0 - lr [lr *should* be intact]
1035 __irq_invalid: sub sp, sp, #S_FRAME_SIZE @ Allocate space on stack for frame
1036 stmfd sp, {r0 - lr} @ Save r0 - lr
1041 __und_invalid: sub sp, sp, #S_FRAME_SIZE
1044 mov r1, #BAD_UNDEFINSTR @ int reason
1047 ldmia r4, {r5 - r7} @ Get XXX pc, cpsr, old_r0
1049 stmia r4, {r5 - r7} @ Save XXX pc, cpsr, old_r0
1051 and r2, r6, #31 @ int mode
1058 __dabt_svc: sub sp, sp, #S_FRAME_SIZE
1059 stmia sp, {r0 - r12} @ save r0 - r12
1061 add r0, sp, #S_FRAME_SIZE
1062 ldmia r2, {r2 - r4} @ get pc, cpsr
1065 stmia r5, {r0 - r4} @ save sp_SVC, lr_SVC, pc, cpsr, old_ro
1066 mrs r9, cpsr @ Enable interrupts if they were
1068 biceq r9, r9, #PSR_I_BIT @ previously
1070 * This routine must not corrupt r9
1073 ldr r4, .LCprocfns @ pass r2, r3 to
1074 mov lr, pc @ processor code
1075 ldr pc, [r4] @ call processor specific code
1077 bl CPU_ABORT_HANDLER
1083 ldr r0, [sp, #S_PSR]
1085 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
1088 __irq_svc: sub sp, sp, #S_FRAME_SIZE
1089 stmia sp, {r0 - r12} @ save r0 - r12
1091 add r5, sp, #S_FRAME_SIZE
1095 stmia r4, {r5, r6, r7, r8, r9} @ save sp_SVC, lr_SVC, pc, cpsr, old_ro
1096 #ifdef CONFIG_PREEMPT
1098 ldr r9, [r8, #TI_PREEMPT] @ get preempt count
1099 add r7, r9, #1 @ increment it
1100 str r7, [r8, #TI_PREEMPT]
1102 1: get_irqnr_and_base r0, r6, r5, lr
1105 @ routine called with r0 = irq number, r1 = struct pt_regs *
1109 #ifdef CONFIG_PREEMPT
1110 ldr r0, [r8, #TI_FLAGS] @ get flags
1111 tst r0, #_TIF_NEED_RESCHED
1114 ldr r0, [r8, #TI_PREEMPT] @ read preempt value
1116 str r9, [r8, #TI_PREEMPT] @ restore preempt count
1117 strne r0, [r0, -r0] @ bug()
1119 ldr r0, [sp, #S_PSR] @ irqs are already disabled
1121 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
1125 #ifdef CONFIG_PREEMPT
1126 svc_preempt: teq r9, #0 @ was preempt count = 0
1127 ldreq r6, .LCirq_stat
1129 ldr r0, [r6, #4] @ local_irq_count
1130 ldr r1, [r6, #8] @ local_bh_count
1133 mov r7, #PREEMPT_ACTIVE
1134 str r7, [r8, #TI_PREEMPT] @ set PREEMPT_ACTIVE
1135 1: enable_irq r2 @ enable IRQs
1137 disable_irq r0 @ disable IRQs
1138 ldr r0, [r8, #TI_FLAGS] @ get new tasks TI_FLAGS
1139 tst r0, #_TIF_NEED_RESCHED
1140 beq preempt_return @ go again
1145 __und_svc: sub sp, sp, #S_FRAME_SIZE
1146 stmia sp, {r0 - r12} @ save r0 - r12
1150 add r3, sp, #S_FRAME_SIZE
1152 stmia r2, {r3 - r7} @ save sp_SVC, lr_SVC, pc, cpsr, old_ro
1154 ldr r0, [r5, #-4] @ r0 = instruction
1155 adrsvc al, r9, 1f @ r9 = normal FP return
1156 bl call_fpe @ lr = undefined instr return
1158 mov r0, sp @ struct pt_regs *regs
1162 ldr lr, [sp, #S_PSR] @ Get SVC cpsr
1164 ldmia sp, {r0 - pc}^ @ Restore SVC registers
1167 __pabt_svc: sub sp, sp, #S_FRAME_SIZE
1168 stmia sp, {r0 - r12} @ save r0 - r12
1170 add r0, sp, #S_FRAME_SIZE
1171 ldmia r2, {r2 - r4} @ get pc, cpsr
1174 stmia r5, {r0 - r4} @ save sp_SVC, lr_SVC, pc, cpsr, old_ro
1175 mrs r9, cpsr @ Enable interrupts if they were
1177 biceq r9, r9, #PSR_I_BIT @ previously
1179 mov r0, r2 @ address (pc)
1181 bl do_PrefetchAbort @ call abort handler
1183 ldr r0, [sp, #S_PSR]
1185 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
1188 .LCirq: .word __temp_irq
1189 .LCund: .word __temp_und
1190 .LCabt: .word __temp_abt
1192 .LCprocfns: .word processor
1194 .LCfp: .word fp_enter
1195 #ifdef CONFIG_PREEMPT
1196 .LCirq_stat: .word irq_stat
1202 * User mode handlers
1205 __dabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
1206 stmia sp, {r0 - r12} @ save r0 - r12
1209 ldmia r7, {r2 - r4} @ Get USR pc, cpsr
1210 stmia r5, {r2 - r4} @ Save USR pc, cpsr, old_r0
1212 alignment_trap r7, r7, __temp_abt
1215 ldr r4, .LCprocfns @ pass r2, r3 to
1216 mov lr, pc @ processor code
1217 ldr pc, [r4] @ call processor specific code
1219 bl CPU_ABORT_HANDLER
1221 enable_irq r2 @ Enable interrupts
1223 adrsvc al, lr, ret_from_exception
1227 __irq_usr: sub sp, sp, #S_FRAME_SIZE
1228 stmia sp, {r0 - r12} @ save r0 - r12
1231 ldmia r4, {r5 - r7} @ get saved PC, SPSR
1232 stmia r8, {r5 - r7} @ save pc, psr, old_r0
1234 alignment_trap r4, r7, __temp_irq
1236 #ifdef CONFIG_PREEMPT
1238 ldr r9, [r8, #TI_PREEMPT] @ get preempt count
1239 add r7, r9, #1 @ increment it
1240 str r7, [r8, #TI_PREEMPT]
1242 1: get_irqnr_and_base r0, r6, r5, lr
1246 @ routine called with r0 = irq number, r1 = struct pt_regs *
1249 #ifdef CONFIG_PREEMPT
1250 ldr r0, [r8, #TI_PREEMPT]
1252 str r9, [r8, #TI_PREEMPT]
1264 __und_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
1265 stmia sp, {r0 - r12} @ Save r0 - r12
1269 stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0
1270 stmdb r8, {sp, lr}^ @ Save user sp, lr
1271 alignment_trap r4, r7, __temp_und
1273 tst r6, #PSR_T_BIT @ Thumb mode?
1274 bne fpundefinstr @ ignore FP
1276 1: ldrt r0, [r4] @ r0 = instruction
1277 adrsvc al, r9, ret_from_exception @ r9 = normal FP return
1278 adrsvc al, lr, fpundefinstr @ lr = undefined instr return
1281 * The out of line fixup for the ldrt above.
1283 .section .fixup, "ax"
1286 .section __ex_table,"a"
1293 * Check whether the instruction is a co-processor instruction.
1294 * If yes, we need to call the relevant co-processor handler.
1296 * Note that we don't do a full check here for the co-processor
1297 * instructions; all instructions with bit 27 set are well
1298 * defined. The only instructions that should fault are the
1299 * co-processor instructions. However, we have to watch out
1300 * for the ARM6/ARM7 SWI bug.
1302 * Emulators may wish to make use of the following registers:
1303 * r0 - instruction opcode.
1304 * r10 - this threads thread_info structure.
1307 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
1308 #if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710)
1309 and r8, r0, #0x0f000000 @ mask out op-code bits
1310 teqne r8, #0x0f000000 @ SWI (ARM6/7 bug)?
1313 get_thread_info r10 @ get current thread
1314 and r8, r0, #0x00000f00 @ mask out CP number
1316 add r6, r10, #TI_USED_CP
1317 strb r7, [r6, r8, lsr #8] @ set appropriate used_cp[]
1318 #ifdef CONFIG_IWMMXT
1319 @ Test if we need to give access to iWMMXt coprocessors
1320 ldr r5, [r10, #TI_FLAGS]
1321 rsbs r7, r8, #(1 << 8) @ CP 0 or 1 only
1322 movcss r7, r5, lsr #(TIF_USING_IWMMXT + 1)
1323 bcs iwmmxt_task_enable
1326 add pc, pc, r8, lsr #6
1330 b do_fpe @ CP#1 (FPE)
1331 b do_fpe @ CP#2 (FPE)
1340 b do_vfp @ CP#10 (VFP)
1341 b do_vfp @ CP#11 (VFP)
1343 mov pc, lr @ CP#10 (VFP)
1344 mov pc, lr @ CP#11 (VFP)
1348 mov pc, lr @ CP#14 (Debug)
1349 mov pc, lr @ CP#15 (Control)
1351 do_fpe: ldr r4, .LCfp
1352 add r10, r10, #TI_FPSTATE @ r10 = workspace
1353 ldr pc, [r4] @ Call FP module USR entry point
1356 * The FP module is called with these registers set:
1359 * r9 = normal "successful" return address
1360 * r10 = FP workspace
1361 * lr = unrecognised FP instruction return address
1369 fpundefinstr: mov r0, sp
1370 adrsvc al, lr, ret_from_exception
1374 __pabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
1375 stmia sp, {r0 - r12} @ Save r0 - r12
1378 ldmia r4, {r5 - r7} @ Get USR pc, cpsr
1379 stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0
1380 stmdb r8, {sp, lr}^ @ Save sp_usr lr_usr
1381 alignment_trap r4, r7, __temp_abt
1383 enable_irq r0 @ Enable interrupts
1384 mov r0, r5 @ address (pc)
1386 bl do_PrefetchAbort @ call abort handler
1389 * This is the return code to user mode for abort handlers
1391 ENTRY(ret_from_exception)
1397 * Register switch for ARMv3 and ARMv4 processors
1398 * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
1399 * previous and next are guaranteed not to be the same.
1402 add ip, r1, #TI_CPU_SAVE
1403 ldr r3, [r2, #TI_CPU_DOMAIN]!
1404 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
1405 #if defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_IWMMXT)
1409 mcr p15, 0, r3, c3, c0, 0 @ Set domain register
1411 @ Always disable VFP so we can lazily save/restore the old
1412 @ state. This occurs in the context of the previous thread.
1414 bic r4, r4, #FPEXC_ENABLE
1417 #if defined(CONFIG_IWMMXT)
1418 bl iwmmxt_task_switch
1419 #elif defined(CONFIG_CPU_XSCALE)
1420 add r4, r2, #40 @ cpu_context_save->extra
1424 ldmib r2, {r4 - sl, fp, sp, pc} @ Load all regs saved previously
1428 * Vector stubs. NOTE that we only align 'vector_IRQ' to a cache line boundary,
1429 * and we rely on each stub being exactly 48 (1.5 cache lines) in size. This
1430 * means that we only ever load two cache lines for this code, or one if we're
1431 * lucky. We also copy this code to 0x200 so that we can use branches in the
1432 * vectors, rather than ldr's.
1437 * Interrupt dispatcher
1438 * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
1441 @ save mode specific registers
1445 str lr, [r13] @ save lr_IRQ
1447 str lr, [r13, #4] @ save spsr_IRQ
1449 @ now branch to the relevant MODE handling routine
1452 bic r13, r13, #MODE_MASK
1453 orr r13, r13, #MODE_SVC
1454 msr spsr_cxsf, r13 @ switch to SVC_32 mode
1457 ldr lr, [pc, lr, lsl #2]
1458 movs pc, lr @ Changes mode and branches
1460 .LCtab_irq: .word __irq_usr @ 0 (USR_26 / USR_32)
1461 .word __irq_invalid @ 1 (FIQ_26 / FIQ_32)
1462 .word __irq_invalid @ 2 (IRQ_26 / IRQ_32)
1463 .word __irq_svc @ 3 (SVC_26 / SVC_32)
1464 .word __irq_invalid @ 4
1465 .word __irq_invalid @ 5
1466 .word __irq_invalid @ 6
1467 .word __irq_invalid @ 7
1468 .word __irq_invalid @ 8
1469 .word __irq_invalid @ 9
1470 .word __irq_invalid @ a
1471 .word __irq_invalid @ b
1472 .word __irq_invalid @ c
1473 .word __irq_invalid @ d
1474 .word __irq_invalid @ e
1475 .word __irq_invalid @ f
1480 * Data abort dispatcher - dispatches it to the correct handler for the processor mode
1481 * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
1484 @ save mode specific registers
1492 @ now branch to the relevant MODE handling routine
1495 bic r13, r13, #MODE_MASK
1496 orr r13, r13, #MODE_SVC
1497 msr spsr_cxsf, r13 @ switch to SVC_32 mode
1500 ldr lr, [pc, lr, lsl #2]
1501 movs pc, lr @ Changes mode and branches
1503 .LCtab_dabt: .word __dabt_usr @ 0 (USR_26 / USR_32)
1504 .word __dabt_invalid @ 1 (FIQ_26 / FIQ_32)
1505 .word __dabt_invalid @ 2 (IRQ_26 / IRQ_32)
1506 .word __dabt_svc @ 3 (SVC_26 / SVC_32)
1507 .word __dabt_invalid @ 4
1508 .word __dabt_invalid @ 5
1509 .word __dabt_invalid @ 6
1510 .word __dabt_invalid @ 7
1511 .word __dabt_invalid @ 8
1512 .word __dabt_invalid @ 9
1513 .word __dabt_invalid @ a
1514 .word __dabt_invalid @ b
1515 .word __dabt_invalid @ c
1516 .word __dabt_invalid @ d
1517 .word __dabt_invalid @ e
1518 .word __dabt_invalid @ f
1523 * Prefetch abort dispatcher - dispatches it to the correct handler for the processor mode
1524 * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
1528 @ save mode specific registers
1532 str lr, [r13] @ save lr_ABT
1534 str lr, [r13, #4] @ save spsr_ABT
1536 @ now branch to the relevant MODE handling routine
1539 bic r13, r13, #MODE_MASK
1540 orr r13, r13, #MODE_SVC
1541 msr spsr_cxsf, r13 @ switch to SVC_32 mode
1544 ldr lr, [pc, lr, lsl #2]
1547 .LCtab_pabt: .word __pabt_usr @ 0 (USR_26 / USR_32)
1548 .word __pabt_invalid @ 1 (FIQ_26 / FIQ_32)
1549 .word __pabt_invalid @ 2 (IRQ_26 / IRQ_32)
1550 .word __pabt_svc @ 3 (SVC_26 / SVC_32)
1551 .word __pabt_invalid @ 4
1552 .word __pabt_invalid @ 5
1553 .word __pabt_invalid @ 6
1554 .word __pabt_invalid @ 7
1555 .word __pabt_invalid @ 8
1556 .word __pabt_invalid @ 9
1557 .word __pabt_invalid @ a
1558 .word __pabt_invalid @ b
1559 .word __pabt_invalid @ c
1560 .word __pabt_invalid @ d
1561 .word __pabt_invalid @ e
1562 .word __pabt_invalid @ f
1567 * Undef instr entry dispatcher - dispatches it to the correct handler for the processor mode
1568 * Enter in UND mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
1572 @ save mode specific registers
1575 str lr, [r13] @ save lr_UND
1577 str lr, [r13, #4] @ save spsr_UND
1579 @ now branch to the relevant MODE handling routine
1582 bic r13, r13, #MODE_MASK
1583 orr r13, r13, #MODE_SVC
1584 msr spsr_cxsf, r13 @ switch to SVC_32 mode
1587 ldr lr, [pc, lr, lsl #2]
1588 movs pc, lr @ Changes mode and branches
1590 .LCtab_und: .word __und_usr @ 0 (USR_26 / USR_32)
1591 .word __und_invalid @ 1 (FIQ_26 / FIQ_32)
1592 .word __und_invalid @ 2 (IRQ_26 / IRQ_32)
1593 .word __und_svc @ 3 (SVC_26 / SVC_32)
1594 .word __und_invalid @ 4
1595 .word __und_invalid @ 5
1596 .word __und_invalid @ 6
1597 .word __und_invalid @ 7
1598 .word __und_invalid @ 8
1599 .word __und_invalid @ 9
1600 .word __und_invalid @ a
1601 .word __und_invalid @ b
1602 .word __und_invalid @ c
1603 .word __und_invalid @ d
1604 .word __und_invalid @ e
1605 .word __und_invalid @ f
1609 /*=============================================================================
1611 *-----------------------------------------------------------------------------
1612 * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC
1613 * MUST PRESERVE SVC SPSR, but need to switch to SVC mode to show our msg.
1614 * Basically to switch modes, we *HAVE* to clobber one register... brain
1615 * damage alert! I don't think that we can execute any code in here in any
1616 * other mode than FIQ... Ok you can switch to another mode, but you can't
1617 * get out of that mode without clobbering one register.
1619 vector_FIQ: disable_fiq
1622 /*=============================================================================
1623 * Address exception handler
1624 *-----------------------------------------------------------------------------
1625 * These aren't too critical.
1626 * (they're not supposed to happen, and won't happen in 32-bit data mode).
1633 * We group all the following data together to optimise
1634 * for CPUs with separate I & D caches.
1638 .LCvswi: .word vector_swi
1640 .LCsirq: .word __temp_irq
1641 .LCsund: .word __temp_und
1642 .LCsabt: .word __temp_abt
1646 .equ __real_stubs_start, .LCvectors + 0x200
1648 .LCvectors: swi SYS_ERROR0
1649 b __real_stubs_start + (vector_undefinstr - __stubs_start)
1650 ldr pc, __real_stubs_start + (.LCvswi - __stubs_start)
1651 b __real_stubs_start + (vector_prefetch - __stubs_start)
1652 b __real_stubs_start + (vector_data - __stubs_start)
1653 b __real_stubs_start + (vector_addrexcptn - __stubs_start)
1654 b __real_stubs_start + (vector_IRQ - __stubs_start)
1655 b __real_stubs_start + (vector_FIQ - __stubs_start)
1658 stmfd sp!, {r4 - r6, lr}
1660 adr r1, .LCvectors @ set up the vectors
1661 ldmia r1, {r1, r2, r3, r4, r5, r6, ip, lr}
1662 stmia r0, {r1, r2, r3, r4, r5, r6, ip, lr}
1665 adr r0, __stubs_start @ copy stubs to 0x200
1671 LOADREGS(fd, sp!, {r4 - r6, pc})
1676 * Do not reorder these, and do not insert extra data between...
1679 __temp_irq: .word 0 @ saved lr_irq
1680 .word 0 @ saved spsr_irq
1682 __temp_und: .word 0 @ Saved lr_und
1683 .word 0 @ Saved spsr_und
1685 __temp_abt: .word 0 @ Saved lr_abt
1686 .word 0 @ Saved spsr_abt
1690 .globl cr_no_alignment