hw_exception_handler.S 33 KB

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