entry-armv.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. /*
  2. * linux/arch/arm/kernel/entry-armv.S
  3. *
  4. * Copyright (C) 1996,1997,1998 Russell King.
  5. * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk)
  6. *
  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.
  10. *
  11. * Low-level vector interface routines
  12. *
  13. * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction that causes
  14. * it to save wrong values... Be aware!
  15. */
  16. #include <linux/config.h>
  17. #include <asm/glue.h>
  18. #include <asm/vfpmacros.h>
  19. #include <asm/hardware.h> @ should be moved into entry-macro.S
  20. #include <asm/arch/irqs.h> @ should be moved into entry-macro.S
  21. #include <asm/arch/entry-macro.S>
  22. #include "entry-header.S"
  23. /*
  24. * Invalid mode handlers
  25. */
  26. .macro inv_entry, sym, reason
  27. sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
  28. stmia sp, {r0 - lr} @ Save XXX r0 - lr
  29. ldr r4, .LC\sym
  30. mov r1, #\reason
  31. .endm
  32. __pabt_invalid:
  33. inv_entry abt, BAD_PREFETCH
  34. b 1f
  35. __dabt_invalid:
  36. inv_entry abt, BAD_DATA
  37. b 1f
  38. __irq_invalid:
  39. inv_entry irq, BAD_IRQ
  40. b 1f
  41. __und_invalid:
  42. inv_entry und, BAD_UNDEFINSTR
  43. 1: zero_fp
  44. ldmia r4, {r5 - r7} @ Get XXX pc, cpsr, old_r0
  45. add r4, sp, #S_PC
  46. stmia r4, {r5 - r7} @ Save XXX pc, cpsr, old_r0
  47. mov r0, sp
  48. and r2, r6, #31 @ int mode
  49. b bad_mode
  50. /*
  51. * SVC mode handlers
  52. */
  53. .macro svc_entry, sym
  54. sub sp, sp, #S_FRAME_SIZE
  55. stmia sp, {r0 - r12} @ save r0 - r12
  56. ldr r2, .LC\sym
  57. add r0, sp, #S_FRAME_SIZE
  58. ldmia r2, {r2 - r4} @ get pc, cpsr
  59. add r5, sp, #S_SP
  60. mov r1, lr
  61. @
  62. @ We are now ready to fill in the remaining blanks on the stack:
  63. @
  64. @ r0 - sp_svc
  65. @ r1 - lr_svc
  66. @ r2 - lr_<exception>, already fixed up for correct return/restart
  67. @ r3 - spsr_<exception>
  68. @ r4 - orig_r0 (see pt_regs definition in ptrace.h)
  69. @
  70. stmia r5, {r0 - r4}
  71. .endm
  72. .align 5
  73. __dabt_svc:
  74. svc_entry abt
  75. @
  76. @ get ready to re-enable interrupts if appropriate
  77. @
  78. mrs r9, cpsr
  79. tst r3, #PSR_I_BIT
  80. biceq r9, r9, #PSR_I_BIT
  81. @
  82. @ Call the processor-specific abort handler:
  83. @
  84. @ r2 - aborted context pc
  85. @ r3 - aborted context cpsr
  86. @
  87. @ The abort handler must return the aborted address in r0, and
  88. @ the fault status register in r1. r9 must be preserved.
  89. @
  90. #ifdef MULTI_ABORT
  91. ldr r4, .LCprocfns
  92. mov lr, pc
  93. ldr pc, [r4]
  94. #else
  95. bl CPU_ABORT_HANDLER
  96. #endif
  97. @
  98. @ set desired IRQ state, then call main handler
  99. @
  100. msr cpsr_c, r9
  101. mov r2, sp
  102. bl do_DataAbort
  103. @
  104. @ IRQs off again before pulling preserved data off the stack
  105. @
  106. disable_irq
  107. @
  108. @ restore SPSR and restart the instruction
  109. @
  110. ldr r0, [sp, #S_PSR]
  111. msr spsr_cxsf, r0
  112. ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
  113. .align 5
  114. __irq_svc:
  115. svc_entry irq
  116. #ifdef CONFIG_PREEMPT
  117. get_thread_info r8
  118. ldr r9, [r8, #TI_PREEMPT] @ get preempt count
  119. add r7, r9, #1 @ increment it
  120. str r7, [r8, #TI_PREEMPT]
  121. #endif
  122. 1: get_irqnr_and_base r0, r6, r5, lr
  123. movne r1, sp
  124. @
  125. @ routine called with r0 = irq number, r1 = struct pt_regs *
  126. @
  127. adrne lr, 1b
  128. bne asm_do_IRQ
  129. #ifdef CONFIG_PREEMPT
  130. ldr r0, [r8, #TI_FLAGS] @ get flags
  131. tst r0, #_TIF_NEED_RESCHED
  132. blne svc_preempt
  133. preempt_return:
  134. ldr r0, [r8, #TI_PREEMPT] @ read preempt value
  135. teq r0, r7
  136. str r9, [r8, #TI_PREEMPT] @ restore preempt count
  137. strne r0, [r0, -r0] @ bug()
  138. #endif
  139. ldr r0, [sp, #S_PSR] @ irqs are already disabled
  140. msr spsr_cxsf, r0
  141. ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
  142. .ltorg
  143. #ifdef CONFIG_PREEMPT
  144. svc_preempt:
  145. teq r9, #0 @ was preempt count = 0
  146. ldreq r6, .LCirq_stat
  147. movne pc, lr @ no
  148. ldr r0, [r6, #4] @ local_irq_count
  149. ldr r1, [r6, #8] @ local_bh_count
  150. adds r0, r0, r1
  151. movne pc, lr
  152. mov r7, #0 @ preempt_schedule_irq
  153. str r7, [r8, #TI_PREEMPT] @ expects preempt_count == 0
  154. 1: bl preempt_schedule_irq @ irq en/disable is done inside
  155. ldr r0, [r8, #TI_FLAGS] @ get new tasks TI_FLAGS
  156. tst r0, #_TIF_NEED_RESCHED
  157. beq preempt_return @ go again
  158. b 1b
  159. #endif
  160. .align 5
  161. __und_svc:
  162. svc_entry und
  163. @
  164. @ call emulation code, which returns using r9 if it has emulated
  165. @ the instruction, or the more conventional lr if we are to treat
  166. @ this as a real undefined instruction
  167. @
  168. @ r0 - instruction
  169. @
  170. ldr r0, [r2, #-4]
  171. adr r9, 1f
  172. bl call_fpe
  173. mov r0, sp @ struct pt_regs *regs
  174. bl do_undefinstr
  175. @
  176. @ IRQs off again before pulling preserved data off the stack
  177. @
  178. 1: disable_irq
  179. @
  180. @ restore SPSR and restart the instruction
  181. @
  182. ldr lr, [sp, #S_PSR] @ Get SVC cpsr
  183. msr spsr_cxsf, lr
  184. ldmia sp, {r0 - pc}^ @ Restore SVC registers
  185. .align 5
  186. __pabt_svc:
  187. svc_entry abt
  188. @
  189. @ re-enable interrupts if appropriate
  190. @
  191. mrs r9, cpsr
  192. tst r3, #PSR_I_BIT
  193. biceq r9, r9, #PSR_I_BIT
  194. msr cpsr_c, r9
  195. @
  196. @ set args, then call main handler
  197. @
  198. @ r0 - address of faulting instruction
  199. @ r1 - pointer to registers on stack
  200. @
  201. mov r0, r2 @ address (pc)
  202. mov r1, sp @ regs
  203. bl do_PrefetchAbort @ call abort handler
  204. @
  205. @ IRQs off again before pulling preserved data off the stack
  206. @
  207. disable_irq
  208. @
  209. @ restore SPSR and restart the instruction
  210. @
  211. ldr r0, [sp, #S_PSR]
  212. msr spsr_cxsf, r0
  213. ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
  214. .align 5
  215. .LCirq:
  216. .word __temp_irq
  217. .LCund:
  218. .word __temp_und
  219. .LCabt:
  220. .word __temp_abt
  221. #ifdef MULTI_ABORT
  222. .LCprocfns:
  223. .word processor
  224. #endif
  225. .LCfp:
  226. .word fp_enter
  227. #ifdef CONFIG_PREEMPT
  228. .LCirq_stat:
  229. .word irq_stat
  230. #endif
  231. /*
  232. * User mode handlers
  233. */
  234. .macro usr_entry, sym
  235. sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
  236. stmia sp, {r0 - r12} @ save r0 - r12
  237. ldr r7, .LC\sym
  238. add r5, sp, #S_PC
  239. ldmia r7, {r2 - r4} @ Get USR pc, cpsr
  240. @
  241. @ We are now ready to fill in the remaining blanks on the stack:
  242. @
  243. @ r2 - lr_<exception>, already fixed up for correct return/restart
  244. @ r3 - spsr_<exception>
  245. @ r4 - orig_r0 (see pt_regs definition in ptrace.h)
  246. @
  247. @ Also, separately save sp_usr and lr_usr
  248. @
  249. stmia r5, {r2 - r4}
  250. stmdb r5, {sp, lr}^
  251. @
  252. @ Enable the alignment trap while in kernel mode
  253. @
  254. alignment_trap r7, r0, __temp_\sym
  255. @
  256. @ Clear FP to mark the first stack frame
  257. @
  258. zero_fp
  259. .endm
  260. .align 5
  261. __dabt_usr:
  262. usr_entry abt
  263. @
  264. @ Call the processor-specific abort handler:
  265. @
  266. @ r2 - aborted context pc
  267. @ r3 - aborted context cpsr
  268. @
  269. @ The abort handler must return the aborted address in r0, and
  270. @ the fault status register in r1.
  271. @
  272. #ifdef MULTI_ABORT
  273. ldr r4, .LCprocfns
  274. mov lr, pc
  275. ldr pc, [r4]
  276. #else
  277. bl CPU_ABORT_HANDLER
  278. #endif
  279. @
  280. @ IRQs on, then call the main handler
  281. @
  282. enable_irq
  283. mov r2, sp
  284. adr lr, ret_from_exception
  285. b do_DataAbort
  286. .align 5
  287. __irq_usr:
  288. usr_entry irq
  289. #ifdef CONFIG_PREEMPT
  290. get_thread_info r8
  291. ldr r9, [r8, #TI_PREEMPT] @ get preempt count
  292. add r7, r9, #1 @ increment it
  293. str r7, [r8, #TI_PREEMPT]
  294. #endif
  295. 1: get_irqnr_and_base r0, r6, r5, lr
  296. movne r1, sp
  297. adrne lr, 1b
  298. @
  299. @ routine called with r0 = irq number, r1 = struct pt_regs *
  300. @
  301. bne asm_do_IRQ
  302. #ifdef CONFIG_PREEMPT
  303. ldr r0, [r8, #TI_PREEMPT]
  304. teq r0, r7
  305. str r9, [r8, #TI_PREEMPT]
  306. strne r0, [r0, -r0]
  307. mov tsk, r8
  308. #else
  309. get_thread_info tsk
  310. #endif
  311. mov why, #0
  312. b ret_to_user
  313. .ltorg
  314. .align 5
  315. __und_usr:
  316. usr_entry und
  317. tst r3, #PSR_T_BIT @ Thumb mode?
  318. bne fpundefinstr @ ignore FP
  319. sub r4, r2, #4
  320. @
  321. @ fall through to the emulation code, which returns using r9 if
  322. @ it has emulated the instruction, or the more conventional lr
  323. @ if we are to treat this as a real undefined instruction
  324. @
  325. @ r0 - instruction
  326. @
  327. 1: ldrt r0, [r4]
  328. adr r9, ret_from_exception
  329. adr lr, fpundefinstr
  330. @
  331. @ fallthrough to call_fpe
  332. @
  333. /*
  334. * The out of line fixup for the ldrt above.
  335. */
  336. .section .fixup, "ax"
  337. 2: mov pc, r9
  338. .previous
  339. .section __ex_table,"a"
  340. .long 1b, 2b
  341. .previous
  342. /*
  343. * Check whether the instruction is a co-processor instruction.
  344. * If yes, we need to call the relevant co-processor handler.
  345. *
  346. * Note that we don't do a full check here for the co-processor
  347. * instructions; all instructions with bit 27 set are well
  348. * defined. The only instructions that should fault are the
  349. * co-processor instructions. However, we have to watch out
  350. * for the ARM6/ARM7 SWI bug.
  351. *
  352. * Emulators may wish to make use of the following registers:
  353. * r0 = instruction opcode.
  354. * r2 = PC+4
  355. * r10 = this threads thread_info structure.
  356. */
  357. call_fpe:
  358. tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
  359. #if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710)
  360. and r8, r0, #0x0f000000 @ mask out op-code bits
  361. teqne r8, #0x0f000000 @ SWI (ARM6/7 bug)?
  362. #endif
  363. moveq pc, lr
  364. get_thread_info r10 @ get current thread
  365. and r8, r0, #0x00000f00 @ mask out CP number
  366. mov r7, #1
  367. add r6, r10, #TI_USED_CP
  368. strb r7, [r6, r8, lsr #8] @ set appropriate used_cp[]
  369. #ifdef CONFIG_IWMMXT
  370. @ Test if we need to give access to iWMMXt coprocessors
  371. ldr r5, [r10, #TI_FLAGS]
  372. rsbs r7, r8, #(1 << 8) @ CP 0 or 1 only
  373. movcss r7, r5, lsr #(TIF_USING_IWMMXT + 1)
  374. bcs iwmmxt_task_enable
  375. #endif
  376. enable_irq
  377. add pc, pc, r8, lsr #6
  378. mov r0, r0
  379. mov pc, lr @ CP#0
  380. b do_fpe @ CP#1 (FPE)
  381. b do_fpe @ CP#2 (FPE)
  382. mov pc, lr @ CP#3
  383. mov pc, lr @ CP#4
  384. mov pc, lr @ CP#5
  385. mov pc, lr @ CP#6
  386. mov pc, lr @ CP#7
  387. mov pc, lr @ CP#8
  388. mov pc, lr @ CP#9
  389. #ifdef CONFIG_VFP
  390. b do_vfp @ CP#10 (VFP)
  391. b do_vfp @ CP#11 (VFP)
  392. #else
  393. mov pc, lr @ CP#10 (VFP)
  394. mov pc, lr @ CP#11 (VFP)
  395. #endif
  396. mov pc, lr @ CP#12
  397. mov pc, lr @ CP#13
  398. mov pc, lr @ CP#14 (Debug)
  399. mov pc, lr @ CP#15 (Control)
  400. do_fpe:
  401. ldr r4, .LCfp
  402. add r10, r10, #TI_FPSTATE @ r10 = workspace
  403. ldr pc, [r4] @ Call FP module USR entry point
  404. /*
  405. * The FP module is called with these registers set:
  406. * r0 = instruction
  407. * r2 = PC+4
  408. * r9 = normal "successful" return address
  409. * r10 = FP workspace
  410. * lr = unrecognised FP instruction return address
  411. */
  412. .data
  413. ENTRY(fp_enter)
  414. .word fpundefinstr
  415. .text
  416. fpundefinstr:
  417. mov r0, sp
  418. adr lr, ret_from_exception
  419. b do_undefinstr
  420. .align 5
  421. __pabt_usr:
  422. usr_entry abt
  423. enable_irq @ Enable interrupts
  424. mov r0, r2 @ address (pc)
  425. mov r1, sp @ regs
  426. bl do_PrefetchAbort @ call abort handler
  427. /* fall through */
  428. /*
  429. * This is the return code to user mode for abort handlers
  430. */
  431. ENTRY(ret_from_exception)
  432. get_thread_info tsk
  433. mov why, #0
  434. b ret_to_user
  435. /*
  436. * Register switch for ARMv3 and ARMv4 processors
  437. * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
  438. * previous and next are guaranteed not to be the same.
  439. */
  440. ENTRY(__switch_to)
  441. add ip, r1, #TI_CPU_SAVE
  442. ldr r3, [r2, #TI_TP_VALUE]
  443. stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
  444. ldr r6, [r2, #TI_CPU_DOMAIN]!
  445. #if defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_IWMMXT)
  446. mra r4, r5, acc0
  447. stmia ip, {r4, r5}
  448. #endif
  449. mov r4, #0xffff0fff
  450. str r3, [r4, #-3] @ Set TLS ptr
  451. mcr p15, 0, r6, c3, c0, 0 @ Set domain register
  452. #ifdef CONFIG_VFP
  453. @ Always disable VFP so we can lazily save/restore the old
  454. @ state. This occurs in the context of the previous thread.
  455. VFPFMRX r4, FPEXC
  456. bic r4, r4, #FPEXC_ENABLE
  457. VFPFMXR FPEXC, r4
  458. #endif
  459. #if defined(CONFIG_IWMMXT)
  460. bl iwmmxt_task_switch
  461. #elif defined(CONFIG_CPU_XSCALE)
  462. add r4, r2, #40 @ cpu_context_save->extra
  463. ldmib r4, {r4, r5}
  464. mar acc0, r4, r5
  465. #endif
  466. ldmib r2, {r4 - sl, fp, sp, pc} @ Load all regs saved previously
  467. __INIT
  468. /*
  469. * Vector stubs.
  470. *
  471. * This code is copied to 0xffff0200 so we can use branches in the
  472. * vectors, rather than ldr's. Note that this code must not
  473. * exceed 0x300 bytes.
  474. *
  475. * Common stub entry macro:
  476. * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
  477. */
  478. .macro vector_stub, name, sym, correction=0
  479. .align 5
  480. vector_\name:
  481. ldr r13, .LCs\sym
  482. .if \correction
  483. sub lr, lr, #\correction
  484. .endif
  485. str lr, [r13] @ save lr_IRQ
  486. mrs lr, spsr
  487. str lr, [r13, #4] @ save spsr_IRQ
  488. @
  489. @ now branch to the relevant MODE handling routine
  490. @
  491. mrs r13, cpsr
  492. bic r13, r13, #MODE_MASK
  493. orr r13, r13, #SVC_MODE
  494. msr spsr_cxsf, r13 @ switch to SVC_32 mode
  495. and lr, lr, #15
  496. ldr lr, [pc, lr, lsl #2]
  497. movs pc, lr @ Changes mode and branches
  498. .endm
  499. .globl __stubs_start
  500. __stubs_start:
  501. /*
  502. * Interrupt dispatcher
  503. */
  504. vector_stub irq, irq, 4
  505. .long __irq_usr @ 0 (USR_26 / USR_32)
  506. .long __irq_invalid @ 1 (FIQ_26 / FIQ_32)
  507. .long __irq_invalid @ 2 (IRQ_26 / IRQ_32)
  508. .long __irq_svc @ 3 (SVC_26 / SVC_32)
  509. .long __irq_invalid @ 4
  510. .long __irq_invalid @ 5
  511. .long __irq_invalid @ 6
  512. .long __irq_invalid @ 7
  513. .long __irq_invalid @ 8
  514. .long __irq_invalid @ 9
  515. .long __irq_invalid @ a
  516. .long __irq_invalid @ b
  517. .long __irq_invalid @ c
  518. .long __irq_invalid @ d
  519. .long __irq_invalid @ e
  520. .long __irq_invalid @ f
  521. /*
  522. * Data abort dispatcher
  523. * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
  524. */
  525. vector_stub dabt, abt, 8
  526. .long __dabt_usr @ 0 (USR_26 / USR_32)
  527. .long __dabt_invalid @ 1 (FIQ_26 / FIQ_32)
  528. .long __dabt_invalid @ 2 (IRQ_26 / IRQ_32)
  529. .long __dabt_svc @ 3 (SVC_26 / SVC_32)
  530. .long __dabt_invalid @ 4
  531. .long __dabt_invalid @ 5
  532. .long __dabt_invalid @ 6
  533. .long __dabt_invalid @ 7
  534. .long __dabt_invalid @ 8
  535. .long __dabt_invalid @ 9
  536. .long __dabt_invalid @ a
  537. .long __dabt_invalid @ b
  538. .long __dabt_invalid @ c
  539. .long __dabt_invalid @ d
  540. .long __dabt_invalid @ e
  541. .long __dabt_invalid @ f
  542. /*
  543. * Prefetch abort dispatcher
  544. * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
  545. */
  546. vector_stub pabt, abt, 4
  547. .long __pabt_usr @ 0 (USR_26 / USR_32)
  548. .long __pabt_invalid @ 1 (FIQ_26 / FIQ_32)
  549. .long __pabt_invalid @ 2 (IRQ_26 / IRQ_32)
  550. .long __pabt_svc @ 3 (SVC_26 / SVC_32)
  551. .long __pabt_invalid @ 4
  552. .long __pabt_invalid @ 5
  553. .long __pabt_invalid @ 6
  554. .long __pabt_invalid @ 7
  555. .long __pabt_invalid @ 8
  556. .long __pabt_invalid @ 9
  557. .long __pabt_invalid @ a
  558. .long __pabt_invalid @ b
  559. .long __pabt_invalid @ c
  560. .long __pabt_invalid @ d
  561. .long __pabt_invalid @ e
  562. .long __pabt_invalid @ f
  563. /*
  564. * Undef instr entry dispatcher
  565. * Enter in UND mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
  566. */
  567. vector_stub und, und
  568. .long __und_usr @ 0 (USR_26 / USR_32)
  569. .long __und_invalid @ 1 (FIQ_26 / FIQ_32)
  570. .long __und_invalid @ 2 (IRQ_26 / IRQ_32)
  571. .long __und_svc @ 3 (SVC_26 / SVC_32)
  572. .long __und_invalid @ 4
  573. .long __und_invalid @ 5
  574. .long __und_invalid @ 6
  575. .long __und_invalid @ 7
  576. .long __und_invalid @ 8
  577. .long __und_invalid @ 9
  578. .long __und_invalid @ a
  579. .long __und_invalid @ b
  580. .long __und_invalid @ c
  581. .long __und_invalid @ d
  582. .long __und_invalid @ e
  583. .long __und_invalid @ f
  584. .align 5
  585. /*=============================================================================
  586. * Undefined FIQs
  587. *-----------------------------------------------------------------------------
  588. * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC
  589. * MUST PRESERVE SVC SPSR, but need to switch to SVC mode to show our msg.
  590. * Basically to switch modes, we *HAVE* to clobber one register... brain
  591. * damage alert! I don't think that we can execute any code in here in any
  592. * other mode than FIQ... Ok you can switch to another mode, but you can't
  593. * get out of that mode without clobbering one register.
  594. */
  595. vector_fiq:
  596. disable_fiq
  597. subs pc, lr, #4
  598. /*=============================================================================
  599. * Address exception handler
  600. *-----------------------------------------------------------------------------
  601. * These aren't too critical.
  602. * (they're not supposed to happen, and won't happen in 32-bit data mode).
  603. */
  604. vector_addrexcptn:
  605. b vector_addrexcptn
  606. /*
  607. * We group all the following data together to optimise
  608. * for CPUs with separate I & D caches.
  609. */
  610. .align 5
  611. .LCvswi:
  612. .word vector_swi
  613. .LCsirq:
  614. .word __temp_irq
  615. .LCsund:
  616. .word __temp_und
  617. .LCsabt:
  618. .word __temp_abt
  619. .globl __stubs_end
  620. __stubs_end:
  621. .equ stubs_offset, __vectors_start + 0x200 - __stubs_start
  622. .globl __vectors_start
  623. __vectors_start:
  624. swi SYS_ERROR0
  625. b vector_und + stubs_offset
  626. ldr pc, .LCvswi + stubs_offset
  627. b vector_pabt + stubs_offset
  628. b vector_dabt + stubs_offset
  629. b vector_addrexcptn + stubs_offset
  630. b vector_irq + stubs_offset
  631. b vector_fiq + stubs_offset
  632. .globl __vectors_end
  633. __vectors_end:
  634. .data
  635. /*
  636. * Do not reorder these, and do not insert extra data between...
  637. */
  638. __temp_irq:
  639. .word 0 @ saved lr_irq
  640. .word 0 @ saved spsr_irq
  641. .word -1 @ old_r0
  642. __temp_und:
  643. .word 0 @ Saved lr_und
  644. .word 0 @ Saved spsr_und
  645. .word -1 @ old_r0
  646. __temp_abt:
  647. .word 0 @ Saved lr_abt
  648. .word 0 @ Saved spsr_abt
  649. .word -1 @ old_r0
  650. .globl cr_alignment
  651. .globl cr_no_alignment
  652. cr_alignment:
  653. .space 4
  654. cr_no_alignment:
  655. .space 4