hw_exception_handler.S 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. /*
  2. * Exception handling for Microblaze
  3. *
  4. * Rewriten interrupt handling
  5. *
  6. * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
  7. * Copyright (C) 2008-2009 PetaLogix
  8. *
  9. * uClinux customisation (C) 2005 John Williams
  10. *
  11. * MMU code derived from arch/ppc/kernel/head_4xx.S:
  12. * Copyright (C) 1995-1996 Gary Thomas <gdt@linuxppc.org>
  13. * Initial PowerPC version.
  14. * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
  15. * Rewritten for PReP
  16. * Copyright (C) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
  17. * Low-level exception handers, MMU support, and rewrite.
  18. * Copyright (C) 1997 Dan Malek <dmalek@jlc.net>
  19. * PowerPC 8xx modifications.
  20. * Copyright (C) 1998-1999 TiVo, Inc.
  21. * PowerPC 403GCX modifications.
  22. * Copyright (C) 1999 Grant Erickson <grant@lcse.umn.edu>
  23. * PowerPC 403GCX/405GP modifications.
  24. * Copyright 2000 MontaVista Software Inc.
  25. * PPC405 modifications
  26. * PowerPC 403GCX/405GP modifications.
  27. * Author: MontaVista Software, Inc.
  28. * frank_rowand@mvista.com or source@mvista.com
  29. * debbie_chu@mvista.com
  30. *
  31. * Original code
  32. * Copyright (C) 2004 Xilinx, Inc.
  33. *
  34. * This program is free software; you can redistribute it and/or modify it
  35. * under the terms of the GNU General Public License version 2 as published
  36. * by the Free Software Foundation.
  37. */
  38. /*
  39. * Here are the handlers which don't require enabling translation
  40. * and calling other kernel code thus we can keep their design very simple
  41. * and do all processing in real mode. All what they need is a valid current
  42. * (that is an issue for the CONFIG_REGISTER_TASK_PTR case)
  43. * This handlers use r3,r4,r5,r6 and optionally r[current] to work therefore
  44. * these registers are saved/restored
  45. * The handlers which require translation are in entry.S --KAA
  46. *
  47. * Microblaze HW Exception Handler
  48. * - Non self-modifying exception handler for the following exception conditions
  49. * - Unalignment
  50. * - Instruction bus error
  51. * - Data bus error
  52. * - Illegal instruction opcode
  53. * - Divide-by-zero
  54. *
  55. * - Privileged instruction exception (MMU)
  56. * - Data storage exception (MMU)
  57. * - Instruction storage exception (MMU)
  58. * - Data TLB miss exception (MMU)
  59. * - Instruction TLB miss exception (MMU)
  60. *
  61. * Note we disable interrupts during exception handling, otherwise we will
  62. * possibly get multiple re-entrancy if interrupt handles themselves cause
  63. * exceptions. JW
  64. */
  65. #include <asm/exceptions.h>
  66. #include <asm/unistd.h>
  67. #include <asm/page.h>
  68. #include <asm/entry.h>
  69. #include <asm/current.h>
  70. #include <linux/linkage.h>
  71. #include <asm/mmu.h>
  72. #include <asm/pgtable.h>
  73. #include <asm/asm-offsets.h>
  74. /* Helpful Macros */
  75. #ifndef CONFIG_MMU
  76. #define EX_HANDLER_STACK_SIZ (4*19)
  77. #endif
  78. #define NUM_TO_REG(num) r ## num
  79. #ifdef CONFIG_MMU
  80. /* FIXME you can't change first load of MSR because there is
  81. * hardcoded jump bri 4 */
  82. #define RESTORE_STATE \
  83. lwi r3, r1, PT_R3; \
  84. lwi r4, r1, PT_R4; \
  85. lwi r5, r1, PT_R5; \
  86. lwi r6, r1, PT_R6; \
  87. lwi r11, r1, PT_R11; \
  88. lwi r31, r1, PT_R31; \
  89. lwi r1, r0, TOPHYS(r0_ram + 0);
  90. #endif /* CONFIG_MMU */
  91. #define LWREG_NOP \
  92. bri ex_handler_unhandled; \
  93. nop;
  94. #define SWREG_NOP \
  95. bri ex_handler_unhandled; \
  96. nop;
  97. /* FIXME this is weird - for noMMU kernel is not possible to use brid
  98. * instruction which can shorten executed time
  99. */
  100. /* r3 is the source */
  101. #define R3_TO_LWREG_V(regnum) \
  102. swi r3, r1, 4 * regnum; \
  103. bri ex_handler_done;
  104. /* r3 is the source */
  105. #define R3_TO_LWREG(regnum) \
  106. or NUM_TO_REG (regnum), r0, r3; \
  107. bri ex_handler_done;
  108. /* r3 is the target */
  109. #define SWREG_TO_R3_V(regnum) \
  110. lwi r3, r1, 4 * regnum; \
  111. bri ex_sw_tail;
  112. /* r3 is the target */
  113. #define SWREG_TO_R3(regnum) \
  114. or r3, r0, NUM_TO_REG (regnum); \
  115. bri ex_sw_tail;
  116. #ifdef CONFIG_MMU
  117. #define R3_TO_LWREG_VM_V(regnum) \
  118. brid ex_lw_end_vm; \
  119. swi r3, r7, 4 * regnum;
  120. #define R3_TO_LWREG_VM(regnum) \
  121. brid ex_lw_end_vm; \
  122. or NUM_TO_REG (regnum), r0, r3;
  123. #define SWREG_TO_R3_VM_V(regnum) \
  124. brid ex_sw_tail_vm; \
  125. lwi r3, r7, 4 * regnum;
  126. #define SWREG_TO_R3_VM(regnum) \
  127. brid ex_sw_tail_vm; \
  128. or r3, r0, NUM_TO_REG (regnum);
  129. /* Shift right instruction depending on available configuration */
  130. #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0
  131. #define BSRLI(rD, rA, imm) \
  132. bsrli rD, rA, imm
  133. #elif CONFIG_XILINX_MICROBLAZE0_USE_DIV > 0
  134. #define BSRLI(rD, rA, imm) \
  135. ori rD, r0, (1 << imm); \
  136. idivu rD, rD, rA
  137. #else
  138. #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA)
  139. /* Only the used shift constants defined here - add more if needed */
  140. #define BSRLI2(rD, rA) \
  141. srl rD, rA; /* << 1 */ \
  142. srl rD, rD; /* << 2 */
  143. #define BSRLI10(rD, rA) \
  144. srl rD, rA; /* << 1 */ \
  145. srl rD, rD; /* << 2 */ \
  146. srl rD, rD; /* << 3 */ \
  147. srl rD, rD; /* << 4 */ \
  148. srl rD, rD; /* << 5 */ \
  149. srl rD, rD; /* << 6 */ \
  150. srl rD, rD; /* << 7 */ \
  151. srl rD, rD; /* << 8 */ \
  152. srl rD, rD; /* << 9 */ \
  153. srl rD, rD /* << 10 */
  154. #define BSRLI20(rD, rA) \
  155. BSRLI10(rD, rA); \
  156. BSRLI10(rD, rD)
  157. #endif
  158. #endif /* CONFIG_MMU */
  159. .extern other_exception_handler /* Defined in exception.c */
  160. /*
  161. * hw_exception_handler - Handler for exceptions
  162. *
  163. * Exception handler notes:
  164. * - Handles all exceptions
  165. * - Does not handle unaligned exceptions during load into r17, r1, r0.
  166. * - Does not handle unaligned exceptions during store from r17 (cannot be
  167. * done) and r1 (slows down common case)
  168. *
  169. * Relevant register structures
  170. *
  171. * EAR - |----|----|----|----|----|----|----|----|
  172. * - < ## 32 bit faulting address ## >
  173. *
  174. * ESR - |----|----|----|----|----| - | - |-----|-----|
  175. * - W S REG EXC
  176. *
  177. *
  178. * STACK FRAME STRUCTURE (for NO_MMU)
  179. * ---------------------------------
  180. *
  181. * +-------------+ + 0
  182. * | MSR |
  183. * +-------------+ + 4
  184. * | r1 |
  185. * | . |
  186. * | . |
  187. * | . |
  188. * | . |
  189. * | r18 |
  190. * +-------------+ + 76
  191. * | . |
  192. * | . |
  193. *
  194. * NO_MMU kernel use the same r0_ram pointed space - look to vmlinux.lds.S
  195. * which is used for storing register values - old style was, that value were
  196. * stored in stack but in case of failure you lost information about register.
  197. * Currently you can see register value in memory in specific place.
  198. * In compare to with previous solution the speed should be the same.
  199. *
  200. * MMU exception handler has different handling compare to no MMU kernel.
  201. * Exception handler use jump table for directing of what happen. For MMU kernel
  202. * is this approach better because MMU relate exception are handled by asm code
  203. * in this file. In compare to with MMU expect of unaligned exception
  204. * is everything handled by C code.
  205. */
  206. /*
  207. * every of these handlers is entered having R3/4/5/6/11/current saved on stack
  208. * and clobbered so care should be taken to restore them if someone is going to
  209. * return from exception
  210. */
  211. /* wrappers to restore state before coming to entry.S */
  212. #ifdef CONFIG_MMU
  213. .section .rodata
  214. .align 4
  215. _MB_HW_ExceptionVectorTable:
  216. /* 0 - Undefined */
  217. .long TOPHYS(ex_handler_unhandled)
  218. /* 1 - Unaligned data access exception */
  219. .long TOPHYS(handle_unaligned_ex)
  220. /* 2 - Illegal op-code exception */
  221. .long TOPHYS(full_exception_trapw)
  222. /* 3 - Instruction bus error exception */
  223. .long TOPHYS(full_exception_trapw)
  224. /* 4 - Data bus error exception */
  225. .long TOPHYS(full_exception_trapw)
  226. /* 5 - Divide by zero exception */
  227. .long TOPHYS(full_exception_trapw)
  228. /* 6 - Floating point unit exception */
  229. .long TOPHYS(full_exception_trapw)
  230. /* 7 - Privileged instruction exception */
  231. .long TOPHYS(full_exception_trapw)
  232. /* 8 - 15 - Undefined */
  233. .long TOPHYS(ex_handler_unhandled)
  234. .long TOPHYS(ex_handler_unhandled)
  235. .long TOPHYS(ex_handler_unhandled)
  236. .long TOPHYS(ex_handler_unhandled)
  237. .long TOPHYS(ex_handler_unhandled)
  238. .long TOPHYS(ex_handler_unhandled)
  239. .long TOPHYS(ex_handler_unhandled)
  240. .long TOPHYS(ex_handler_unhandled)
  241. /* 16 - Data storage exception */
  242. .long TOPHYS(handle_data_storage_exception)
  243. /* 17 - Instruction storage exception */
  244. .long TOPHYS(handle_instruction_storage_exception)
  245. /* 18 - Data TLB miss exception */
  246. .long TOPHYS(handle_data_tlb_miss_exception)
  247. /* 19 - Instruction TLB miss exception */
  248. .long TOPHYS(handle_instruction_tlb_miss_exception)
  249. /* 20 - 31 - Undefined */
  250. .long TOPHYS(ex_handler_unhandled)
  251. .long TOPHYS(ex_handler_unhandled)
  252. .long TOPHYS(ex_handler_unhandled)
  253. .long TOPHYS(ex_handler_unhandled)
  254. .long TOPHYS(ex_handler_unhandled)
  255. .long TOPHYS(ex_handler_unhandled)
  256. .long TOPHYS(ex_handler_unhandled)
  257. .long TOPHYS(ex_handler_unhandled)
  258. .long TOPHYS(ex_handler_unhandled)
  259. .long TOPHYS(ex_handler_unhandled)
  260. .long TOPHYS(ex_handler_unhandled)
  261. .long TOPHYS(ex_handler_unhandled)
  262. #endif
  263. .global _hw_exception_handler
  264. .section .text
  265. .align 4
  266. .ent _hw_exception_handler
  267. _hw_exception_handler:
  268. #ifndef CONFIG_MMU
  269. addik r1, r1, -(EX_HANDLER_STACK_SIZ); /* Create stack frame */
  270. #else
  271. swi r1, r0, TOPHYS(r0_ram + 0); /* GET_SP */
  272. /* Save date to kernel memory. Here is the problem
  273. * when you came from user space */
  274. ori r1, r0, TOPHYS(r0_ram + 28);
  275. #endif
  276. swi r3, r1, PT_R3
  277. swi r4, r1, PT_R4
  278. swi r5, r1, PT_R5
  279. swi r6, r1, PT_R6
  280. #ifdef CONFIG_MMU
  281. swi r11, r1, PT_R11
  282. swi r31, r1, PT_R31
  283. lwi r31, r0, TOPHYS(PER_CPU(CURRENT_SAVE)) /* get saved current */
  284. #endif
  285. mfs r3, resr
  286. nop
  287. mfs r4, rear;
  288. nop
  289. #ifndef CONFIG_MMU
  290. andi r5, r3, 0x1000; /* Check ESR[DS] */
  291. beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */
  292. mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
  293. nop
  294. not_in_delay_slot:
  295. swi r17, r1, PT_R17
  296. #endif
  297. andi r5, r3, 0x1F; /* Extract ESR[EXC] */
  298. #ifdef CONFIG_MMU
  299. /* Calculate exception vector offset = r5 << 2 */
  300. addk r6, r5, r5; /* << 1 */
  301. addk r6, r6, r6; /* << 2 */
  302. /* counting which exception happen */
  303. lwi r5, r0, 0x200 + TOPHYS(r0_ram)
  304. addi r5, r5, 1
  305. swi r5, r0, 0x200 + TOPHYS(r0_ram)
  306. lwi r5, r6, 0x200 + TOPHYS(r0_ram)
  307. addi r5, r5, 1
  308. swi r5, r6, 0x200 + TOPHYS(r0_ram)
  309. /* end */
  310. /* Load the HW Exception vector */
  311. lwi r6, r6, TOPHYS(_MB_HW_ExceptionVectorTable)
  312. bra r6
  313. full_exception_trapw:
  314. RESTORE_STATE
  315. bri full_exception_trap
  316. #else
  317. /* Exceptions enabled here. This will allow nested exceptions */
  318. mfs r6, rmsr;
  319. nop
  320. swi r6, r1, 0; /* RMSR_OFFSET */
  321. ori r6, r6, 0x100; /* Turn ON the EE bit */
  322. andi r6, r6, ~2; /* Disable interrupts */
  323. mts rmsr, r6;
  324. nop
  325. xori r6, r5, 1; /* 00001 = Unaligned Exception */
  326. /* Jump to unalignment exception handler */
  327. beqi r6, handle_unaligned_ex;
  328. handle_other_ex: /* Handle Other exceptions here */
  329. /* Save other volatiles before we make procedure calls below */
  330. swi r7, r1, PT_R7
  331. swi r8, r1, PT_R8
  332. swi r9, r1, PT_R9
  333. swi r10, r1, PT_R10
  334. swi r11, r1, PT_R11
  335. swi r12, r1, PT_R12
  336. swi r14, r1, PT_R14
  337. swi r15, r1, PT_R15
  338. swi r18, r1, PT_R18
  339. or r5, r1, r0
  340. andi r6, r3, 0x1F; /* Load ESR[EC] */
  341. lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */
  342. swi r7, r1, PT_MODE
  343. mfs r7, rfsr
  344. nop
  345. addk r8, r17, r0; /* Load exception address */
  346. bralid r15, full_exception; /* Branch to the handler */
  347. nop;
  348. /*
  349. * Trigger execution of the signal handler by enabling
  350. * interrupts and calling an invalid syscall.
  351. */
  352. mfs r5, rmsr;
  353. nop
  354. ori r5, r5, 2;
  355. mts rmsr, r5; /* enable interrupt */
  356. nop
  357. addi r12, r0, __NR_syscalls;
  358. brki r14, 0x08;
  359. mfs r5, rmsr; /* disable interrupt */
  360. nop
  361. andi r5, r5, ~2;
  362. mts rmsr, r5;
  363. nop
  364. lwi r7, r1, PT_R7
  365. lwi r8, r1, PT_R8
  366. lwi r9, r1, PT_R9
  367. lwi r10, r1, PT_R10
  368. lwi r11, r1, PT_R11
  369. lwi r12, r1, PT_R12
  370. lwi r14, r1, PT_R14
  371. lwi r15, r1, PT_R15
  372. lwi r18, r1, PT_R18
  373. bri ex_handler_done; /* Complete exception handling */
  374. #endif
  375. /* 0x01 - Unaligned data access exception
  376. * This occurs when a word access is not aligned on a word boundary,
  377. * or when a 16-bit access is not aligned on a 16-bit boundary.
  378. * This handler perform the access, and returns, except for MMU when
  379. * the unaligned address is last on a 4k page or the physical address is
  380. * not found in the page table, in which case unaligned_data_trap is called.
  381. */
  382. handle_unaligned_ex:
  383. /* Working registers already saved: R3, R4, R5, R6
  384. * R3 = ESR
  385. * R4 = EAR
  386. */
  387. #ifdef CONFIG_MMU
  388. andi r6, r3, 0x1000 /* Check ESR[DS] */
  389. beqi r6, _no_delayslot /* Branch if ESR[DS] not set */
  390. mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
  391. nop
  392. _no_delayslot:
  393. #endif
  394. #ifdef CONFIG_MMU
  395. /* Check if unaligned address is last on a 4k page */
  396. andi r5, r4, 0xffc
  397. xori r5, r5, 0xffc
  398. bnei r5, _unaligned_ex2
  399. _unaligned_ex1:
  400. RESTORE_STATE;
  401. /* Another page must be accessed or physical address not in page table */
  402. bri unaligned_data_trap
  403. _unaligned_ex2:
  404. #endif
  405. andi r6, r3, 0x3E0; /* Mask and extract the register operand */
  406. srl r6, r6; /* r6 >> 5 */
  407. srl r6, r6;
  408. srl r6, r6;
  409. srl r6, r6;
  410. srl r6, r6;
  411. /* Store the register operand in a temporary location */
  412. sbi r6, r0, TOPHYS(ex_reg_op);
  413. #ifdef CONFIG_MMU
  414. /* Get physical address */
  415. /* If we are faulting a kernel address, we have to use the
  416. * kernel page tables.
  417. */
  418. ori r5, r0, CONFIG_KERNEL_START
  419. cmpu r5, r4, r5
  420. bgti r5, _unaligned_ex3
  421. ori r5, r0, swapper_pg_dir
  422. bri _unaligned_ex4
  423. /* Get the PGD for the current thread. */
  424. _unaligned_ex3: /* user thread */
  425. addi r5 ,CURRENT_TASK, TOPHYS(0); /* get current task address */
  426. lwi r5, r5, TASK_THREAD + PGDIR
  427. _unaligned_ex4:
  428. tophys(r5,r5)
  429. BSRLI(r6,r4,20) /* Create L1 (pgdir/pmd) address */
  430. andi r6, r6, 0xffc
  431. /* Assume pgdir aligned on 4K boundary, no need for "andi r5,r5,0xfffff003" */
  432. or r5, r5, r6
  433. lwi r6, r5, 0 /* Get L1 entry */
  434. andi r5, r6, 0xfffff000 /* Extract L2 (pte) base address. */
  435. beqi r5, _unaligned_ex1 /* Bail if no table */
  436. tophys(r5,r5)
  437. BSRLI(r6,r4,10) /* Compute PTE address */
  438. andi r6, r6, 0xffc
  439. andi r5, r5, 0xfffff003
  440. or r5, r5, r6
  441. lwi r5, r5, 0 /* Get Linux PTE */
  442. andi r6, r5, _PAGE_PRESENT
  443. beqi r6, _unaligned_ex1 /* Bail if no page */
  444. andi r5, r5, 0xfffff000 /* Extract RPN */
  445. andi r4, r4, 0x00000fff /* Extract offset */
  446. or r4, r4, r5 /* Create physical address */
  447. #endif /* CONFIG_MMU */
  448. andi r6, r3, 0x400; /* Extract ESR[S] */
  449. bnei r6, ex_sw;
  450. ex_lw:
  451. andi r6, r3, 0x800; /* Extract ESR[W] */
  452. beqi r6, ex_lhw;
  453. lbui r5, r4, 0; /* Exception address in r4 */
  454. /* Load a word, byte-by-byte from destination address
  455. and save it in tmp space */
  456. sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
  457. lbui r5, r4, 1;
  458. sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
  459. lbui r5, r4, 2;
  460. sbi r5, r0, TOPHYS(ex_tmp_data_loc_2);
  461. lbui r5, r4, 3;
  462. sbi r5, r0, TOPHYS(ex_tmp_data_loc_3);
  463. /* Get the destination register value into r3 */
  464. lwi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  465. bri ex_lw_tail;
  466. ex_lhw:
  467. lbui r5, r4, 0; /* Exception address in r4 */
  468. /* Load a half-word, byte-by-byte from destination
  469. address and save it in tmp space */
  470. sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
  471. lbui r5, r4, 1;
  472. sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
  473. /* Get the destination register value into r3 */
  474. lhui r3, r0, TOPHYS(ex_tmp_data_loc_0);
  475. ex_lw_tail:
  476. /* Get the destination register number into r5 */
  477. lbui r5, r0, TOPHYS(ex_reg_op);
  478. /* Form load_word jump table offset (lw_table + (8 * regnum)) */
  479. la r6, r0, TOPHYS(lw_table);
  480. addk r5, r5, r5;
  481. addk r5, r5, r5;
  482. addk r5, r5, r5;
  483. addk r5, r5, r6;
  484. bra r5;
  485. ex_lw_end: /* Exception handling of load word, ends */
  486. ex_sw:
  487. /* Get the destination register number into r5 */
  488. lbui r5, r0, TOPHYS(ex_reg_op);
  489. /* Form store_word jump table offset (sw_table + (8 * regnum)) */
  490. la r6, r0, TOPHYS(sw_table);
  491. add r5, r5, r5;
  492. add r5, r5, r5;
  493. add r5, r5, r5;
  494. add r5, r5, r6;
  495. bra r5;
  496. ex_sw_tail:
  497. mfs r6, resr;
  498. nop
  499. andi r6, r6, 0x800; /* Extract ESR[W] */
  500. beqi r6, ex_shw;
  501. /* Get the word - delay slot */
  502. swi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  503. /* Store the word, byte-by-byte into destination address */
  504. lbui r3, r0, TOPHYS(ex_tmp_data_loc_0);
  505. sbi r3, r4, 0;
  506. lbui r3, r0, TOPHYS(ex_tmp_data_loc_1);
  507. sbi r3, r4, 1;
  508. lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);
  509. sbi r3, r4, 2;
  510. lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);
  511. sbi r3, r4, 3;
  512. bri ex_handler_done;
  513. ex_shw:
  514. /* Store the lower half-word, byte-by-byte into destination address */
  515. swi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  516. lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);
  517. sbi r3, r4, 0;
  518. lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);
  519. sbi r3, r4, 1;
  520. ex_sw_end: /* Exception handling of store word, ends. */
  521. ex_handler_done:
  522. #ifndef CONFIG_MMU
  523. lwi r5, r1, 0 /* RMSR */
  524. mts rmsr, r5
  525. nop
  526. lwi r3, r1, PT_R3
  527. lwi r4, r1, PT_R4
  528. lwi r5, r1, PT_R5
  529. lwi r6, r1, PT_R6
  530. lwi r17, r1, PT_R17
  531. rted r17, 0
  532. addik r1, r1, (EX_HANDLER_STACK_SIZ); /* Restore stack frame */
  533. #else
  534. RESTORE_STATE;
  535. rted r17, 0
  536. nop
  537. #endif
  538. #ifdef CONFIG_MMU
  539. /* Exception vector entry code. This code runs with address translation
  540. * turned off (i.e. using physical addresses). */
  541. /* Exception vectors. */
  542. /* 0x10 - Data Storage Exception
  543. * This happens for just a few reasons. U0 set (but we don't do that),
  544. * or zone protection fault (user violation, write to protected page).
  545. * If this is just an update of modified status, we do that quickly
  546. * and exit. Otherwise, we call heavyweight functions to do the work.
  547. */
  548. handle_data_storage_exception:
  549. /* Working registers already saved: R3, R4, R5, R6
  550. * R3 = ESR
  551. */
  552. mfs r11, rpid
  553. nop
  554. bri 4
  555. mfs r3, rear /* Get faulting address */
  556. nop
  557. /* If we are faulting a kernel address, we have to use the
  558. * kernel page tables.
  559. */
  560. ori r4, r0, CONFIG_KERNEL_START
  561. cmpu r4, r3, r4
  562. bgti r4, ex3
  563. /* First, check if it was a zone fault (which means a user
  564. * tried to access a kernel or read-protected page - always
  565. * a SEGV). All other faults here must be stores, so no
  566. * need to check ESR_S as well. */
  567. mfs r4, resr
  568. nop
  569. andi r4, r4, 0x800 /* ESR_Z - zone protection */
  570. bnei r4, ex2
  571. ori r4, r0, swapper_pg_dir
  572. mts rpid, r0 /* TLB will have 0 TID */
  573. nop
  574. bri ex4
  575. /* Get the PGD for the current thread. */
  576. ex3:
  577. /* First, check if it was a zone fault (which means a user
  578. * tried to access a kernel or read-protected page - always
  579. * a SEGV). All other faults here must be stores, so no
  580. * need to check ESR_S as well. */
  581. mfs r4, resr
  582. nop
  583. andi r4, r4, 0x800 /* ESR_Z */
  584. bnei r4, ex2
  585. /* get current task address */
  586. addi r4 ,CURRENT_TASK, TOPHYS(0);
  587. lwi r4, r4, TASK_THREAD+PGDIR
  588. ex4:
  589. tophys(r4,r4)
  590. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  591. andi r5, r5, 0xffc
  592. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  593. or r4, r4, r5
  594. lwi r4, r4, 0 /* Get L1 entry */
  595. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  596. beqi r5, ex2 /* Bail if no table */
  597. tophys(r5,r5)
  598. BSRLI(r6,r3,10) /* Compute PTE address */
  599. andi r6, r6, 0xffc
  600. andi r5, r5, 0xfffff003
  601. or r5, r5, r6
  602. lwi r4, r5, 0 /* Get Linux PTE */
  603. andi r6, r4, _PAGE_RW /* Is it writeable? */
  604. beqi r6, ex2 /* Bail if not */
  605. /* Update 'changed' */
  606. ori r4, r4, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
  607. swi r4, r5, 0 /* Update Linux page table */
  608. /* Most of the Linux PTE is ready to load into the TLB LO.
  609. * We set ZSEL, where only the LS-bit determines user access.
  610. * We set execute, because we don't have the granularity to
  611. * properly set this at the page level (Linux problem).
  612. * If shared is set, we cause a zero PID->TID load.
  613. * Many of these bits are software only. Bits we don't set
  614. * here we (properly should) assume have the appropriate value.
  615. */
  616. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  617. ori r4, r4, _PAGE_HWEXEC /* make it executable */
  618. /* find the TLB index that caused the fault. It has to be here*/
  619. mts rtlbsx, r3
  620. nop
  621. mfs r5, rtlbx /* DEBUG: TBD */
  622. nop
  623. mts rtlblo, r4 /* Load TLB LO */
  624. nop
  625. /* Will sync shadow TLBs */
  626. /* Done...restore registers and get out of here. */
  627. mts rpid, r11
  628. nop
  629. bri 4
  630. RESTORE_STATE;
  631. rted r17, 0
  632. nop
  633. ex2:
  634. /* The bailout. Restore registers to pre-exception conditions
  635. * and call the heavyweights to help us out. */
  636. mts rpid, r11
  637. nop
  638. bri 4
  639. RESTORE_STATE;
  640. bri page_fault_data_trap
  641. /* 0x11 - Instruction Storage Exception
  642. * This is caused by a fetch from non-execute or guarded pages. */
  643. handle_instruction_storage_exception:
  644. /* Working registers already saved: R3, R4, R5, R6
  645. * R3 = ESR
  646. */
  647. mfs r3, rear /* Get faulting address */
  648. nop
  649. RESTORE_STATE;
  650. bri page_fault_instr_trap
  651. /* 0x12 - Data TLB Miss Exception
  652. * As the name implies, translation is not in the MMU, so search the
  653. * page tables and fix it. The only purpose of this function is to
  654. * load TLB entries from the page table if they exist.
  655. */
  656. handle_data_tlb_miss_exception:
  657. /* Working registers already saved: R3, R4, R5, R6
  658. * R3 = ESR
  659. */
  660. mfs r11, rpid
  661. nop
  662. bri 4
  663. mfs r3, rear /* Get faulting address */
  664. nop
  665. /* If we are faulting a kernel address, we have to use the
  666. * kernel page tables. */
  667. ori r4, r0, CONFIG_KERNEL_START
  668. cmpu r4, r3, r4
  669. bgti r4, ex5
  670. ori r4, r0, swapper_pg_dir
  671. mts rpid, r0 /* TLB will have 0 TID */
  672. nop
  673. bri ex6
  674. /* Get the PGD for the current thread. */
  675. ex5:
  676. /* get current task address */
  677. addi r4 ,CURRENT_TASK, TOPHYS(0);
  678. lwi r4, r4, TASK_THREAD+PGDIR
  679. ex6:
  680. tophys(r4,r4)
  681. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  682. andi r5, r5, 0xffc
  683. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  684. or r4, r4, r5
  685. lwi r4, r4, 0 /* Get L1 entry */
  686. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  687. beqi r5, ex7 /* Bail if no table */
  688. tophys(r5,r5)
  689. BSRLI(r6,r3,10) /* Compute PTE address */
  690. andi r6, r6, 0xffc
  691. andi r5, r5, 0xfffff003
  692. or r5, r5, r6
  693. lwi r4, r5, 0 /* Get Linux PTE */
  694. andi r6, r4, _PAGE_PRESENT
  695. beqi r6, ex7
  696. ori r4, r4, _PAGE_ACCESSED
  697. swi r4, r5, 0
  698. /* Most of the Linux PTE is ready to load into the TLB LO.
  699. * We set ZSEL, where only the LS-bit determines user access.
  700. * We set execute, because we don't have the granularity to
  701. * properly set this at the page level (Linux problem).
  702. * If shared is set, we cause a zero PID->TID load.
  703. * Many of these bits are software only. Bits we don't set
  704. * here we (properly should) assume have the appropriate value.
  705. */
  706. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  707. bri finish_tlb_load
  708. ex7:
  709. /* The bailout. Restore registers to pre-exception conditions
  710. * and call the heavyweights to help us out.
  711. */
  712. mts rpid, r11
  713. nop
  714. bri 4
  715. RESTORE_STATE;
  716. bri page_fault_data_trap
  717. /* 0x13 - Instruction TLB Miss Exception
  718. * Nearly the same as above, except we get our information from
  719. * different registers and bailout to a different point.
  720. */
  721. handle_instruction_tlb_miss_exception:
  722. /* Working registers already saved: R3, R4, R5, R6
  723. * R3 = ESR
  724. */
  725. mfs r11, rpid
  726. nop
  727. bri 4
  728. mfs r3, rear /* Get faulting address */
  729. nop
  730. /* If we are faulting a kernel address, we have to use the
  731. * kernel page tables.
  732. */
  733. ori r4, r0, CONFIG_KERNEL_START
  734. cmpu r4, r3, r4
  735. bgti r4, ex8
  736. ori r4, r0, swapper_pg_dir
  737. mts rpid, r0 /* TLB will have 0 TID */
  738. nop
  739. bri ex9
  740. /* Get the PGD for the current thread. */
  741. ex8:
  742. /* get current task address */
  743. addi r4 ,CURRENT_TASK, TOPHYS(0);
  744. lwi r4, r4, TASK_THREAD+PGDIR
  745. ex9:
  746. tophys(r4,r4)
  747. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  748. andi r5, r5, 0xffc
  749. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  750. or r4, r4, r5
  751. lwi r4, r4, 0 /* Get L1 entry */
  752. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  753. beqi r5, ex10 /* Bail if no table */
  754. tophys(r5,r5)
  755. BSRLI(r6,r3,10) /* Compute PTE address */
  756. andi r6, r6, 0xffc
  757. andi r5, r5, 0xfffff003
  758. or r5, r5, r6
  759. lwi r4, r5, 0 /* Get Linux PTE */
  760. andi r6, r4, _PAGE_PRESENT
  761. beqi r6, ex7
  762. ori r4, r4, _PAGE_ACCESSED
  763. swi r4, r5, 0
  764. /* Most of the Linux PTE is ready to load into the TLB LO.
  765. * We set ZSEL, where only the LS-bit determines user access.
  766. * We set execute, because we don't have the granularity to
  767. * properly set this at the page level (Linux problem).
  768. * If shared is set, we cause a zero PID->TID load.
  769. * Many of these bits are software only. Bits we don't set
  770. * here we (properly should) assume have the appropriate value.
  771. */
  772. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  773. bri finish_tlb_load
  774. ex10:
  775. /* The bailout. Restore registers to pre-exception conditions
  776. * and call the heavyweights to help us out.
  777. */
  778. mts rpid, r11
  779. nop
  780. bri 4
  781. RESTORE_STATE;
  782. bri page_fault_instr_trap
  783. /* Both the instruction and data TLB miss get to this point to load the TLB.
  784. * r3 - EA of fault
  785. * r4 - TLB LO (info from Linux PTE)
  786. * r5, r6 - available to use
  787. * PID - loaded with proper value when we get here
  788. * Upon exit, we reload everything and RFI.
  789. * A common place to load the TLB.
  790. */
  791. tlb_index:
  792. .long 1 /* MS: storing last used tlb index */
  793. finish_tlb_load:
  794. /* MS: load the last used TLB index. */
  795. lwi r5, r0, TOPHYS(tlb_index)
  796. addik r5, r5, 1 /* MS: inc tlb_index -> use next one */
  797. /* MS: FIXME this is potential fault, because this is mask not count */
  798. andi r5, r5, (MICROBLAZE_TLB_SIZE-1)
  799. ori r6, r0, 1
  800. cmp r31, r5, r6
  801. blti r31, sem
  802. addik r5, r6, 1
  803. sem:
  804. /* MS: save back current TLB index */
  805. swi r5, r0, TOPHYS(tlb_index)
  806. ori r4, r4, _PAGE_HWEXEC /* make it executable */
  807. mts rtlbx, r5 /* MS: save current TLB */
  808. nop
  809. mts rtlblo, r4 /* MS: save to TLB LO */
  810. nop
  811. /* Create EPN. This is the faulting address plus a static
  812. * set of bits. These are size, valid, E, U0, and ensure
  813. * bits 20 and 21 are zero.
  814. */
  815. andi r3, r3, 0xfffff000
  816. ori r3, r3, 0x0c0
  817. mts rtlbhi, r3 /* Load TLB HI */
  818. nop
  819. /* Done...restore registers and get out of here. */
  820. ex12:
  821. mts rpid, r11
  822. nop
  823. bri 4
  824. RESTORE_STATE;
  825. rted r17, 0
  826. nop
  827. /* extern void giveup_fpu(struct task_struct *prev)
  828. *
  829. * The MicroBlaze processor may have an FPU, so this should not just
  830. * return: TBD.
  831. */
  832. .globl giveup_fpu;
  833. .align 4;
  834. giveup_fpu:
  835. bralid r15,0 /* TBD */
  836. nop
  837. /* At present, this routine just hangs. - extern void abort(void) */
  838. .globl abort;
  839. .align 4;
  840. abort:
  841. br r0
  842. .globl set_context;
  843. .align 4;
  844. set_context:
  845. mts rpid, r5 /* Shadow TLBs are automatically */
  846. nop
  847. bri 4 /* flushed by changing PID */
  848. rtsd r15,8
  849. nop
  850. #endif
  851. .end _hw_exception_handler
  852. #ifdef CONFIG_MMU
  853. /* Unaligned data access exception last on a 4k page for MMU.
  854. * When this is called, we are in virtual mode with exceptions enabled
  855. * and registers 1-13,15,17,18 saved.
  856. *
  857. * R3 = ESR
  858. * R4 = EAR
  859. * R7 = pointer to saved registers (struct pt_regs *regs)
  860. *
  861. * This handler perform the access, and returns via ret_from_exc.
  862. */
  863. .global _unaligned_data_exception
  864. .ent _unaligned_data_exception
  865. _unaligned_data_exception:
  866. andi r8, r3, 0x3E0; /* Mask and extract the register operand */
  867. BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */
  868. andi r6, r3, 0x400; /* Extract ESR[S] */
  869. bneid r6, ex_sw_vm;
  870. andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */
  871. ex_lw_vm:
  872. beqid r6, ex_lhw_vm;
  873. lbui r5, r4, 0; /* Exception address in r4 - delay slot */
  874. /* Load a word, byte-by-byte from destination address and save it in tmp space*/
  875. la r6, r0, ex_tmp_data_loc_0;
  876. sbi r5, r6, 0;
  877. lbui r5, r4, 1;
  878. sbi r5, r6, 1;
  879. lbui r5, r4, 2;
  880. sbi r5, r6, 2;
  881. lbui r5, r4, 3;
  882. sbi r5, r6, 3;
  883. brid ex_lw_tail_vm;
  884. /* Get the destination register value into r3 - delay slot */
  885. lwi r3, r6, 0;
  886. ex_lhw_vm:
  887. /* Load a half-word, byte-by-byte from destination address and
  888. * save it in tmp space */
  889. la r6, r0, ex_tmp_data_loc_0;
  890. sbi r5, r6, 0;
  891. lbui r5, r4, 1;
  892. sbi r5, r6, 1;
  893. lhui r3, r6, 0; /* Get the destination register value into r3 */
  894. ex_lw_tail_vm:
  895. /* Form load_word jump table offset (lw_table_vm + (8 * regnum)) */
  896. addik r5, r8, lw_table_vm;
  897. bra r5;
  898. ex_lw_end_vm: /* Exception handling of load word, ends */
  899. brai ret_from_exc;
  900. ex_sw_vm:
  901. /* Form store_word jump table offset (sw_table_vm + (8 * regnum)) */
  902. addik r5, r8, sw_table_vm;
  903. bra r5;
  904. ex_sw_tail_vm:
  905. la r5, r0, ex_tmp_data_loc_0;
  906. beqid r6, ex_shw_vm;
  907. swi r3, r5, 0; /* Get the word - delay slot */
  908. /* Store the word, byte-by-byte into destination address */
  909. lbui r3, r5, 0;
  910. sbi r3, r4, 0;
  911. lbui r3, r5, 1;
  912. sbi r3, r4, 1;
  913. lbui r3, r5, 2;
  914. sbi r3, r4, 2;
  915. lbui r3, r5, 3;
  916. brid ret_from_exc;
  917. sbi r3, r4, 3; /* Delay slot */
  918. ex_shw_vm:
  919. /* Store the lower half-word, byte-by-byte into destination address */
  920. lbui r3, r5, 2;
  921. sbi r3, r4, 0;
  922. lbui r3, r5, 3;
  923. brid ret_from_exc;
  924. sbi r3, r4, 1; /* Delay slot */
  925. ex_sw_end_vm: /* Exception handling of store word, ends. */
  926. .end _unaligned_data_exception
  927. #endif /* CONFIG_MMU */
  928. ex_handler_unhandled:
  929. /* FIXME add handle function for unhandled exception - dump register */
  930. bri 0
  931. /*
  932. * hw_exception_handler Jump Table
  933. * - Contains code snippets for each register that caused the unalign exception
  934. * - Hence exception handler is NOT self-modifying
  935. * - Separate table for load exceptions and store exceptions.
  936. * - Each table is of size: (8 * 32) = 256 bytes
  937. */
  938. .section .text
  939. .align 4
  940. lw_table:
  941. lw_r0: R3_TO_LWREG (0);
  942. lw_r1: LWREG_NOP;
  943. lw_r2: R3_TO_LWREG (2);
  944. lw_r3: R3_TO_LWREG_V (3);
  945. lw_r4: R3_TO_LWREG_V (4);
  946. lw_r5: R3_TO_LWREG_V (5);
  947. lw_r6: R3_TO_LWREG_V (6);
  948. lw_r7: R3_TO_LWREG (7);
  949. lw_r8: R3_TO_LWREG (8);
  950. lw_r9: R3_TO_LWREG (9);
  951. lw_r10: R3_TO_LWREG (10);
  952. lw_r11: R3_TO_LWREG (11);
  953. lw_r12: R3_TO_LWREG (12);
  954. lw_r13: R3_TO_LWREG (13);
  955. lw_r14: R3_TO_LWREG (14);
  956. lw_r15: R3_TO_LWREG (15);
  957. lw_r16: R3_TO_LWREG (16);
  958. lw_r17: LWREG_NOP;
  959. lw_r18: R3_TO_LWREG (18);
  960. lw_r19: R3_TO_LWREG (19);
  961. lw_r20: R3_TO_LWREG (20);
  962. lw_r21: R3_TO_LWREG (21);
  963. lw_r22: R3_TO_LWREG (22);
  964. lw_r23: R3_TO_LWREG (23);
  965. lw_r24: R3_TO_LWREG (24);
  966. lw_r25: R3_TO_LWREG (25);
  967. lw_r26: R3_TO_LWREG (26);
  968. lw_r27: R3_TO_LWREG (27);
  969. lw_r28: R3_TO_LWREG (28);
  970. lw_r29: R3_TO_LWREG (29);
  971. lw_r30: R3_TO_LWREG (30);
  972. #ifdef CONFIG_MMU
  973. lw_r31: R3_TO_LWREG_V (31);
  974. #else
  975. lw_r31: R3_TO_LWREG (31);
  976. #endif
  977. sw_table:
  978. sw_r0: SWREG_TO_R3 (0);
  979. sw_r1: SWREG_NOP;
  980. sw_r2: SWREG_TO_R3 (2);
  981. sw_r3: SWREG_TO_R3_V (3);
  982. sw_r4: SWREG_TO_R3_V (4);
  983. sw_r5: SWREG_TO_R3_V (5);
  984. sw_r6: SWREG_TO_R3_V (6);
  985. sw_r7: SWREG_TO_R3 (7);
  986. sw_r8: SWREG_TO_R3 (8);
  987. sw_r9: SWREG_TO_R3 (9);
  988. sw_r10: SWREG_TO_R3 (10);
  989. sw_r11: SWREG_TO_R3 (11);
  990. sw_r12: SWREG_TO_R3 (12);
  991. sw_r13: SWREG_TO_R3 (13);
  992. sw_r14: SWREG_TO_R3 (14);
  993. sw_r15: SWREG_TO_R3 (15);
  994. sw_r16: SWREG_TO_R3 (16);
  995. sw_r17: SWREG_NOP;
  996. sw_r18: SWREG_TO_R3 (18);
  997. sw_r19: SWREG_TO_R3 (19);
  998. sw_r20: SWREG_TO_R3 (20);
  999. sw_r21: SWREG_TO_R3 (21);
  1000. sw_r22: SWREG_TO_R3 (22);
  1001. sw_r23: SWREG_TO_R3 (23);
  1002. sw_r24: SWREG_TO_R3 (24);
  1003. sw_r25: SWREG_TO_R3 (25);
  1004. sw_r26: SWREG_TO_R3 (26);
  1005. sw_r27: SWREG_TO_R3 (27);
  1006. sw_r28: SWREG_TO_R3 (28);
  1007. sw_r29: SWREG_TO_R3 (29);
  1008. sw_r30: SWREG_TO_R3 (30);
  1009. #ifdef CONFIG_MMU
  1010. sw_r31: SWREG_TO_R3_V (31);
  1011. #else
  1012. sw_r31: SWREG_TO_R3 (31);
  1013. #endif
  1014. #ifdef CONFIG_MMU
  1015. lw_table_vm:
  1016. lw_r0_vm: R3_TO_LWREG_VM (0);
  1017. lw_r1_vm: R3_TO_LWREG_VM_V (1);
  1018. lw_r2_vm: R3_TO_LWREG_VM_V (2);
  1019. lw_r3_vm: R3_TO_LWREG_VM_V (3);
  1020. lw_r4_vm: R3_TO_LWREG_VM_V (4);
  1021. lw_r5_vm: R3_TO_LWREG_VM_V (5);
  1022. lw_r6_vm: R3_TO_LWREG_VM_V (6);
  1023. lw_r7_vm: R3_TO_LWREG_VM_V (7);
  1024. lw_r8_vm: R3_TO_LWREG_VM_V (8);
  1025. lw_r9_vm: R3_TO_LWREG_VM_V (9);
  1026. lw_r10_vm: R3_TO_LWREG_VM_V (10);
  1027. lw_r11_vm: R3_TO_LWREG_VM_V (11);
  1028. lw_r12_vm: R3_TO_LWREG_VM_V (12);
  1029. lw_r13_vm: R3_TO_LWREG_VM_V (13);
  1030. lw_r14_vm: R3_TO_LWREG_VM (14);
  1031. lw_r15_vm: R3_TO_LWREG_VM_V (15);
  1032. lw_r16_vm: R3_TO_LWREG_VM (16);
  1033. lw_r17_vm: R3_TO_LWREG_VM_V (17);
  1034. lw_r18_vm: R3_TO_LWREG_VM_V (18);
  1035. lw_r19_vm: R3_TO_LWREG_VM (19);
  1036. lw_r20_vm: R3_TO_LWREG_VM (20);
  1037. lw_r21_vm: R3_TO_LWREG_VM (21);
  1038. lw_r22_vm: R3_TO_LWREG_VM (22);
  1039. lw_r23_vm: R3_TO_LWREG_VM (23);
  1040. lw_r24_vm: R3_TO_LWREG_VM (24);
  1041. lw_r25_vm: R3_TO_LWREG_VM (25);
  1042. lw_r26_vm: R3_TO_LWREG_VM (26);
  1043. lw_r27_vm: R3_TO_LWREG_VM (27);
  1044. lw_r28_vm: R3_TO_LWREG_VM (28);
  1045. lw_r29_vm: R3_TO_LWREG_VM (29);
  1046. lw_r30_vm: R3_TO_LWREG_VM (30);
  1047. lw_r31_vm: R3_TO_LWREG_VM_V (31);
  1048. sw_table_vm:
  1049. sw_r0_vm: SWREG_TO_R3_VM (0);
  1050. sw_r1_vm: SWREG_TO_R3_VM_V (1);
  1051. sw_r2_vm: SWREG_TO_R3_VM_V (2);
  1052. sw_r3_vm: SWREG_TO_R3_VM_V (3);
  1053. sw_r4_vm: SWREG_TO_R3_VM_V (4);
  1054. sw_r5_vm: SWREG_TO_R3_VM_V (5);
  1055. sw_r6_vm: SWREG_TO_R3_VM_V (6);
  1056. sw_r7_vm: SWREG_TO_R3_VM_V (7);
  1057. sw_r8_vm: SWREG_TO_R3_VM_V (8);
  1058. sw_r9_vm: SWREG_TO_R3_VM_V (9);
  1059. sw_r10_vm: SWREG_TO_R3_VM_V (10);
  1060. sw_r11_vm: SWREG_TO_R3_VM_V (11);
  1061. sw_r12_vm: SWREG_TO_R3_VM_V (12);
  1062. sw_r13_vm: SWREG_TO_R3_VM_V (13);
  1063. sw_r14_vm: SWREG_TO_R3_VM (14);
  1064. sw_r15_vm: SWREG_TO_R3_VM_V (15);
  1065. sw_r16_vm: SWREG_TO_R3_VM (16);
  1066. sw_r17_vm: SWREG_TO_R3_VM_V (17);
  1067. sw_r18_vm: SWREG_TO_R3_VM_V (18);
  1068. sw_r19_vm: SWREG_TO_R3_VM (19);
  1069. sw_r20_vm: SWREG_TO_R3_VM (20);
  1070. sw_r21_vm: SWREG_TO_R3_VM (21);
  1071. sw_r22_vm: SWREG_TO_R3_VM (22);
  1072. sw_r23_vm: SWREG_TO_R3_VM (23);
  1073. sw_r24_vm: SWREG_TO_R3_VM (24);
  1074. sw_r25_vm: SWREG_TO_R3_VM (25);
  1075. sw_r26_vm: SWREG_TO_R3_VM (26);
  1076. sw_r27_vm: SWREG_TO_R3_VM (27);
  1077. sw_r28_vm: SWREG_TO_R3_VM (28);
  1078. sw_r29_vm: SWREG_TO_R3_VM (29);
  1079. sw_r30_vm: SWREG_TO_R3_VM (30);
  1080. sw_r31_vm: SWREG_TO_R3_VM_V (31);
  1081. #endif /* CONFIG_MMU */
  1082. /* Temporary data structures used in the handler */
  1083. .section .data
  1084. .align 4
  1085. ex_tmp_data_loc_0:
  1086. .byte 0
  1087. ex_tmp_data_loc_1:
  1088. .byte 0
  1089. ex_tmp_data_loc_2:
  1090. .byte 0
  1091. ex_tmp_data_loc_3:
  1092. .byte 0
  1093. ex_reg_op:
  1094. .byte 0