hw_exception_handler.S 32 KB

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