hw_exception_handler.S 32 KB

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