hw_exception_handler.S 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  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 r3, resr
  291. nop
  292. mfs r4, rear;
  293. nop
  294. #ifndef CONFIG_MMU
  295. andi r5, r3, 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, r3, 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, r3, 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. * R3 = ESR
  394. * R4 = EAR
  395. */
  396. #ifdef CONFIG_MMU
  397. andi r6, r3, 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, r3, 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, r3, 0x400; /* Extract ESR[S] */
  415. bnei r6, ex_sw;
  416. ex_lw:
  417. andi r6, r3, 0x800; /* Extract ESR[W] */
  418. beqi r6, ex_lhw;
  419. lbui r5, r4, 0; /* Exception address in r4 */
  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, r4, 1;
  424. sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
  425. lbui r5, r4, 2;
  426. sbi r5, r0, TOPHYS(ex_tmp_data_loc_2);
  427. lbui r5, r4, 3;
  428. sbi r5, r0, TOPHYS(ex_tmp_data_loc_3);
  429. /* Get the destination register value into r3 */
  430. lwi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  431. bri ex_lw_tail;
  432. ex_lhw:
  433. lbui r5, r4, 0; /* Exception address in r4 */
  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, r4, 1;
  438. sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
  439. /* Get the destination register value into r3 */
  440. lhui r3, 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 r3, r0, TOPHYS(ex_tmp_data_loc_0);
  469. /* Store the word, byte-by-byte into destination address */
  470. lbui r3, r0, TOPHYS(ex_tmp_data_loc_0);
  471. sbi r3, r4, 0;
  472. lbui r3, r0, TOPHYS(ex_tmp_data_loc_1);
  473. sbi r3, r4, 1;
  474. lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);
  475. sbi r3, r4, 2;
  476. lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);
  477. sbi r3, r4, 3;
  478. bri ex_handler_done;
  479. ex_shw:
  480. /* Store the lower half-word, byte-by-byte into destination address */
  481. swi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  482. lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);
  483. sbi r3, r4, 0;
  484. lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);
  485. sbi r3, r4, 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. mfs r3, rear /* Get faulting address */
  521. nop
  522. /* If we are faulting a kernel address, we have to use the
  523. * kernel page tables.
  524. */
  525. ori r4, r0, CONFIG_KERNEL_START
  526. cmpu r4, r3, r4
  527. bgti r4, ex3
  528. /* First, check if it was a zone fault (which means a user
  529. * tried to access a kernel or read-protected page - always
  530. * a SEGV). All other faults here must be stores, so no
  531. * need to check ESR_S as well. */
  532. mfs r4, resr
  533. nop
  534. andi r4, r4, 0x800 /* ESR_Z - zone protection */
  535. bnei r4, ex2
  536. ori r4, r0, swapper_pg_dir
  537. mts rpid, r0 /* TLB will have 0 TID */
  538. nop
  539. bri ex4
  540. /* Get the PGD for the current thread. */
  541. ex3:
  542. /* First, check if it was a zone fault (which means a user
  543. * tried to access a kernel or read-protected page - always
  544. * a SEGV). All other faults here must be stores, so no
  545. * need to check ESR_S as well. */
  546. mfs r4, resr
  547. nop
  548. andi r4, r4, 0x800 /* ESR_Z */
  549. bnei r4, ex2
  550. /* get current task address */
  551. addi r4 ,CURRENT_TASK, TOPHYS(0);
  552. lwi r4, r4, TASK_THREAD+PGDIR
  553. ex4:
  554. tophys(r4,r4)
  555. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  556. andi r5, r5, 0xffc
  557. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  558. or r4, r4, r5
  559. lwi r4, r4, 0 /* Get L1 entry */
  560. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  561. beqi r5, ex2 /* Bail if no table */
  562. tophys(r5,r5)
  563. BSRLI(r6,r3,10) /* Compute PTE address */
  564. andi r6, r6, 0xffc
  565. andi r5, r5, 0xfffff003
  566. or r5, r5, r6
  567. lwi r4, r5, 0 /* Get Linux PTE */
  568. andi r6, r4, _PAGE_RW /* Is it writeable? */
  569. beqi r6, ex2 /* Bail if not */
  570. /* Update 'changed' */
  571. ori r4, r4, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
  572. swi r4, r5, 0 /* Update Linux page table */
  573. /* Most of the Linux PTE is ready to load into the TLB LO.
  574. * We set ZSEL, where only the LS-bit determines user access.
  575. * We set execute, because we don't have the granularity to
  576. * properly set this at the page level (Linux problem).
  577. * If shared is set, we cause a zero PID->TID load.
  578. * Many of these bits are software only. Bits we don't set
  579. * here we (properly should) assume have the appropriate value.
  580. */
  581. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  582. ori r4, r4, _PAGE_HWEXEC /* make it executable */
  583. /* find the TLB index that caused the fault. It has to be here*/
  584. mts rtlbsx, r3
  585. nop
  586. mfs r5, rtlbx /* DEBUG: TBD */
  587. nop
  588. mts rtlblo, r4 /* Load TLB LO */
  589. nop
  590. /* Will sync shadow TLBs */
  591. /* Done...restore registers and get out of here. */
  592. mts rpid, r11
  593. nop
  594. bri 4
  595. RESTORE_STATE;
  596. rted r17, 0
  597. nop
  598. ex2:
  599. /* The bailout. Restore registers to pre-exception conditions
  600. * and call the heavyweights to help us out. */
  601. mts rpid, r11
  602. nop
  603. bri 4
  604. RESTORE_STATE;
  605. bri page_fault_data_trap
  606. /* 0x11 - Instruction Storage Exception
  607. * This is caused by a fetch from non-execute or guarded pages. */
  608. handle_instruction_storage_exception:
  609. /* Working registers already saved: R3, R4, R5, R6
  610. * R3 = ESR
  611. */
  612. mfs r3, rear /* Get faulting address */
  613. nop
  614. RESTORE_STATE;
  615. bri page_fault_instr_trap
  616. /* 0x12 - Data TLB Miss Exception
  617. * As the name implies, translation is not in the MMU, so search the
  618. * page tables and fix it. The only purpose of this function is to
  619. * load TLB entries from the page table if they exist.
  620. */
  621. handle_data_tlb_miss_exception:
  622. /* Working registers already saved: R3, R4, R5, R6
  623. * R3 = EAR, R4 = ESR
  624. */
  625. mfs r11, rpid
  626. nop
  627. mfs r3, rear /* Get faulting address */
  628. nop
  629. /* If we are faulting a kernel address, we have to use the
  630. * kernel page tables. */
  631. ori r6, r0, CONFIG_KERNEL_START
  632. cmpu r4, r3, r6
  633. bgti r4, ex5
  634. ori r4, r0, swapper_pg_dir
  635. mts rpid, r0 /* TLB will have 0 TID */
  636. nop
  637. bri ex6
  638. /* Get the PGD for the current thread. */
  639. ex5:
  640. /* get current task address */
  641. addi r4 ,CURRENT_TASK, TOPHYS(0);
  642. lwi r4, r4, TASK_THREAD+PGDIR
  643. ex6:
  644. tophys(r4,r4)
  645. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  646. andi r5, r5, 0xffc
  647. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  648. or r4, r4, r5
  649. lwi r4, r4, 0 /* Get L1 entry */
  650. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  651. beqi r5, ex7 /* Bail if no table */
  652. tophys(r5,r5)
  653. BSRLI(r6,r3,10) /* Compute PTE address */
  654. andi r6, r6, 0xffc
  655. andi r5, r5, 0xfffff003
  656. or r5, r5, r6
  657. lwi r4, r5, 0 /* Get Linux PTE */
  658. andi r6, r4, _PAGE_PRESENT
  659. beqi r6, ex7
  660. ori r4, r4, _PAGE_ACCESSED
  661. swi r4, r5, 0
  662. /* Most of the Linux PTE is ready to load into the TLB LO.
  663. * We set ZSEL, where only the LS-bit determines user access.
  664. * We set execute, because we don't have the granularity to
  665. * properly set this at the page level (Linux problem).
  666. * If shared is set, we cause a zero PID->TID load.
  667. * Many of these bits are software only. Bits we don't set
  668. * here we (properly should) assume have the appropriate value.
  669. */
  670. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  671. bri finish_tlb_load
  672. ex7:
  673. /* The bailout. Restore registers to pre-exception conditions
  674. * and call the heavyweights to help us out.
  675. */
  676. mts rpid, r11
  677. nop
  678. bri 4
  679. RESTORE_STATE;
  680. bri page_fault_data_trap
  681. /* 0x13 - Instruction TLB Miss Exception
  682. * Nearly the same as above, except we get our information from
  683. * different registers and bailout to a different point.
  684. */
  685. handle_instruction_tlb_miss_exception:
  686. /* Working registers already saved: R3, R4, R5, R6
  687. * R3 = ESR
  688. */
  689. mfs r11, rpid
  690. nop
  691. mfs r3, rear /* Get faulting address */
  692. nop
  693. /* If we are faulting a kernel address, we have to use the
  694. * kernel page tables.
  695. */
  696. ori r4, r0, CONFIG_KERNEL_START
  697. cmpu r4, r3, r4
  698. bgti r4, ex8
  699. ori r4, r0, swapper_pg_dir
  700. mts rpid, r0 /* TLB will have 0 TID */
  701. nop
  702. bri ex9
  703. /* Get the PGD for the current thread. */
  704. ex8:
  705. /* get current task address */
  706. addi r4 ,CURRENT_TASK, TOPHYS(0);
  707. lwi r4, r4, TASK_THREAD+PGDIR
  708. ex9:
  709. tophys(r4,r4)
  710. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  711. andi r5, r5, 0xffc
  712. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  713. or r4, r4, r5
  714. lwi r4, r4, 0 /* Get L1 entry */
  715. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  716. beqi r5, ex10 /* Bail if no table */
  717. tophys(r5,r5)
  718. BSRLI(r6,r3,10) /* Compute PTE address */
  719. andi r6, r6, 0xffc
  720. andi r5, r5, 0xfffff003
  721. or r5, r5, r6
  722. lwi r4, r5, 0 /* Get Linux PTE */
  723. andi r6, r4, _PAGE_PRESENT
  724. beqi r6, ex7
  725. ori r4, r4, _PAGE_ACCESSED
  726. swi r4, r5, 0
  727. /* Most of the Linux PTE is ready to load into the TLB LO.
  728. * We set ZSEL, where only the LS-bit determines user access.
  729. * We set execute, because we don't have the granularity to
  730. * properly set this at the page level (Linux problem).
  731. * If shared is set, we cause a zero PID->TID load.
  732. * Many of these bits are software only. Bits we don't set
  733. * here we (properly should) assume have the appropriate value.
  734. */
  735. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  736. bri finish_tlb_load
  737. ex10:
  738. /* The bailout. Restore registers to pre-exception conditions
  739. * and call the heavyweights to help us out.
  740. */
  741. mts rpid, r11
  742. nop
  743. bri 4
  744. RESTORE_STATE;
  745. bri page_fault_instr_trap
  746. /* Both the instruction and data TLB miss get to this point to load the TLB.
  747. * r3 - EA of fault
  748. * r4 - TLB LO (info from Linux PTE)
  749. * r5, r6 - available to use
  750. * PID - loaded with proper value when we get here
  751. * Upon exit, we reload everything and RFI.
  752. * A common place to load the TLB.
  753. */
  754. tlb_index:
  755. .long 1 /* MS: storing last used tlb index */
  756. finish_tlb_load:
  757. /* MS: load the last used TLB index. */
  758. lwi r5, r0, TOPHYS(tlb_index)
  759. addik r5, r5, 1 /* MS: inc tlb_index -> use next one */
  760. /* MS: FIXME this is potential fault, because this is mask not count */
  761. andi r5, r5, (MICROBLAZE_TLB_SIZE-1)
  762. ori r6, r0, 1
  763. cmp r31, r5, r6
  764. blti r31, sem
  765. addik r5, r6, 1
  766. sem:
  767. /* MS: save back current TLB index */
  768. swi r5, r0, TOPHYS(tlb_index)
  769. ori r4, r4, _PAGE_HWEXEC /* make it executable */
  770. mts rtlbx, r5 /* MS: save current TLB */
  771. nop
  772. mts rtlblo, r4 /* MS: save to TLB LO */
  773. nop
  774. /* Create EPN. This is the faulting address plus a static
  775. * set of bits. These are size, valid, E, U0, and ensure
  776. * bits 20 and 21 are zero.
  777. */
  778. andi r3, r3, 0xfffff000
  779. ori r3, r3, 0x0c0
  780. mts rtlbhi, r3 /* Load TLB HI */
  781. nop
  782. /* Done...restore registers and get out of here. */
  783. ex12:
  784. mts rpid, r11
  785. nop
  786. bri 4
  787. RESTORE_STATE;
  788. rted r17, 0
  789. nop
  790. /* extern void giveup_fpu(struct task_struct *prev)
  791. *
  792. * The MicroBlaze processor may have an FPU, so this should not just
  793. * return: TBD.
  794. */
  795. .globl giveup_fpu;
  796. .align 4;
  797. giveup_fpu:
  798. bralid r15,0 /* TBD */
  799. nop
  800. /* At present, this routine just hangs. - extern void abort(void) */
  801. .globl abort;
  802. .align 4;
  803. abort:
  804. br r0
  805. .globl set_context;
  806. .align 4;
  807. set_context:
  808. mts rpid, r5 /* Shadow TLBs are automatically */
  809. nop
  810. bri 4 /* flushed by changing PID */
  811. rtsd r15,8
  812. nop
  813. #endif
  814. .end _hw_exception_handler
  815. #ifdef CONFIG_MMU
  816. /* Unaligned data access exception last on a 4k page for MMU.
  817. * When this is called, we are in virtual mode with exceptions enabled
  818. * and registers 1-13,15,17,18 saved.
  819. *
  820. * R3 = ESR
  821. * R4 = EAR
  822. * R7 = pointer to saved registers (struct pt_regs *regs)
  823. *
  824. * This handler perform the access, and returns via ret_from_exc.
  825. */
  826. .global _unaligned_data_exception
  827. .ent _unaligned_data_exception
  828. _unaligned_data_exception:
  829. andi r8, r3, 0x3E0; /* Mask and extract the register operand */
  830. BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */
  831. andi r6, r3, 0x400; /* Extract ESR[S] */
  832. bneid r6, ex_sw_vm;
  833. andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */
  834. ex_lw_vm:
  835. beqid r6, ex_lhw_vm;
  836. load1: lbui r5, r4, 0; /* Exception address in r4 - delay slot */
  837. /* Load a word, byte-by-byte from destination address and save it in tmp space*/
  838. la r6, r0, ex_tmp_data_loc_0;
  839. sbi r5, r6, 0;
  840. load2: lbui r5, r4, 1;
  841. sbi r5, r6, 1;
  842. load3: lbui r5, r4, 2;
  843. sbi r5, r6, 2;
  844. load4: lbui r5, r4, 3;
  845. sbi r5, r6, 3;
  846. brid ex_lw_tail_vm;
  847. /* Get the destination register value into r3 - delay slot */
  848. lwi r3, r6, 0;
  849. ex_lhw_vm:
  850. /* Load a half-word, byte-by-byte from destination address and
  851. * save it in tmp space */
  852. la r6, r0, ex_tmp_data_loc_0;
  853. sbi r5, r6, 0;
  854. load5: lbui r5, r4, 1;
  855. sbi r5, r6, 1;
  856. lhui r3, r6, 0; /* Get the destination register value into r3 */
  857. ex_lw_tail_vm:
  858. /* Form load_word jump table offset (lw_table_vm + (8 * regnum)) */
  859. addik r5, r8, lw_table_vm;
  860. bra r5;
  861. ex_lw_end_vm: /* Exception handling of load word, ends */
  862. brai ret_from_exc;
  863. ex_sw_vm:
  864. /* Form store_word jump table offset (sw_table_vm + (8 * regnum)) */
  865. addik r5, r8, sw_table_vm;
  866. bra r5;
  867. ex_sw_tail_vm:
  868. la r5, r0, ex_tmp_data_loc_0;
  869. beqid r6, ex_shw_vm;
  870. swi r3, r5, 0; /* Get the word - delay slot */
  871. /* Store the word, byte-by-byte into destination address */
  872. lbui r3, r5, 0;
  873. store1: sbi r3, r4, 0;
  874. lbui r3, r5, 1;
  875. store2: sbi r3, r4, 1;
  876. lbui r3, r5, 2;
  877. store3: sbi r3, r4, 2;
  878. lbui r3, r5, 3;
  879. brid ret_from_exc;
  880. store4: sbi r3, r4, 3; /* Delay slot */
  881. ex_shw_vm:
  882. /* Store the lower half-word, byte-by-byte into destination address */
  883. lbui r3, r5, 2;
  884. store5: sbi r3, r4, 0;
  885. lbui r3, r5, 3;
  886. brid ret_from_exc;
  887. store6: sbi r3, r4, 1; /* Delay slot */
  888. ex_sw_end_vm: /* Exception handling of store word, ends. */
  889. /* We have to prevent cases that get/put_user macros get unaligned pointer
  890. * to bad page area. We have to find out which origin instruction caused it
  891. * and called fixup for that origin instruction not instruction in unaligned
  892. * handler */
  893. ex_unaligned_fixup:
  894. ori r5, r7, 0 /* setup pointer to pt_regs */
  895. lwi r6, r7, PT_PC; /* faulting address is one instruction above */
  896. addik r6, r6, -4 /* for finding proper fixup */
  897. swi r6, r7, PT_PC; /* a save back it to PT_PC */
  898. addik r7, r0, SIGSEGV
  899. /* call bad_page_fault for finding aligned fixup, fixup address is saved
  900. * in PT_PC which is used as return address from exception */
  901. la r15, r0, ret_from_exc-8 /* setup return address */
  902. brid bad_page_fault
  903. nop
  904. /* We prevent all load/store because it could failed any attempt to access */
  905. .section __ex_table,"a";
  906. .word load1,ex_unaligned_fixup;
  907. .word load2,ex_unaligned_fixup;
  908. .word load3,ex_unaligned_fixup;
  909. .word load4,ex_unaligned_fixup;
  910. .word load5,ex_unaligned_fixup;
  911. .word store1,ex_unaligned_fixup;
  912. .word store2,ex_unaligned_fixup;
  913. .word store3,ex_unaligned_fixup;
  914. .word store4,ex_unaligned_fixup;
  915. .word store5,ex_unaligned_fixup;
  916. .word store6,ex_unaligned_fixup;
  917. .previous;
  918. .end _unaligned_data_exception
  919. #endif /* CONFIG_MMU */
  920. ex_handler_unhandled:
  921. /* FIXME add handle function for unhandled exception - dump register */
  922. bri 0
  923. /*
  924. * hw_exception_handler Jump Table
  925. * - Contains code snippets for each register that caused the unalign exception
  926. * - Hence exception handler is NOT self-modifying
  927. * - Separate table for load exceptions and store exceptions.
  928. * - Each table is of size: (8 * 32) = 256 bytes
  929. */
  930. .section .text
  931. .align 4
  932. lw_table:
  933. lw_r0: R3_TO_LWREG (0);
  934. lw_r1: LWREG_NOP;
  935. lw_r2: R3_TO_LWREG (2);
  936. lw_r3: R3_TO_LWREG_V (3);
  937. lw_r4: R3_TO_LWREG_V (4);
  938. lw_r5: R3_TO_LWREG_V (5);
  939. lw_r6: R3_TO_LWREG_V (6);
  940. lw_r7: R3_TO_LWREG (7);
  941. lw_r8: R3_TO_LWREG (8);
  942. lw_r9: R3_TO_LWREG (9);
  943. lw_r10: R3_TO_LWREG (10);
  944. lw_r11: R3_TO_LWREG (11);
  945. lw_r12: R3_TO_LWREG (12);
  946. lw_r13: R3_TO_LWREG (13);
  947. lw_r14: R3_TO_LWREG (14);
  948. lw_r15: R3_TO_LWREG (15);
  949. lw_r16: R3_TO_LWREG (16);
  950. lw_r17: LWREG_NOP;
  951. lw_r18: R3_TO_LWREG (18);
  952. lw_r19: R3_TO_LWREG (19);
  953. lw_r20: R3_TO_LWREG (20);
  954. lw_r21: R3_TO_LWREG (21);
  955. lw_r22: R3_TO_LWREG (22);
  956. lw_r23: R3_TO_LWREG (23);
  957. lw_r24: R3_TO_LWREG (24);
  958. lw_r25: R3_TO_LWREG (25);
  959. lw_r26: R3_TO_LWREG (26);
  960. lw_r27: R3_TO_LWREG (27);
  961. lw_r28: R3_TO_LWREG (28);
  962. lw_r29: R3_TO_LWREG (29);
  963. lw_r30: R3_TO_LWREG (30);
  964. #ifdef CONFIG_MMU
  965. lw_r31: R3_TO_LWREG_V (31);
  966. #else
  967. lw_r31: R3_TO_LWREG (31);
  968. #endif
  969. sw_table:
  970. sw_r0: SWREG_TO_R3 (0);
  971. sw_r1: SWREG_NOP;
  972. sw_r2: SWREG_TO_R3 (2);
  973. sw_r3: SWREG_TO_R3_V (3);
  974. sw_r4: SWREG_TO_R3_V (4);
  975. sw_r5: SWREG_TO_R3_V (5);
  976. sw_r6: SWREG_TO_R3_V (6);
  977. sw_r7: SWREG_TO_R3 (7);
  978. sw_r8: SWREG_TO_R3 (8);
  979. sw_r9: SWREG_TO_R3 (9);
  980. sw_r10: SWREG_TO_R3 (10);
  981. sw_r11: SWREG_TO_R3 (11);
  982. sw_r12: SWREG_TO_R3 (12);
  983. sw_r13: SWREG_TO_R3 (13);
  984. sw_r14: SWREG_TO_R3 (14);
  985. sw_r15: SWREG_TO_R3 (15);
  986. sw_r16: SWREG_TO_R3 (16);
  987. sw_r17: SWREG_NOP;
  988. sw_r18: SWREG_TO_R3 (18);
  989. sw_r19: SWREG_TO_R3 (19);
  990. sw_r20: SWREG_TO_R3 (20);
  991. sw_r21: SWREG_TO_R3 (21);
  992. sw_r22: SWREG_TO_R3 (22);
  993. sw_r23: SWREG_TO_R3 (23);
  994. sw_r24: SWREG_TO_R3 (24);
  995. sw_r25: SWREG_TO_R3 (25);
  996. sw_r26: SWREG_TO_R3 (26);
  997. sw_r27: SWREG_TO_R3 (27);
  998. sw_r28: SWREG_TO_R3 (28);
  999. sw_r29: SWREG_TO_R3 (29);
  1000. sw_r30: SWREG_TO_R3 (30);
  1001. #ifdef CONFIG_MMU
  1002. sw_r31: SWREG_TO_R3_V (31);
  1003. #else
  1004. sw_r31: SWREG_TO_R3 (31);
  1005. #endif
  1006. #ifdef CONFIG_MMU
  1007. lw_table_vm:
  1008. lw_r0_vm: R3_TO_LWREG_VM (0);
  1009. lw_r1_vm: R3_TO_LWREG_VM_V (1);
  1010. lw_r2_vm: R3_TO_LWREG_VM_V (2);
  1011. lw_r3_vm: R3_TO_LWREG_VM_V (3);
  1012. lw_r4_vm: R3_TO_LWREG_VM_V (4);
  1013. lw_r5_vm: R3_TO_LWREG_VM_V (5);
  1014. lw_r6_vm: R3_TO_LWREG_VM_V (6);
  1015. lw_r7_vm: R3_TO_LWREG_VM_V (7);
  1016. lw_r8_vm: R3_TO_LWREG_VM_V (8);
  1017. lw_r9_vm: R3_TO_LWREG_VM_V (9);
  1018. lw_r10_vm: R3_TO_LWREG_VM_V (10);
  1019. lw_r11_vm: R3_TO_LWREG_VM_V (11);
  1020. lw_r12_vm: R3_TO_LWREG_VM_V (12);
  1021. lw_r13_vm: R3_TO_LWREG_VM_V (13);
  1022. lw_r14_vm: R3_TO_LWREG_VM (14);
  1023. lw_r15_vm: R3_TO_LWREG_VM_V (15);
  1024. lw_r16_vm: R3_TO_LWREG_VM (16);
  1025. lw_r17_vm: R3_TO_LWREG_VM_V (17);
  1026. lw_r18_vm: R3_TO_LWREG_VM_V (18);
  1027. lw_r19_vm: R3_TO_LWREG_VM (19);
  1028. lw_r20_vm: R3_TO_LWREG_VM (20);
  1029. lw_r21_vm: R3_TO_LWREG_VM (21);
  1030. lw_r22_vm: R3_TO_LWREG_VM (22);
  1031. lw_r23_vm: R3_TO_LWREG_VM (23);
  1032. lw_r24_vm: R3_TO_LWREG_VM (24);
  1033. lw_r25_vm: R3_TO_LWREG_VM (25);
  1034. lw_r26_vm: R3_TO_LWREG_VM (26);
  1035. lw_r27_vm: R3_TO_LWREG_VM (27);
  1036. lw_r28_vm: R3_TO_LWREG_VM (28);
  1037. lw_r29_vm: R3_TO_LWREG_VM (29);
  1038. lw_r30_vm: R3_TO_LWREG_VM (30);
  1039. lw_r31_vm: R3_TO_LWREG_VM_V (31);
  1040. sw_table_vm:
  1041. sw_r0_vm: SWREG_TO_R3_VM (0);
  1042. sw_r1_vm: SWREG_TO_R3_VM_V (1);
  1043. sw_r2_vm: SWREG_TO_R3_VM_V (2);
  1044. sw_r3_vm: SWREG_TO_R3_VM_V (3);
  1045. sw_r4_vm: SWREG_TO_R3_VM_V (4);
  1046. sw_r5_vm: SWREG_TO_R3_VM_V (5);
  1047. sw_r6_vm: SWREG_TO_R3_VM_V (6);
  1048. sw_r7_vm: SWREG_TO_R3_VM_V (7);
  1049. sw_r8_vm: SWREG_TO_R3_VM_V (8);
  1050. sw_r9_vm: SWREG_TO_R3_VM_V (9);
  1051. sw_r10_vm: SWREG_TO_R3_VM_V (10);
  1052. sw_r11_vm: SWREG_TO_R3_VM_V (11);
  1053. sw_r12_vm: SWREG_TO_R3_VM_V (12);
  1054. sw_r13_vm: SWREG_TO_R3_VM_V (13);
  1055. sw_r14_vm: SWREG_TO_R3_VM (14);
  1056. sw_r15_vm: SWREG_TO_R3_VM_V (15);
  1057. sw_r16_vm: SWREG_TO_R3_VM (16);
  1058. sw_r17_vm: SWREG_TO_R3_VM_V (17);
  1059. sw_r18_vm: SWREG_TO_R3_VM_V (18);
  1060. sw_r19_vm: SWREG_TO_R3_VM (19);
  1061. sw_r20_vm: SWREG_TO_R3_VM (20);
  1062. sw_r21_vm: SWREG_TO_R3_VM (21);
  1063. sw_r22_vm: SWREG_TO_R3_VM (22);
  1064. sw_r23_vm: SWREG_TO_R3_VM (23);
  1065. sw_r24_vm: SWREG_TO_R3_VM (24);
  1066. sw_r25_vm: SWREG_TO_R3_VM (25);
  1067. sw_r26_vm: SWREG_TO_R3_VM (26);
  1068. sw_r27_vm: SWREG_TO_R3_VM (27);
  1069. sw_r28_vm: SWREG_TO_R3_VM (28);
  1070. sw_r29_vm: SWREG_TO_R3_VM (29);
  1071. sw_r30_vm: SWREG_TO_R3_VM (30);
  1072. sw_r31_vm: SWREG_TO_R3_VM_V (31);
  1073. #endif /* CONFIG_MMU */
  1074. /* Temporary data structures used in the handler */
  1075. .section .data
  1076. .align 4
  1077. ex_tmp_data_loc_0:
  1078. .byte 0
  1079. ex_tmp_data_loc_1:
  1080. .byte 0
  1081. ex_tmp_data_loc_2:
  1082. .byte 0
  1083. ex_tmp_data_loc_3:
  1084. .byte 0
  1085. ex_reg_op:
  1086. .byte 0