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