entry-armv.S 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  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. * nommu support by Hyok S. Choi (hyok.choi@samsung.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * Low-level vector interface routines
  13. *
  14. * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction
  15. * that causes it to save wrong values... Be aware!
  16. */
  17. #include <linux/init.h>
  18. #include <asm/assembler.h>
  19. #include <asm/memory.h>
  20. #include <asm/glue-df.h>
  21. #include <asm/glue-pf.h>
  22. #include <asm/vfpmacros.h>
  23. #ifndef CONFIG_MULTI_IRQ_HANDLER
  24. #include <mach/entry-macro.S>
  25. #endif
  26. #include <asm/thread_notify.h>
  27. #include <asm/unwind.h>
  28. #include <asm/unistd.h>
  29. #include <asm/tls.h>
  30. #include <asm/system_info.h>
  31. #include "entry-header.S"
  32. #include <asm/entry-macro-multi.S>
  33. #include <asm/probes.h>
  34. /*
  35. * Interrupt handling.
  36. */
  37. .macro irq_handler
  38. #ifdef CONFIG_MULTI_IRQ_HANDLER
  39. ldr r1, =handle_arch_irq
  40. mov r0, sp
  41. badr lr, 9997f
  42. ldr pc, [r1]
  43. #else
  44. arch_irq_handler_default
  45. #endif
  46. 9997:
  47. .endm
  48. .macro pabt_helper
  49. @ PABORT handler takes pt_regs in r2, fault address in r4 and psr in r5
  50. #ifdef MULTI_PABORT
  51. ldr ip, .LCprocfns
  52. mov lr, pc
  53. ldr pc, [ip, #PROCESSOR_PABT_FUNC]
  54. #else
  55. bl CPU_PABORT_HANDLER
  56. #endif
  57. .endm
  58. .macro dabt_helper
  59. @
  60. @ Call the processor-specific abort handler:
  61. @
  62. @ r2 - pt_regs
  63. @ r4 - aborted context pc
  64. @ r5 - aborted context psr
  65. @
  66. @ The abort handler must return the aborted address in r0, and
  67. @ the fault status register in r1. r9 must be preserved.
  68. @
  69. #ifdef MULTI_DABORT
  70. ldr ip, .LCprocfns
  71. mov lr, pc
  72. ldr pc, [ip, #PROCESSOR_DABT_FUNC]
  73. #else
  74. bl CPU_DABORT_HANDLER
  75. #endif
  76. .endm
  77. #ifdef CONFIG_KPROBES
  78. .section .kprobes.text,"ax",%progbits
  79. #else
  80. .text
  81. #endif
  82. /*
  83. * Invalid mode handlers
  84. */
  85. .macro inv_entry, reason
  86. sub sp, sp, #S_FRAME_SIZE
  87. ARM( stmib sp, {r1 - lr} )
  88. THUMB( stmia sp, {r0 - r12} )
  89. THUMB( str sp, [sp, #S_SP] )
  90. THUMB( str lr, [sp, #S_LR] )
  91. mov r1, #\reason
  92. .endm
  93. __pabt_invalid:
  94. inv_entry BAD_PREFETCH
  95. b common_invalid
  96. ENDPROC(__pabt_invalid)
  97. __dabt_invalid:
  98. inv_entry BAD_DATA
  99. b common_invalid
  100. ENDPROC(__dabt_invalid)
  101. __irq_invalid:
  102. inv_entry BAD_IRQ
  103. b common_invalid
  104. ENDPROC(__irq_invalid)
  105. __und_invalid:
  106. inv_entry BAD_UNDEFINSTR
  107. @
  108. @ XXX fall through to common_invalid
  109. @
  110. @
  111. @ common_invalid - generic code for failed exception (re-entrant version of handlers)
  112. @
  113. common_invalid:
  114. zero_fp
  115. ldmia r0, {r4 - r6}
  116. add r0, sp, #S_PC @ here for interlock avoidance
  117. mov r7, #-1 @ "" "" "" ""
  118. str r4, [sp] @ save preserved r0
  119. stmia r0, {r5 - r7} @ lr_<exception>,
  120. @ cpsr_<exception>, "old_r0"
  121. mov r0, sp
  122. b bad_mode
  123. ENDPROC(__und_invalid)
  124. /*
  125. * SVC mode handlers
  126. */
  127. #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
  128. #define SPFIX(code...) code
  129. #else
  130. #define SPFIX(code...)
  131. #endif
  132. .macro svc_entry, stack_hole=0, trace=1, uaccess=1
  133. UNWIND(.fnstart )
  134. UNWIND(.save {r0 - pc} )
  135. sub sp, sp, #(S_FRAME_SIZE + 8 + \stack_hole - 4)
  136. #ifdef CONFIG_THUMB2_KERNEL
  137. SPFIX( str r0, [sp] ) @ temporarily saved
  138. SPFIX( mov r0, sp )
  139. SPFIX( tst r0, #4 ) @ test original stack alignment
  140. SPFIX( ldr r0, [sp] ) @ restored
  141. #else
  142. SPFIX( tst sp, #4 )
  143. #endif
  144. SPFIX( subeq sp, sp, #4 )
  145. stmia sp, {r1 - r12}
  146. ldmia r0, {r3 - r5}
  147. add r7, sp, #S_SP - 4 @ here for interlock avoidance
  148. mov r6, #-1 @ "" "" "" ""
  149. add r2, sp, #(S_FRAME_SIZE + 8 + \stack_hole - 4)
  150. SPFIX( addeq r2, r2, #4 )
  151. str r3, [sp, #-4]! @ save the "real" r0 copied
  152. @ from the exception stack
  153. mov r3, lr
  154. @
  155. @ We are now ready to fill in the remaining blanks on the stack:
  156. @
  157. @ r2 - sp_svc
  158. @ r3 - lr_svc
  159. @ r4 - lr_<exception>, already fixed up for correct return/restart
  160. @ r5 - spsr_<exception>
  161. @ r6 - orig_r0 (see pt_regs definition in ptrace.h)
  162. @
  163. stmia r7, {r2 - r6}
  164. uaccess_save r0
  165. .if \uaccess
  166. uaccess_disable r0
  167. .endif
  168. .if \trace
  169. #ifdef CONFIG_TRACE_IRQFLAGS
  170. bl trace_hardirqs_off
  171. #endif
  172. .endif
  173. .endm
  174. .align 5
  175. __dabt_svc:
  176. svc_entry uaccess=0
  177. mov r2, sp
  178. dabt_helper
  179. THUMB( ldr r5, [sp, #S_PSR] ) @ potentially updated CPSR
  180. svc_exit r5 @ return from exception
  181. UNWIND(.fnend )
  182. ENDPROC(__dabt_svc)
  183. .align 5
  184. __irq_svc:
  185. svc_entry
  186. irq_handler
  187. #ifdef CONFIG_PREEMPT
  188. get_thread_info tsk
  189. ldr r8, [tsk, #TI_PREEMPT] @ get preempt count
  190. ldr r0, [tsk, #TI_FLAGS] @ get flags
  191. teq r8, #0 @ if preempt count != 0
  192. movne r0, #0 @ force flags to 0
  193. tst r0, #_TIF_NEED_RESCHED
  194. blne svc_preempt
  195. #endif
  196. svc_exit r5, irq = 1 @ return from exception
  197. UNWIND(.fnend )
  198. ENDPROC(__irq_svc)
  199. .ltorg
  200. #ifdef CONFIG_PREEMPT
  201. svc_preempt:
  202. mov r8, lr
  203. 1: bl preempt_schedule_irq @ irq en/disable is done inside
  204. ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS
  205. tst r0, #_TIF_NEED_RESCHED
  206. reteq r8 @ go again
  207. b 1b
  208. #endif
  209. __und_fault:
  210. @ Correct the PC such that it is pointing at the instruction
  211. @ which caused the fault. If the faulting instruction was ARM
  212. @ the PC will be pointing at the next instruction, and have to
  213. @ subtract 4. Otherwise, it is Thumb, and the PC will be
  214. @ pointing at the second half of the Thumb instruction. We
  215. @ have to subtract 2.
  216. ldr r2, [r0, #S_PC]
  217. sub r2, r2, r1
  218. str r2, [r0, #S_PC]
  219. b do_undefinstr
  220. ENDPROC(__und_fault)
  221. .align 5
  222. __und_svc:
  223. #ifdef CONFIG_KPROBES
  224. @ If a kprobe is about to simulate a "stmdb sp..." instruction,
  225. @ it obviously needs free stack space which then will belong to
  226. @ the saved context.
  227. svc_entry MAX_STACK_SIZE
  228. #else
  229. svc_entry
  230. #endif
  231. @
  232. @ call emulation code, which returns using r9 if it has emulated
  233. @ the instruction, or the more conventional lr if we are to treat
  234. @ this as a real undefined instruction
  235. @
  236. @ r0 - instruction
  237. @
  238. #ifndef CONFIG_THUMB2_KERNEL
  239. ldr r0, [r4, #-4]
  240. #else
  241. mov r1, #2
  242. ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2
  243. cmp r0, #0xe800 @ 32-bit instruction if xx >= 0
  244. blo __und_svc_fault
  245. ldrh r9, [r4] @ bottom 16 bits
  246. add r4, r4, #2
  247. str r4, [sp, #S_PC]
  248. orr r0, r9, r0, lsl #16
  249. #endif
  250. badr r9, __und_svc_finish
  251. mov r2, r4
  252. bl call_fpe
  253. mov r1, #4 @ PC correction to apply
  254. __und_svc_fault:
  255. mov r0, sp @ struct pt_regs *regs
  256. bl __und_fault
  257. __und_svc_finish:
  258. ldr r5, [sp, #S_PSR] @ Get SVC cpsr
  259. svc_exit r5 @ return from exception
  260. UNWIND(.fnend )
  261. ENDPROC(__und_svc)
  262. .align 5
  263. __pabt_svc:
  264. svc_entry
  265. mov r2, sp @ regs
  266. pabt_helper
  267. svc_exit r5 @ return from exception
  268. UNWIND(.fnend )
  269. ENDPROC(__pabt_svc)
  270. .align 5
  271. __fiq_svc:
  272. svc_entry trace=0
  273. mov r0, sp @ struct pt_regs *regs
  274. bl handle_fiq_as_nmi
  275. svc_exit_via_fiq
  276. UNWIND(.fnend )
  277. ENDPROC(__fiq_svc)
  278. .align 5
  279. .LCcralign:
  280. .word cr_alignment
  281. #ifdef MULTI_DABORT
  282. .LCprocfns:
  283. .word processor
  284. #endif
  285. .LCfp:
  286. .word fp_enter
  287. /*
  288. * Abort mode handlers
  289. */
  290. @
  291. @ Taking a FIQ in abort mode is similar to taking a FIQ in SVC mode
  292. @ and reuses the same macros. However in abort mode we must also
  293. @ save/restore lr_abt and spsr_abt to make nested aborts safe.
  294. @
  295. .align 5
  296. __fiq_abt:
  297. svc_entry trace=0
  298. ARM( msr cpsr_c, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
  299. THUMB( mov r0, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
  300. THUMB( msr cpsr_c, r0 )
  301. mov r1, lr @ Save lr_abt
  302. mrs r2, spsr @ Save spsr_abt, abort is now safe
  303. ARM( msr cpsr_c, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
  304. THUMB( mov r0, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
  305. THUMB( msr cpsr_c, r0 )
  306. stmfd sp!, {r1 - r2}
  307. add r0, sp, #8 @ struct pt_regs *regs
  308. bl handle_fiq_as_nmi
  309. ldmfd sp!, {r1 - r2}
  310. ARM( msr cpsr_c, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
  311. THUMB( mov r0, #ABT_MODE | PSR_I_BIT | PSR_F_BIT )
  312. THUMB( msr cpsr_c, r0 )
  313. mov lr, r1 @ Restore lr_abt, abort is unsafe
  314. msr spsr_cxsf, r2 @ Restore spsr_abt
  315. ARM( msr cpsr_c, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
  316. THUMB( mov r0, #SVC_MODE | PSR_I_BIT | PSR_F_BIT )
  317. THUMB( msr cpsr_c, r0 )
  318. svc_exit_via_fiq
  319. UNWIND(.fnend )
  320. ENDPROC(__fiq_abt)
  321. /*
  322. * User mode handlers
  323. *
  324. * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  325. */
  326. #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)
  327. #error "sizeof(struct pt_regs) must be a multiple of 8"
  328. #endif
  329. .macro usr_entry, trace=1, uaccess=1
  330. UNWIND(.fnstart )
  331. UNWIND(.cantunwind ) @ don't unwind the user space
  332. sub sp, sp, #S_FRAME_SIZE
  333. ARM( stmib sp, {r1 - r12} )
  334. THUMB( stmia sp, {r0 - r12} )
  335. ATRAP( mrc p15, 0, r7, c1, c0, 0)
  336. ATRAP( ldr r8, .LCcralign)
  337. ldmia r0, {r3 - r5}
  338. add r0, sp, #S_PC @ here for interlock avoidance
  339. mov r6, #-1 @ "" "" "" ""
  340. str r3, [sp] @ save the "real" r0 copied
  341. @ from the exception stack
  342. ATRAP( ldr r8, [r8, #0])
  343. @
  344. @ We are now ready to fill in the remaining blanks on the stack:
  345. @
  346. @ r4 - lr_<exception>, already fixed up for correct return/restart
  347. @ r5 - spsr_<exception>
  348. @ r6 - orig_r0 (see pt_regs definition in ptrace.h)
  349. @
  350. @ Also, separately save sp_usr and lr_usr
  351. @
  352. stmia r0, {r4 - r6}
  353. ARM( stmdb r0, {sp, lr}^ )
  354. THUMB( store_user_sp_lr r0, r1, S_SP - S_PC )
  355. .if \uaccess
  356. uaccess_disable ip
  357. .endif
  358. @ Enable the alignment trap while in kernel mode
  359. ATRAP( teq r8, r7)
  360. ATRAP( mcrne p15, 0, r8, c1, c0, 0)
  361. @
  362. @ Clear FP to mark the first stack frame
  363. @
  364. zero_fp
  365. .if \trace
  366. #ifdef CONFIG_TRACE_IRQFLAGS
  367. bl trace_hardirqs_off
  368. #endif
  369. ct_user_exit save = 0
  370. .endif
  371. .endm
  372. .macro kuser_cmpxchg_check
  373. #if !defined(CONFIG_CPU_32v6K) && defined(CONFIG_KUSER_HELPERS) && \
  374. !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
  375. #ifndef CONFIG_MMU
  376. #warning "NPTL on non MMU needs fixing"
  377. #else
  378. @ Make sure our user space atomic helper is restarted
  379. @ if it was interrupted in a critical region. Here we
  380. @ perform a quick test inline since it should be false
  381. @ 99.9999% of the time. The rest is done out of line.
  382. cmp r4, #TASK_SIZE
  383. blhs kuser_cmpxchg64_fixup
  384. #endif
  385. #endif
  386. .endm
  387. .align 5
  388. __dabt_usr:
  389. usr_entry uaccess=0
  390. kuser_cmpxchg_check
  391. mov r2, sp
  392. dabt_helper
  393. b ret_from_exception
  394. UNWIND(.fnend )
  395. ENDPROC(__dabt_usr)
  396. .align 5
  397. __irq_usr:
  398. usr_entry
  399. kuser_cmpxchg_check
  400. irq_handler
  401. get_thread_info tsk
  402. mov why, #0
  403. b ret_to_user_from_irq
  404. UNWIND(.fnend )
  405. ENDPROC(__irq_usr)
  406. .ltorg
  407. .align 5
  408. __und_usr:
  409. usr_entry uaccess=0
  410. mov r2, r4
  411. mov r3, r5
  412. @ r2 = regs->ARM_pc, which is either 2 or 4 bytes ahead of the
  413. @ faulting instruction depending on Thumb mode.
  414. @ r3 = regs->ARM_cpsr
  415. @
  416. @ The emulation code returns using r9 if it has emulated the
  417. @ instruction, or the more conventional lr if we are to treat
  418. @ this as a real undefined instruction
  419. @
  420. badr r9, ret_from_exception
  421. @ IRQs must be enabled before attempting to read the instruction from
  422. @ user space since that could cause a page/translation fault if the
  423. @ page table was modified by another CPU.
  424. enable_irq
  425. tst r3, #PSR_T_BIT @ Thumb mode?
  426. bne __und_usr_thumb
  427. sub r4, r2, #4 @ ARM instr at LR - 4
  428. 1: ldrt r0, [r4]
  429. ARM_BE8(rev r0, r0) @ little endian instruction
  430. uaccess_disable ip
  431. @ r0 = 32-bit ARM instruction which caused the exception
  432. @ r2 = PC value for the following instruction (:= regs->ARM_pc)
  433. @ r4 = PC value for the faulting instruction
  434. @ lr = 32-bit undefined instruction function
  435. badr lr, __und_usr_fault_32
  436. b call_fpe
  437. __und_usr_thumb:
  438. @ Thumb instruction
  439. sub r4, r2, #2 @ First half of thumb instr at LR - 2
  440. #if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
  441. /*
  442. * Thumb-2 instruction handling. Note that because pre-v6 and >= v6 platforms
  443. * can never be supported in a single kernel, this code is not applicable at
  444. * all when __LINUX_ARM_ARCH__ < 6. This allows simplifying assumptions to be
  445. * made about .arch directives.
  446. */
  447. #if __LINUX_ARM_ARCH__ < 7
  448. /* If the target CPU may not be Thumb-2-capable, a run-time check is needed: */
  449. #define NEED_CPU_ARCHITECTURE
  450. ldr r5, .LCcpu_architecture
  451. ldr r5, [r5]
  452. cmp r5, #CPU_ARCH_ARMv7
  453. blo __und_usr_fault_16 @ 16bit undefined instruction
  454. /*
  455. * The following code won't get run unless the running CPU really is v7, so
  456. * coding round the lack of ldrht on older arches is pointless. Temporarily
  457. * override the assembler target arch with the minimum required instead:
  458. */
  459. .arch armv6t2
  460. #endif
  461. 2: ldrht r5, [r4]
  462. ARM_BE8(rev16 r5, r5) @ little endian instruction
  463. cmp r5, #0xe800 @ 32bit instruction if xx != 0
  464. blo __und_usr_fault_16_pan @ 16bit undefined instruction
  465. 3: ldrht r0, [r2]
  466. ARM_BE8(rev16 r0, r0) @ little endian instruction
  467. uaccess_disable ip
  468. add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
  469. str r2, [sp, #S_PC] @ it's a 2x16bit instr, update
  470. orr r0, r0, r5, lsl #16
  471. badr lr, __und_usr_fault_32
  472. @ r0 = the two 16-bit Thumb instructions which caused the exception
  473. @ r2 = PC value for the following Thumb instruction (:= regs->ARM_pc)
  474. @ r4 = PC value for the first 16-bit Thumb instruction
  475. @ lr = 32bit undefined instruction function
  476. #if __LINUX_ARM_ARCH__ < 7
  477. /* If the target arch was overridden, change it back: */
  478. #ifdef CONFIG_CPU_32v6K
  479. .arch armv6k
  480. #else
  481. .arch armv6
  482. #endif
  483. #endif /* __LINUX_ARM_ARCH__ < 7 */
  484. #else /* !(CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7) */
  485. b __und_usr_fault_16
  486. #endif
  487. UNWIND(.fnend)
  488. ENDPROC(__und_usr)
  489. /*
  490. * The out of line fixup for the ldrt instructions above.
  491. */
  492. .pushsection .text.fixup, "ax"
  493. .align 2
  494. 4: str r4, [sp, #S_PC] @ retry current instruction
  495. ret r9
  496. .popsection
  497. .pushsection __ex_table,"a"
  498. .long 1b, 4b
  499. #if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
  500. .long 2b, 4b
  501. .long 3b, 4b
  502. #endif
  503. .popsection
  504. /*
  505. * Check whether the instruction is a co-processor instruction.
  506. * If yes, we need to call the relevant co-processor handler.
  507. *
  508. * Note that we don't do a full check here for the co-processor
  509. * instructions; all instructions with bit 27 set are well
  510. * defined. The only instructions that should fault are the
  511. * co-processor instructions. However, we have to watch out
  512. * for the ARM6/ARM7 SWI bug.
  513. *
  514. * NEON is a special case that has to be handled here. Not all
  515. * NEON instructions are co-processor instructions, so we have
  516. * to make a special case of checking for them. Plus, there's
  517. * five groups of them, so we have a table of mask/opcode pairs
  518. * to check against, and if any match then we branch off into the
  519. * NEON handler code.
  520. *
  521. * Emulators may wish to make use of the following registers:
  522. * r0 = instruction opcode (32-bit ARM or two 16-bit Thumb)
  523. * r2 = PC value to resume execution after successful emulation
  524. * r9 = normal "successful" return address
  525. * r10 = this threads thread_info structure
  526. * lr = unrecognised instruction return address
  527. * IRQs enabled, FIQs enabled.
  528. */
  529. @
  530. @ Fall-through from Thumb-2 __und_usr
  531. @
  532. #ifdef CONFIG_NEON
  533. get_thread_info r10 @ get current thread
  534. adr r6, .LCneon_thumb_opcodes
  535. b 2f
  536. #endif
  537. call_fpe:
  538. get_thread_info r10 @ get current thread
  539. #ifdef CONFIG_NEON
  540. adr r6, .LCneon_arm_opcodes
  541. 2: ldr r5, [r6], #4 @ mask value
  542. ldr r7, [r6], #4 @ opcode bits matching in mask
  543. cmp r5, #0 @ end mask?
  544. beq 1f
  545. and r8, r0, r5
  546. cmp r8, r7 @ NEON instruction?
  547. bne 2b
  548. mov r7, #1
  549. strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used
  550. strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used
  551. b do_vfp @ let VFP handler handle this
  552. 1:
  553. #endif
  554. tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
  555. tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2
  556. reteq lr
  557. and r8, r0, #0x00000f00 @ mask out CP number
  558. THUMB( lsr r8, r8, #8 )
  559. mov r7, #1
  560. add r6, r10, #TI_USED_CP
  561. ARM( strb r7, [r6, r8, lsr #8] ) @ set appropriate used_cp[]
  562. THUMB( strb r7, [r6, r8] ) @ set appropriate used_cp[]
  563. #ifdef CONFIG_IWMMXT
  564. @ Test if we need to give access to iWMMXt coprocessors
  565. ldr r5, [r10, #TI_FLAGS]
  566. rsbs r7, r8, #(1 << 8) @ CP 0 or 1 only
  567. movcss r7, r5, lsr #(TIF_USING_IWMMXT + 1)
  568. bcs iwmmxt_task_enable
  569. #endif
  570. ARM( add pc, pc, r8, lsr #6 )
  571. THUMB( lsl r8, r8, #2 )
  572. THUMB( add pc, r8 )
  573. nop
  574. ret.w lr @ CP#0
  575. W(b) do_fpe @ CP#1 (FPE)
  576. W(b) do_fpe @ CP#2 (FPE)
  577. ret.w lr @ CP#3
  578. #ifdef CONFIG_CRUNCH
  579. b crunch_task_enable @ CP#4 (MaverickCrunch)
  580. b crunch_task_enable @ CP#5 (MaverickCrunch)
  581. b crunch_task_enable @ CP#6 (MaverickCrunch)
  582. #else
  583. ret.w lr @ CP#4
  584. ret.w lr @ CP#5
  585. ret.w lr @ CP#6
  586. #endif
  587. ret.w lr @ CP#7
  588. ret.w lr @ CP#8
  589. ret.w lr @ CP#9
  590. #ifdef CONFIG_VFP
  591. W(b) do_vfp @ CP#10 (VFP)
  592. W(b) do_vfp @ CP#11 (VFP)
  593. #else
  594. ret.w lr @ CP#10 (VFP)
  595. ret.w lr @ CP#11 (VFP)
  596. #endif
  597. ret.w lr @ CP#12
  598. ret.w lr @ CP#13
  599. ret.w lr @ CP#14 (Debug)
  600. ret.w lr @ CP#15 (Control)
  601. #ifdef NEED_CPU_ARCHITECTURE
  602. .align 2
  603. .LCcpu_architecture:
  604. .word __cpu_architecture
  605. #endif
  606. #ifdef CONFIG_NEON
  607. .align 6
  608. .LCneon_arm_opcodes:
  609. .word 0xfe000000 @ mask
  610. .word 0xf2000000 @ opcode
  611. .word 0xff100000 @ mask
  612. .word 0xf4000000 @ opcode
  613. .word 0x00000000 @ mask
  614. .word 0x00000000 @ opcode
  615. .LCneon_thumb_opcodes:
  616. .word 0xef000000 @ mask
  617. .word 0xef000000 @ opcode
  618. .word 0xff100000 @ mask
  619. .word 0xf9000000 @ opcode
  620. .word 0x00000000 @ mask
  621. .word 0x00000000 @ opcode
  622. #endif
  623. do_fpe:
  624. ldr r4, .LCfp
  625. add r10, r10, #TI_FPSTATE @ r10 = workspace
  626. ldr pc, [r4] @ Call FP module USR entry point
  627. /*
  628. * The FP module is called with these registers set:
  629. * r0 = instruction
  630. * r2 = PC+4
  631. * r9 = normal "successful" return address
  632. * r10 = FP workspace
  633. * lr = unrecognised FP instruction return address
  634. */
  635. .pushsection .data
  636. ENTRY(fp_enter)
  637. .word no_fp
  638. .popsection
  639. ENTRY(no_fp)
  640. ret lr
  641. ENDPROC(no_fp)
  642. __und_usr_fault_32:
  643. mov r1, #4
  644. b 1f
  645. __und_usr_fault_16_pan:
  646. uaccess_disable ip
  647. __und_usr_fault_16:
  648. mov r1, #2
  649. 1: mov r0, sp
  650. badr lr, ret_from_exception
  651. b __und_fault
  652. ENDPROC(__und_usr_fault_32)
  653. ENDPROC(__und_usr_fault_16)
  654. .align 5
  655. __pabt_usr:
  656. usr_entry
  657. mov r2, sp @ regs
  658. pabt_helper
  659. UNWIND(.fnend )
  660. /* fall through */
  661. /*
  662. * This is the return code to user mode for abort handlers
  663. */
  664. ENTRY(ret_from_exception)
  665. UNWIND(.fnstart )
  666. UNWIND(.cantunwind )
  667. get_thread_info tsk
  668. mov why, #0
  669. b ret_to_user
  670. UNWIND(.fnend )
  671. ENDPROC(__pabt_usr)
  672. ENDPROC(ret_from_exception)
  673. .align 5
  674. __fiq_usr:
  675. usr_entry trace=0
  676. kuser_cmpxchg_check
  677. mov r0, sp @ struct pt_regs *regs
  678. bl handle_fiq_as_nmi
  679. get_thread_info tsk
  680. restore_user_regs fast = 0, offset = 0
  681. UNWIND(.fnend )
  682. ENDPROC(__fiq_usr)
  683. /*
  684. * Register switch for ARMv3 and ARMv4 processors
  685. * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
  686. * previous and next are guaranteed not to be the same.
  687. */
  688. ENTRY(__switch_to)
  689. UNWIND(.fnstart )
  690. UNWIND(.cantunwind )
  691. add ip, r1, #TI_CPU_SAVE
  692. ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack
  693. THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
  694. THUMB( str sp, [ip], #4 )
  695. THUMB( str lr, [ip], #4 )
  696. ldr r4, [r2, #TI_TP_VALUE]
  697. ldr r5, [r2, #TI_TP_VALUE + 4]
  698. #ifdef CONFIG_CPU_USE_DOMAINS
  699. mrc p15, 0, r6, c3, c0, 0 @ Get domain register
  700. str r6, [r1, #TI_CPU_DOMAIN] @ Save old domain register
  701. ldr r6, [r2, #TI_CPU_DOMAIN]
  702. #endif
  703. switch_tls r1, r4, r5, r3, r7
  704. #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
  705. ldr r7, [r2, #TI_TASK]
  706. ldr r8, =__stack_chk_guard
  707. ldr r7, [r7, #TSK_STACK_CANARY]
  708. #endif
  709. #ifdef CONFIG_CPU_USE_DOMAINS
  710. mcr p15, 0, r6, c3, c0, 0 @ Set domain register
  711. #endif
  712. mov r5, r0
  713. add r4, r2, #TI_CPU_SAVE
  714. ldr r0, =thread_notify_head
  715. mov r1, #THREAD_NOTIFY_SWITCH
  716. bl atomic_notifier_call_chain
  717. #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
  718. str r7, [r8]
  719. #endif
  720. THUMB( mov ip, r4 )
  721. mov r0, r5
  722. ARM( ldmia r4, {r4 - sl, fp, sp, pc} ) @ Load all regs saved previously
  723. THUMB( ldmia ip!, {r4 - sl, fp} ) @ Load all regs saved previously
  724. THUMB( ldr sp, [ip], #4 )
  725. THUMB( ldr pc, [ip] )
  726. UNWIND(.fnend )
  727. ENDPROC(__switch_to)
  728. __INIT
  729. /*
  730. * User helpers.
  731. *
  732. * Each segment is 32-byte aligned and will be moved to the top of the high
  733. * vector page. New segments (if ever needed) must be added in front of
  734. * existing ones. This mechanism should be used only for things that are
  735. * really small and justified, and not be abused freely.
  736. *
  737. * See Documentation/arm/kernel_user_helpers.txt for formal definitions.
  738. */
  739. THUMB( .arm )
  740. .macro usr_ret, reg
  741. #ifdef CONFIG_ARM_THUMB
  742. bx \reg
  743. #else
  744. ret \reg
  745. #endif
  746. .endm
  747. .macro kuser_pad, sym, size
  748. .if (. - \sym) & 3
  749. .rept 4 - (. - \sym) & 3
  750. .byte 0
  751. .endr
  752. .endif
  753. .rept (\size - (. - \sym)) / 4
  754. .word 0xe7fddef1
  755. .endr
  756. .endm
  757. #ifdef CONFIG_KUSER_HELPERS
  758. .align 5
  759. .globl __kuser_helper_start
  760. __kuser_helper_start:
  761. /*
  762. * Due to the length of some sequences, __kuser_cmpxchg64 spans 2 regular
  763. * kuser "slots", therefore 0xffff0f80 is not used as a valid entry point.
  764. */
  765. __kuser_cmpxchg64: @ 0xffff0f60
  766. #if defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
  767. /*
  768. * Poor you. No fast solution possible...
  769. * The kernel itself must perform the operation.
  770. * A special ghost syscall is used for that (see traps.c).
  771. */
  772. stmfd sp!, {r7, lr}
  773. ldr r7, 1f @ it's 20 bits
  774. swi __ARM_NR_cmpxchg64
  775. ldmfd sp!, {r7, pc}
  776. 1: .word __ARM_NR_cmpxchg64
  777. #elif defined(CONFIG_CPU_32v6K)
  778. stmfd sp!, {r4, r5, r6, r7}
  779. ldrd r4, r5, [r0] @ load old val
  780. ldrd r6, r7, [r1] @ load new val
  781. smp_dmb arm
  782. 1: ldrexd r0, r1, [r2] @ load current val
  783. eors r3, r0, r4 @ compare with oldval (1)
  784. eoreqs r3, r1, r5 @ compare with oldval (2)
  785. strexdeq r3, r6, r7, [r2] @ store newval if eq
  786. teqeq r3, #1 @ success?
  787. beq 1b @ if no then retry
  788. smp_dmb arm
  789. rsbs r0, r3, #0 @ set returned val and C flag
  790. ldmfd sp!, {r4, r5, r6, r7}
  791. usr_ret lr
  792. #elif !defined(CONFIG_SMP)
  793. #ifdef CONFIG_MMU
  794. /*
  795. * The only thing that can break atomicity in this cmpxchg64
  796. * implementation is either an IRQ or a data abort exception
  797. * causing another process/thread to be scheduled in the middle of
  798. * the critical sequence. The same strategy as for cmpxchg is used.
  799. */
  800. stmfd sp!, {r4, r5, r6, lr}
  801. ldmia r0, {r4, r5} @ load old val
  802. ldmia r1, {r6, lr} @ load new val
  803. 1: ldmia r2, {r0, r1} @ load current val
  804. eors r3, r0, r4 @ compare with oldval (1)
  805. eoreqs r3, r1, r5 @ compare with oldval (2)
  806. 2: stmeqia r2, {r6, lr} @ store newval if eq
  807. rsbs r0, r3, #0 @ set return val and C flag
  808. ldmfd sp!, {r4, r5, r6, pc}
  809. .text
  810. kuser_cmpxchg64_fixup:
  811. @ Called from kuser_cmpxchg_fixup.
  812. @ r4 = address of interrupted insn (must be preserved).
  813. @ sp = saved regs. r7 and r8 are clobbered.
  814. @ 1b = first critical insn, 2b = last critical insn.
  815. @ If r4 >= 1b and r4 <= 2b then saved pc_usr is set to 1b.
  816. mov r7, #0xffff0fff
  817. sub r7, r7, #(0xffff0fff - (0xffff0f60 + (1b - __kuser_cmpxchg64)))
  818. subs r8, r4, r7
  819. rsbcss r8, r8, #(2b - 1b)
  820. strcs r7, [sp, #S_PC]
  821. #if __LINUX_ARM_ARCH__ < 6
  822. bcc kuser_cmpxchg32_fixup
  823. #endif
  824. ret lr
  825. .previous
  826. #else
  827. #warning "NPTL on non MMU needs fixing"
  828. mov r0, #-1
  829. adds r0, r0, #0
  830. usr_ret lr
  831. #endif
  832. #else
  833. #error "incoherent kernel configuration"
  834. #endif
  835. kuser_pad __kuser_cmpxchg64, 64
  836. __kuser_memory_barrier: @ 0xffff0fa0
  837. smp_dmb arm
  838. usr_ret lr
  839. kuser_pad __kuser_memory_barrier, 32
  840. __kuser_cmpxchg: @ 0xffff0fc0
  841. #if defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
  842. /*
  843. * Poor you. No fast solution possible...
  844. * The kernel itself must perform the operation.
  845. * A special ghost syscall is used for that (see traps.c).
  846. */
  847. stmfd sp!, {r7, lr}
  848. ldr r7, 1f @ it's 20 bits
  849. swi __ARM_NR_cmpxchg
  850. ldmfd sp!, {r7, pc}
  851. 1: .word __ARM_NR_cmpxchg
  852. #elif __LINUX_ARM_ARCH__ < 6
  853. #ifdef CONFIG_MMU
  854. /*
  855. * The only thing that can break atomicity in this cmpxchg
  856. * implementation is either an IRQ or a data abort exception
  857. * causing another process/thread to be scheduled in the middle
  858. * of the critical sequence. To prevent this, code is added to
  859. * the IRQ and data abort exception handlers to set the pc back
  860. * to the beginning of the critical section if it is found to be
  861. * within that critical section (see kuser_cmpxchg_fixup).
  862. */
  863. 1: ldr r3, [r2] @ load current val
  864. subs r3, r3, r0 @ compare with oldval
  865. 2: streq r1, [r2] @ store newval if eq
  866. rsbs r0, r3, #0 @ set return val and C flag
  867. usr_ret lr
  868. .text
  869. kuser_cmpxchg32_fixup:
  870. @ Called from kuser_cmpxchg_check macro.
  871. @ r4 = address of interrupted insn (must be preserved).
  872. @ sp = saved regs. r7 and r8 are clobbered.
  873. @ 1b = first critical insn, 2b = last critical insn.
  874. @ If r4 >= 1b and r4 <= 2b then saved pc_usr is set to 1b.
  875. mov r7, #0xffff0fff
  876. sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg)))
  877. subs r8, r4, r7
  878. rsbcss r8, r8, #(2b - 1b)
  879. strcs r7, [sp, #S_PC]
  880. ret lr
  881. .previous
  882. #else
  883. #warning "NPTL on non MMU needs fixing"
  884. mov r0, #-1
  885. adds r0, r0, #0
  886. usr_ret lr
  887. #endif
  888. #else
  889. smp_dmb arm
  890. 1: ldrex r3, [r2]
  891. subs r3, r3, r0
  892. strexeq r3, r1, [r2]
  893. teqeq r3, #1
  894. beq 1b
  895. rsbs r0, r3, #0
  896. /* beware -- each __kuser slot must be 8 instructions max */
  897. ALT_SMP(b __kuser_memory_barrier)
  898. ALT_UP(usr_ret lr)
  899. #endif
  900. kuser_pad __kuser_cmpxchg, 32
  901. __kuser_get_tls: @ 0xffff0fe0
  902. ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init
  903. usr_ret lr
  904. mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code
  905. kuser_pad __kuser_get_tls, 16
  906. .rep 3
  907. .word 0 @ 0xffff0ff0 software TLS value, then
  908. .endr @ pad up to __kuser_helper_version
  909. __kuser_helper_version: @ 0xffff0ffc
  910. .word ((__kuser_helper_end - __kuser_helper_start) >> 5)
  911. .globl __kuser_helper_end
  912. __kuser_helper_end:
  913. #endif
  914. THUMB( .thumb )
  915. /*
  916. * Vector stubs.
  917. *
  918. * This code is copied to 0xffff1000 so we can use branches in the
  919. * vectors, rather than ldr's. Note that this code must not exceed
  920. * a page size.
  921. *
  922. * Common stub entry macro:
  923. * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
  924. *
  925. * SP points to a minimal amount of processor-private memory, the address
  926. * of which is copied into r0 for the mode specific abort handler.
  927. */
  928. .macro vector_stub, name, mode, correction=0
  929. .align 5
  930. vector_\name:
  931. .if \correction
  932. sub lr, lr, #\correction
  933. .endif
  934. @
  935. @ Save r0, lr_<exception> (parent PC) and spsr_<exception>
  936. @ (parent CPSR)
  937. @
  938. stmia sp, {r0, lr} @ save r0, lr
  939. mrs lr, spsr
  940. str lr, [sp, #8] @ save spsr
  941. @
  942. @ Prepare for SVC32 mode. IRQs remain disabled.
  943. @
  944. mrs r0, cpsr
  945. eor r0, r0, #(\mode ^ SVC_MODE | PSR_ISETSTATE)
  946. msr spsr_cxsf, r0
  947. @
  948. @ the branch table must immediately follow this code
  949. @
  950. and lr, lr, #0x0f
  951. THUMB( adr r0, 1f )
  952. THUMB( ldr lr, [r0, lr, lsl #2] )
  953. mov r0, sp
  954. ARM( ldr lr, [pc, lr, lsl #2] )
  955. movs pc, lr @ branch to handler in SVC mode
  956. ENDPROC(vector_\name)
  957. .align 2
  958. @ handler addresses follow this label
  959. 1:
  960. .endm
  961. .section .stubs, "ax", %progbits
  962. __stubs_start:
  963. @ This must be the first word
  964. .word vector_swi
  965. vector_rst:
  966. ARM( swi SYS_ERROR0 )
  967. THUMB( svc #0 )
  968. THUMB( nop )
  969. b vector_und
  970. /*
  971. * Interrupt dispatcher
  972. */
  973. vector_stub irq, IRQ_MODE, 4
  974. .long __irq_usr @ 0 (USR_26 / USR_32)
  975. .long __irq_invalid @ 1 (FIQ_26 / FIQ_32)
  976. .long __irq_invalid @ 2 (IRQ_26 / IRQ_32)
  977. .long __irq_svc @ 3 (SVC_26 / SVC_32)
  978. .long __irq_invalid @ 4
  979. .long __irq_invalid @ 5
  980. .long __irq_invalid @ 6
  981. .long __irq_invalid @ 7
  982. .long __irq_invalid @ 8
  983. .long __irq_invalid @ 9
  984. .long __irq_invalid @ a
  985. .long __irq_invalid @ b
  986. .long __irq_invalid @ c
  987. .long __irq_invalid @ d
  988. .long __irq_invalid @ e
  989. .long __irq_invalid @ f
  990. /*
  991. * Data abort dispatcher
  992. * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
  993. */
  994. vector_stub dabt, ABT_MODE, 8
  995. .long __dabt_usr @ 0 (USR_26 / USR_32)
  996. .long __dabt_invalid @ 1 (FIQ_26 / FIQ_32)
  997. .long __dabt_invalid @ 2 (IRQ_26 / IRQ_32)
  998. .long __dabt_svc @ 3 (SVC_26 / SVC_32)
  999. .long __dabt_invalid @ 4
  1000. .long __dabt_invalid @ 5
  1001. .long __dabt_invalid @ 6
  1002. .long __dabt_invalid @ 7
  1003. .long __dabt_invalid @ 8
  1004. .long __dabt_invalid @ 9
  1005. .long __dabt_invalid @ a
  1006. .long __dabt_invalid @ b
  1007. .long __dabt_invalid @ c
  1008. .long __dabt_invalid @ d
  1009. .long __dabt_invalid @ e
  1010. .long __dabt_invalid @ f
  1011. /*
  1012. * Prefetch abort dispatcher
  1013. * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
  1014. */
  1015. vector_stub pabt, ABT_MODE, 4
  1016. .long __pabt_usr @ 0 (USR_26 / USR_32)
  1017. .long __pabt_invalid @ 1 (FIQ_26 / FIQ_32)
  1018. .long __pabt_invalid @ 2 (IRQ_26 / IRQ_32)
  1019. .long __pabt_svc @ 3 (SVC_26 / SVC_32)
  1020. .long __pabt_invalid @ 4
  1021. .long __pabt_invalid @ 5
  1022. .long __pabt_invalid @ 6
  1023. .long __pabt_invalid @ 7
  1024. .long __pabt_invalid @ 8
  1025. .long __pabt_invalid @ 9
  1026. .long __pabt_invalid @ a
  1027. .long __pabt_invalid @ b
  1028. .long __pabt_invalid @ c
  1029. .long __pabt_invalid @ d
  1030. .long __pabt_invalid @ e
  1031. .long __pabt_invalid @ f
  1032. /*
  1033. * Undef instr entry dispatcher
  1034. * Enter in UND mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
  1035. */
  1036. vector_stub und, UND_MODE
  1037. .long __und_usr @ 0 (USR_26 / USR_32)
  1038. .long __und_invalid @ 1 (FIQ_26 / FIQ_32)
  1039. .long __und_invalid @ 2 (IRQ_26 / IRQ_32)
  1040. .long __und_svc @ 3 (SVC_26 / SVC_32)
  1041. .long __und_invalid @ 4
  1042. .long __und_invalid @ 5
  1043. .long __und_invalid @ 6
  1044. .long __und_invalid @ 7
  1045. .long __und_invalid @ 8
  1046. .long __und_invalid @ 9
  1047. .long __und_invalid @ a
  1048. .long __und_invalid @ b
  1049. .long __und_invalid @ c
  1050. .long __und_invalid @ d
  1051. .long __und_invalid @ e
  1052. .long __und_invalid @ f
  1053. .align 5
  1054. /*=============================================================================
  1055. * Address exception handler
  1056. *-----------------------------------------------------------------------------
  1057. * These aren't too critical.
  1058. * (they're not supposed to happen, and won't happen in 32-bit data mode).
  1059. */
  1060. vector_addrexcptn:
  1061. b vector_addrexcptn
  1062. /*=============================================================================
  1063. * FIQ "NMI" handler
  1064. *-----------------------------------------------------------------------------
  1065. * Handle a FIQ using the SVC stack allowing FIQ act like NMI on x86
  1066. * systems.
  1067. */
  1068. vector_stub fiq, FIQ_MODE, 4
  1069. .long __fiq_usr @ 0 (USR_26 / USR_32)
  1070. .long __fiq_svc @ 1 (FIQ_26 / FIQ_32)
  1071. .long __fiq_svc @ 2 (IRQ_26 / IRQ_32)
  1072. .long __fiq_svc @ 3 (SVC_26 / SVC_32)
  1073. .long __fiq_svc @ 4
  1074. .long __fiq_svc @ 5
  1075. .long __fiq_svc @ 6
  1076. .long __fiq_abt @ 7
  1077. .long __fiq_svc @ 8
  1078. .long __fiq_svc @ 9
  1079. .long __fiq_svc @ a
  1080. .long __fiq_svc @ b
  1081. .long __fiq_svc @ c
  1082. .long __fiq_svc @ d
  1083. .long __fiq_svc @ e
  1084. .long __fiq_svc @ f
  1085. .globl vector_fiq_offset
  1086. .equ vector_fiq_offset, vector_fiq
  1087. .section .vectors, "ax", %progbits
  1088. __vectors_start:
  1089. W(b) vector_rst
  1090. W(b) vector_und
  1091. W(ldr) pc, __vectors_start + 0x1000
  1092. W(b) vector_pabt
  1093. W(b) vector_dabt
  1094. W(b) vector_addrexcptn
  1095. W(b) vector_irq
  1096. W(b) vector_fiq
  1097. .data
  1098. .globl cr_alignment
  1099. cr_alignment:
  1100. .space 4
  1101. #ifdef CONFIG_MULTI_IRQ_HANDLER
  1102. .globl handle_arch_irq
  1103. handle_arch_irq:
  1104. .space 4
  1105. #endif