hw_exception_handler.S 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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. /* counting which exception happen */
  308. lwi r5, r0, 0x200 + TOPHYS(r0_ram)
  309. addi r5, r5, 1
  310. swi r5, r0, 0x200 + TOPHYS(r0_ram)
  311. lwi r5, r6, 0x200 + TOPHYS(r0_ram)
  312. addi r5, r5, 1
  313. swi r5, r6, 0x200 + TOPHYS(r0_ram)
  314. /* end */
  315. /* Load the HW Exception vector */
  316. lwi r6, r6, TOPHYS(_MB_HW_ExceptionVectorTable)
  317. bra r6
  318. full_exception_trapw:
  319. RESTORE_STATE
  320. bri full_exception_trap
  321. #else
  322. /* Exceptions enabled here. This will allow nested exceptions */
  323. mfs r6, rmsr;
  324. nop
  325. swi r6, r1, 0; /* RMSR_OFFSET */
  326. ori r6, r6, 0x100; /* Turn ON the EE bit */
  327. andi r6, r6, ~2; /* Disable interrupts */
  328. mts rmsr, r6;
  329. nop
  330. xori r6, r5, 1; /* 00001 = Unaligned Exception */
  331. /* Jump to unalignment exception handler */
  332. beqi r6, handle_unaligned_ex;
  333. handle_other_ex: /* Handle Other exceptions here */
  334. /* Save other volatiles before we make procedure calls below */
  335. swi r7, r1, PT_R7
  336. swi r8, r1, PT_R8
  337. swi r9, r1, PT_R9
  338. swi r10, r1, PT_R10
  339. swi r11, r1, PT_R11
  340. swi r12, r1, PT_R12
  341. swi r14, r1, PT_R14
  342. swi r15, r1, PT_R15
  343. swi r18, r1, PT_R18
  344. or r5, r1, r0
  345. andi r6, r3, 0x1F; /* Load ESR[EC] */
  346. lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */
  347. swi r7, r1, PT_MODE
  348. mfs r7, rfsr
  349. nop
  350. addk r8, r17, r0; /* Load exception address */
  351. bralid r15, full_exception; /* Branch to the handler */
  352. nop;
  353. mts rfsr, r0; /* Clear sticky fsr */
  354. nop
  355. /*
  356. * Trigger execution of the signal handler by enabling
  357. * interrupts and calling an invalid syscall.
  358. */
  359. mfs r5, rmsr;
  360. nop
  361. ori r5, r5, 2;
  362. mts rmsr, r5; /* enable interrupt */
  363. nop
  364. addi r12, r0, __NR_syscalls;
  365. brki r14, 0x08;
  366. mfs r5, rmsr; /* disable interrupt */
  367. nop
  368. andi r5, r5, ~2;
  369. mts rmsr, r5;
  370. nop
  371. lwi r7, r1, PT_R7
  372. lwi r8, r1, PT_R8
  373. lwi r9, r1, PT_R9
  374. lwi r10, r1, PT_R10
  375. lwi r11, r1, PT_R11
  376. lwi r12, r1, PT_R12
  377. lwi r14, r1, PT_R14
  378. lwi r15, r1, PT_R15
  379. lwi r18, r1, PT_R18
  380. bri ex_handler_done; /* Complete exception handling */
  381. #endif
  382. /* 0x01 - Unaligned data access exception
  383. * This occurs when a word access is not aligned on a word boundary,
  384. * or when a 16-bit access is not aligned on a 16-bit boundary.
  385. * This handler perform the access, and returns, except for MMU when
  386. * the unaligned address is last on a 4k page or the physical address is
  387. * not found in the page table, in which case unaligned_data_trap is called.
  388. */
  389. handle_unaligned_ex:
  390. /* Working registers already saved: R3, R4, R5, R6
  391. * R3 = ESR
  392. * R4 = EAR
  393. */
  394. #ifdef CONFIG_MMU
  395. andi r6, r3, 0x1000 /* Check ESR[DS] */
  396. beqi r6, _no_delayslot /* Branch if ESR[DS] not set */
  397. mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
  398. nop
  399. _no_delayslot:
  400. /* jump to high level unaligned handler */
  401. RESTORE_STATE;
  402. bri unaligned_data_trap
  403. #endif
  404. andi r6, r3, 0x3E0; /* Mask and extract the register operand */
  405. srl r6, r6; /* r6 >> 5 */
  406. srl r6, r6;
  407. srl r6, r6;
  408. srl r6, r6;
  409. srl r6, r6;
  410. /* Store the register operand in a temporary location */
  411. sbi r6, r0, TOPHYS(ex_reg_op);
  412. andi r6, r3, 0x400; /* Extract ESR[S] */
  413. bnei r6, ex_sw;
  414. ex_lw:
  415. andi r6, r3, 0x800; /* Extract ESR[W] */
  416. beqi r6, ex_lhw;
  417. lbui r5, r4, 0; /* Exception address in r4 */
  418. /* Load a word, byte-by-byte from destination address
  419. and save it in tmp space */
  420. sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
  421. lbui r5, r4, 1;
  422. sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
  423. lbui r5, r4, 2;
  424. sbi r5, r0, TOPHYS(ex_tmp_data_loc_2);
  425. lbui r5, r4, 3;
  426. sbi r5, r0, TOPHYS(ex_tmp_data_loc_3);
  427. /* Get the destination register value into r3 */
  428. lwi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  429. bri ex_lw_tail;
  430. ex_lhw:
  431. lbui r5, r4, 0; /* Exception address in r4 */
  432. /* Load a half-word, byte-by-byte from destination
  433. address and save it in tmp space */
  434. sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
  435. lbui r5, r4, 1;
  436. sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
  437. /* Get the destination register value into r3 */
  438. lhui r3, r0, TOPHYS(ex_tmp_data_loc_0);
  439. ex_lw_tail:
  440. /* Get the destination register number into r5 */
  441. lbui r5, r0, TOPHYS(ex_reg_op);
  442. /* Form load_word jump table offset (lw_table + (8 * regnum)) */
  443. la r6, r0, TOPHYS(lw_table);
  444. addk r5, r5, r5;
  445. addk r5, r5, r5;
  446. addk r5, r5, r5;
  447. addk r5, r5, r6;
  448. bra r5;
  449. ex_lw_end: /* Exception handling of load word, ends */
  450. ex_sw:
  451. /* Get the destination register number into r5 */
  452. lbui r5, r0, TOPHYS(ex_reg_op);
  453. /* Form store_word jump table offset (sw_table + (8 * regnum)) */
  454. la r6, r0, TOPHYS(sw_table);
  455. add r5, r5, r5;
  456. add r5, r5, r5;
  457. add r5, r5, r5;
  458. add r5, r5, r6;
  459. bra r5;
  460. ex_sw_tail:
  461. mfs r6, resr;
  462. nop
  463. andi r6, r6, 0x800; /* Extract ESR[W] */
  464. beqi r6, ex_shw;
  465. /* Get the word - delay slot */
  466. swi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  467. /* Store the word, byte-by-byte into destination address */
  468. lbui r3, r0, TOPHYS(ex_tmp_data_loc_0);
  469. sbi r3, r4, 0;
  470. lbui r3, r0, TOPHYS(ex_tmp_data_loc_1);
  471. sbi r3, r4, 1;
  472. lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);
  473. sbi r3, r4, 2;
  474. lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);
  475. sbi r3, r4, 3;
  476. bri ex_handler_done;
  477. ex_shw:
  478. /* Store the lower half-word, byte-by-byte into destination address */
  479. swi r3, r0, TOPHYS(ex_tmp_data_loc_0);
  480. lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);
  481. sbi r3, r4, 0;
  482. lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);
  483. sbi r3, r4, 1;
  484. ex_sw_end: /* Exception handling of store word, ends. */
  485. ex_handler_done:
  486. #ifndef CONFIG_MMU
  487. lwi r5, r1, 0 /* RMSR */
  488. mts rmsr, r5
  489. nop
  490. lwi r3, r1, PT_R3
  491. lwi r4, r1, PT_R4
  492. lwi r5, r1, PT_R5
  493. lwi r6, r1, PT_R6
  494. lwi r17, r1, PT_R17
  495. rted r17, 0
  496. addik r1, r1, (EX_HANDLER_STACK_SIZ); /* Restore stack frame */
  497. #else
  498. RESTORE_STATE;
  499. rted r17, 0
  500. nop
  501. #endif
  502. #ifdef CONFIG_MMU
  503. /* Exception vector entry code. This code runs with address translation
  504. * turned off (i.e. using physical addresses). */
  505. /* Exception vectors. */
  506. /* 0x10 - Data Storage Exception
  507. * This happens for just a few reasons. U0 set (but we don't do that),
  508. * or zone protection fault (user violation, write to protected page).
  509. * If this is just an update of modified status, we do that quickly
  510. * and exit. Otherwise, we call heavyweight functions to do the work.
  511. */
  512. handle_data_storage_exception:
  513. /* Working registers already saved: R3, R4, R5, R6
  514. * R3 = ESR
  515. */
  516. mfs r11, rpid
  517. nop
  518. bri 4
  519. mfs r3, rear /* Get faulting address */
  520. nop
  521. /* If we are faulting a kernel address, we have to use the
  522. * kernel page tables.
  523. */
  524. ori r4, r0, CONFIG_KERNEL_START
  525. cmpu r4, r3, r4
  526. bgti r4, ex3
  527. /* First, check if it was a zone fault (which means a user
  528. * tried to access a kernel or read-protected page - always
  529. * a SEGV). All other faults here must be stores, so no
  530. * need to check ESR_S as well. */
  531. mfs r4, resr
  532. nop
  533. andi r4, r4, 0x800 /* ESR_Z - zone protection */
  534. bnei r4, ex2
  535. ori r4, r0, swapper_pg_dir
  536. mts rpid, r0 /* TLB will have 0 TID */
  537. nop
  538. bri ex4
  539. /* Get the PGD for the current thread. */
  540. ex3:
  541. /* First, check if it was a zone fault (which means a user
  542. * tried to access a kernel or read-protected page - always
  543. * a SEGV). All other faults here must be stores, so no
  544. * need to check ESR_S as well. */
  545. mfs r4, resr
  546. nop
  547. andi r4, r4, 0x800 /* ESR_Z */
  548. bnei r4, ex2
  549. /* get current task address */
  550. addi r4 ,CURRENT_TASK, TOPHYS(0);
  551. lwi r4, r4, TASK_THREAD+PGDIR
  552. ex4:
  553. tophys(r4,r4)
  554. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  555. andi r5, r5, 0xffc
  556. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  557. or r4, r4, r5
  558. lwi r4, r4, 0 /* Get L1 entry */
  559. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  560. beqi r5, ex2 /* Bail if no table */
  561. tophys(r5,r5)
  562. BSRLI(r6,r3,10) /* Compute PTE address */
  563. andi r6, r6, 0xffc
  564. andi r5, r5, 0xfffff003
  565. or r5, r5, r6
  566. lwi r4, r5, 0 /* Get Linux PTE */
  567. andi r6, r4, _PAGE_RW /* Is it writeable? */
  568. beqi r6, ex2 /* Bail if not */
  569. /* Update 'changed' */
  570. ori r4, r4, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
  571. swi r4, r5, 0 /* Update Linux page table */
  572. /* Most of the Linux PTE is ready to load into the TLB LO.
  573. * We set ZSEL, where only the LS-bit determines user access.
  574. * We set execute, because we don't have the granularity to
  575. * properly set this at the page level (Linux problem).
  576. * If shared is set, we cause a zero PID->TID load.
  577. * Many of these bits are software only. Bits we don't set
  578. * here we (properly should) assume have the appropriate value.
  579. */
  580. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  581. ori r4, r4, _PAGE_HWEXEC /* make it executable */
  582. /* find the TLB index that caused the fault. It has to be here*/
  583. mts rtlbsx, r3
  584. nop
  585. mfs r5, rtlbx /* DEBUG: TBD */
  586. nop
  587. mts rtlblo, r4 /* Load TLB LO */
  588. nop
  589. /* Will sync shadow TLBs */
  590. /* Done...restore registers and get out of here. */
  591. mts rpid, r11
  592. nop
  593. bri 4
  594. RESTORE_STATE;
  595. rted r17, 0
  596. nop
  597. ex2:
  598. /* The bailout. Restore registers to pre-exception conditions
  599. * and call the heavyweights to help us out. */
  600. mts rpid, r11
  601. nop
  602. bri 4
  603. RESTORE_STATE;
  604. bri page_fault_data_trap
  605. /* 0x11 - Instruction Storage Exception
  606. * This is caused by a fetch from non-execute or guarded pages. */
  607. handle_instruction_storage_exception:
  608. /* Working registers already saved: R3, R4, R5, R6
  609. * R3 = ESR
  610. */
  611. mfs r3, rear /* Get faulting address */
  612. nop
  613. RESTORE_STATE;
  614. bri page_fault_instr_trap
  615. /* 0x12 - Data TLB Miss Exception
  616. * As the name implies, translation is not in the MMU, so search the
  617. * page tables and fix it. The only purpose of this function is to
  618. * load TLB entries from the page table if they exist.
  619. */
  620. handle_data_tlb_miss_exception:
  621. /* Working registers already saved: R3, R4, R5, R6
  622. * R3 = ESR
  623. */
  624. mfs r11, rpid
  625. nop
  626. bri 4
  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 r4, r0, CONFIG_KERNEL_START
  632. cmpu r4, r3, r4
  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. bri 4
  692. mfs r3, rear /* Get faulting address */
  693. nop
  694. /* If we are faulting a kernel address, we have to use the
  695. * kernel page tables.
  696. */
  697. ori r4, r0, CONFIG_KERNEL_START
  698. cmpu r4, r3, r4
  699. bgti r4, ex8
  700. ori r4, r0, swapper_pg_dir
  701. mts rpid, r0 /* TLB will have 0 TID */
  702. nop
  703. bri ex9
  704. /* Get the PGD for the current thread. */
  705. ex8:
  706. /* get current task address */
  707. addi r4 ,CURRENT_TASK, TOPHYS(0);
  708. lwi r4, r4, TASK_THREAD+PGDIR
  709. ex9:
  710. tophys(r4,r4)
  711. BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */
  712. andi r5, r5, 0xffc
  713. /* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
  714. or r4, r4, r5
  715. lwi r4, r4, 0 /* Get L1 entry */
  716. andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */
  717. beqi r5, ex10 /* Bail if no table */
  718. tophys(r5,r5)
  719. BSRLI(r6,r3,10) /* Compute PTE address */
  720. andi r6, r6, 0xffc
  721. andi r5, r5, 0xfffff003
  722. or r5, r5, r6
  723. lwi r4, r5, 0 /* Get Linux PTE */
  724. andi r6, r4, _PAGE_PRESENT
  725. beqi r6, ex7
  726. ori r4, r4, _PAGE_ACCESSED
  727. swi r4, r5, 0
  728. /* Most of the Linux PTE is ready to load into the TLB LO.
  729. * We set ZSEL, where only the LS-bit determines user access.
  730. * We set execute, because we don't have the granularity to
  731. * properly set this at the page level (Linux problem).
  732. * If shared is set, we cause a zero PID->TID load.
  733. * Many of these bits are software only. Bits we don't set
  734. * here we (properly should) assume have the appropriate value.
  735. */
  736. andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */
  737. bri finish_tlb_load
  738. ex10:
  739. /* The bailout. Restore registers to pre-exception conditions
  740. * and call the heavyweights to help us out.
  741. */
  742. mts rpid, r11
  743. nop
  744. bri 4
  745. RESTORE_STATE;
  746. bri page_fault_instr_trap
  747. /* Both the instruction and data TLB miss get to this point to load the TLB.
  748. * r3 - EA of fault
  749. * r4 - TLB LO (info from Linux PTE)
  750. * r5, r6 - available to use
  751. * PID - loaded with proper value when we get here
  752. * Upon exit, we reload everything and RFI.
  753. * A common place to load the TLB.
  754. */
  755. tlb_index:
  756. .long 1 /* MS: storing last used tlb index */
  757. finish_tlb_load:
  758. /* MS: load the last used TLB index. */
  759. lwi r5, r0, TOPHYS(tlb_index)
  760. addik r5, r5, 1 /* MS: inc tlb_index -> use next one */
  761. /* MS: FIXME this is potential fault, because this is mask not count */
  762. andi r5, r5, (MICROBLAZE_TLB_SIZE-1)
  763. ori r6, r0, 1
  764. cmp r31, r5, r6
  765. blti r31, sem
  766. addik r5, r6, 1
  767. sem:
  768. /* MS: save back current TLB index */
  769. swi r5, r0, TOPHYS(tlb_index)
  770. ori r4, r4, _PAGE_HWEXEC /* make it executable */
  771. mts rtlbx, r5 /* MS: save current TLB */
  772. nop
  773. mts rtlblo, r4 /* MS: save to TLB LO */
  774. nop
  775. /* Create EPN. This is the faulting address plus a static
  776. * set of bits. These are size, valid, E, U0, and ensure
  777. * bits 20 and 21 are zero.
  778. */
  779. andi r3, r3, 0xfffff000
  780. ori r3, r3, 0x0c0
  781. mts rtlbhi, r3 /* Load TLB HI */
  782. nop
  783. /* Done...restore registers and get out of here. */
  784. ex12:
  785. mts rpid, r11
  786. nop
  787. bri 4
  788. RESTORE_STATE;
  789. rted r17, 0
  790. nop
  791. /* extern void giveup_fpu(struct task_struct *prev)
  792. *
  793. * The MicroBlaze processor may have an FPU, so this should not just
  794. * return: TBD.
  795. */
  796. .globl giveup_fpu;
  797. .align 4;
  798. giveup_fpu:
  799. bralid r15,0 /* TBD */
  800. nop
  801. /* At present, this routine just hangs. - extern void abort(void) */
  802. .globl abort;
  803. .align 4;
  804. abort:
  805. br r0
  806. .globl set_context;
  807. .align 4;
  808. set_context:
  809. mts rpid, r5 /* Shadow TLBs are automatically */
  810. nop
  811. bri 4 /* flushed by changing PID */
  812. rtsd r15,8
  813. nop
  814. #endif
  815. .end _hw_exception_handler
  816. #ifdef CONFIG_MMU
  817. /* Unaligned data access exception last on a 4k page for MMU.
  818. * When this is called, we are in virtual mode with exceptions enabled
  819. * and registers 1-13,15,17,18 saved.
  820. *
  821. * R3 = ESR
  822. * R4 = EAR
  823. * R7 = pointer to saved registers (struct pt_regs *regs)
  824. *
  825. * This handler perform the access, and returns via ret_from_exc.
  826. */
  827. .global _unaligned_data_exception
  828. .ent _unaligned_data_exception
  829. _unaligned_data_exception:
  830. andi r8, r3, 0x3E0; /* Mask and extract the register operand */
  831. BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */
  832. andi r6, r3, 0x400; /* Extract ESR[S] */
  833. bneid r6, ex_sw_vm;
  834. andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */
  835. ex_lw_vm:
  836. beqid r6, ex_lhw_vm;
  837. load1: lbui r5, r4, 0; /* Exception address in r4 - delay slot */
  838. /* Load a word, byte-by-byte from destination address and save it in tmp space*/
  839. la r6, r0, ex_tmp_data_loc_0;
  840. sbi r5, r6, 0;
  841. load2: lbui r5, r4, 1;
  842. sbi r5, r6, 1;
  843. load3: lbui r5, r4, 2;
  844. sbi r5, r6, 2;
  845. load4: lbui r5, r4, 3;
  846. sbi r5, r6, 3;
  847. brid ex_lw_tail_vm;
  848. /* Get the destination register value into r3 - delay slot */
  849. lwi r3, r6, 0;
  850. ex_lhw_vm:
  851. /* Load a half-word, byte-by-byte from destination address and
  852. * save it in tmp space */
  853. la r6, r0, ex_tmp_data_loc_0;
  854. sbi r5, r6, 0;
  855. load5: lbui r5, r4, 1;
  856. sbi r5, r6, 1;
  857. lhui r3, r6, 0; /* Get the destination register value into r3 */
  858. ex_lw_tail_vm:
  859. /* Form load_word jump table offset (lw_table_vm + (8 * regnum)) */
  860. addik r5, r8, lw_table_vm;
  861. bra r5;
  862. ex_lw_end_vm: /* Exception handling of load word, ends */
  863. brai ret_from_exc;
  864. ex_sw_vm:
  865. /* Form store_word jump table offset (sw_table_vm + (8 * regnum)) */
  866. addik r5, r8, sw_table_vm;
  867. bra r5;
  868. ex_sw_tail_vm:
  869. la r5, r0, ex_tmp_data_loc_0;
  870. beqid r6, ex_shw_vm;
  871. swi r3, r5, 0; /* Get the word - delay slot */
  872. /* Store the word, byte-by-byte into destination address */
  873. lbui r3, r5, 0;
  874. store1: sbi r3, r4, 0;
  875. lbui r3, r5, 1;
  876. store2: sbi r3, r4, 1;
  877. lbui r3, r5, 2;
  878. store3: sbi r3, r4, 2;
  879. lbui r3, r5, 3;
  880. brid ret_from_exc;
  881. store4: sbi r3, r4, 3; /* Delay slot */
  882. ex_shw_vm:
  883. /* Store the lower half-word, byte-by-byte into destination address */
  884. lbui r3, r5, 2;
  885. store5: sbi r3, r4, 0;
  886. lbui r3, r5, 3;
  887. brid ret_from_exc;
  888. store6: sbi r3, r4, 1; /* Delay slot */
  889. ex_sw_end_vm: /* Exception handling of store word, ends. */
  890. /* We have to prevent cases that get/put_user macros get unaligned pointer
  891. * to bad page area. We have to find out which origin instruction caused it
  892. * and called fixup for that origin instruction not instruction in unaligned
  893. * handler */
  894. ex_unaligned_fixup:
  895. ori r5, r7, 0 /* setup pointer to pt_regs */
  896. lwi r6, r7, PT_PC; /* faulting address is one instruction above */
  897. addik r6, r6, -4 /* for finding proper fixup */
  898. swi r6, r7, PT_PC; /* a save back it to PT_PC */
  899. addik r7, r0, SIGSEGV
  900. /* call bad_page_fault for finding aligned fixup, fixup address is saved
  901. * in PT_PC which is used as return address from exception */
  902. la r15, r0, ret_from_exc-8 /* setup return address */
  903. brid bad_page_fault
  904. nop
  905. /* We prevent all load/store because it could failed any attempt to access */
  906. .section __ex_table,"a";
  907. .word load1,ex_unaligned_fixup;
  908. .word load2,ex_unaligned_fixup;
  909. .word load3,ex_unaligned_fixup;
  910. .word load4,ex_unaligned_fixup;
  911. .word load5,ex_unaligned_fixup;
  912. .word store1,ex_unaligned_fixup;
  913. .word store2,ex_unaligned_fixup;
  914. .word store3,ex_unaligned_fixup;
  915. .word store4,ex_unaligned_fixup;
  916. .word store5,ex_unaligned_fixup;
  917. .word store6,ex_unaligned_fixup;
  918. .previous;
  919. .end _unaligned_data_exception
  920. #endif /* CONFIG_MMU */
  921. ex_handler_unhandled:
  922. /* FIXME add handle function for unhandled exception - dump register */
  923. bri 0
  924. /*
  925. * hw_exception_handler Jump Table
  926. * - Contains code snippets for each register that caused the unalign exception
  927. * - Hence exception handler is NOT self-modifying
  928. * - Separate table for load exceptions and store exceptions.
  929. * - Each table is of size: (8 * 32) = 256 bytes
  930. */
  931. .section .text
  932. .align 4
  933. lw_table:
  934. lw_r0: R3_TO_LWREG (0);
  935. lw_r1: LWREG_NOP;
  936. lw_r2: R3_TO_LWREG (2);
  937. lw_r3: R3_TO_LWREG_V (3);
  938. lw_r4: R3_TO_LWREG_V (4);
  939. lw_r5: R3_TO_LWREG_V (5);
  940. lw_r6: R3_TO_LWREG_V (6);
  941. lw_r7: R3_TO_LWREG (7);
  942. lw_r8: R3_TO_LWREG (8);
  943. lw_r9: R3_TO_LWREG (9);
  944. lw_r10: R3_TO_LWREG (10);
  945. lw_r11: R3_TO_LWREG (11);
  946. lw_r12: R3_TO_LWREG (12);
  947. lw_r13: R3_TO_LWREG (13);
  948. lw_r14: R3_TO_LWREG (14);
  949. lw_r15: R3_TO_LWREG (15);
  950. lw_r16: R3_TO_LWREG (16);
  951. lw_r17: LWREG_NOP;
  952. lw_r18: R3_TO_LWREG (18);
  953. lw_r19: R3_TO_LWREG (19);
  954. lw_r20: R3_TO_LWREG (20);
  955. lw_r21: R3_TO_LWREG (21);
  956. lw_r22: R3_TO_LWREG (22);
  957. lw_r23: R3_TO_LWREG (23);
  958. lw_r24: R3_TO_LWREG (24);
  959. lw_r25: R3_TO_LWREG (25);
  960. lw_r26: R3_TO_LWREG (26);
  961. lw_r27: R3_TO_LWREG (27);
  962. lw_r28: R3_TO_LWREG (28);
  963. lw_r29: R3_TO_LWREG (29);
  964. lw_r30: R3_TO_LWREG (30);
  965. #ifdef CONFIG_MMU
  966. lw_r31: R3_TO_LWREG_V (31);
  967. #else
  968. lw_r31: R3_TO_LWREG (31);
  969. #endif
  970. sw_table:
  971. sw_r0: SWREG_TO_R3 (0);
  972. sw_r1: SWREG_NOP;
  973. sw_r2: SWREG_TO_R3 (2);
  974. sw_r3: SWREG_TO_R3_V (3);
  975. sw_r4: SWREG_TO_R3_V (4);
  976. sw_r5: SWREG_TO_R3_V (5);
  977. sw_r6: SWREG_TO_R3_V (6);
  978. sw_r7: SWREG_TO_R3 (7);
  979. sw_r8: SWREG_TO_R3 (8);
  980. sw_r9: SWREG_TO_R3 (9);
  981. sw_r10: SWREG_TO_R3 (10);
  982. sw_r11: SWREG_TO_R3 (11);
  983. sw_r12: SWREG_TO_R3 (12);
  984. sw_r13: SWREG_TO_R3 (13);
  985. sw_r14: SWREG_TO_R3 (14);
  986. sw_r15: SWREG_TO_R3 (15);
  987. sw_r16: SWREG_TO_R3 (16);
  988. sw_r17: SWREG_NOP;
  989. sw_r18: SWREG_TO_R3 (18);
  990. sw_r19: SWREG_TO_R3 (19);
  991. sw_r20: SWREG_TO_R3 (20);
  992. sw_r21: SWREG_TO_R3 (21);
  993. sw_r22: SWREG_TO_R3 (22);
  994. sw_r23: SWREG_TO_R3 (23);
  995. sw_r24: SWREG_TO_R3 (24);
  996. sw_r25: SWREG_TO_R3 (25);
  997. sw_r26: SWREG_TO_R3 (26);
  998. sw_r27: SWREG_TO_R3 (27);
  999. sw_r28: SWREG_TO_R3 (28);
  1000. sw_r29: SWREG_TO_R3 (29);
  1001. sw_r30: SWREG_TO_R3 (30);
  1002. #ifdef CONFIG_MMU
  1003. sw_r31: SWREG_TO_R3_V (31);
  1004. #else
  1005. sw_r31: SWREG_TO_R3 (31);
  1006. #endif
  1007. #ifdef CONFIG_MMU
  1008. lw_table_vm:
  1009. lw_r0_vm: R3_TO_LWREG_VM (0);
  1010. lw_r1_vm: R3_TO_LWREG_VM_V (1);
  1011. lw_r2_vm: R3_TO_LWREG_VM_V (2);
  1012. lw_r3_vm: R3_TO_LWREG_VM_V (3);
  1013. lw_r4_vm: R3_TO_LWREG_VM_V (4);
  1014. lw_r5_vm: R3_TO_LWREG_VM_V (5);
  1015. lw_r6_vm: R3_TO_LWREG_VM_V (6);
  1016. lw_r7_vm: R3_TO_LWREG_VM_V (7);
  1017. lw_r8_vm: R3_TO_LWREG_VM_V (8);
  1018. lw_r9_vm: R3_TO_LWREG_VM_V (9);
  1019. lw_r10_vm: R3_TO_LWREG_VM_V (10);
  1020. lw_r11_vm: R3_TO_LWREG_VM_V (11);
  1021. lw_r12_vm: R3_TO_LWREG_VM_V (12);
  1022. lw_r13_vm: R3_TO_LWREG_VM_V (13);
  1023. lw_r14_vm: R3_TO_LWREG_VM (14);
  1024. lw_r15_vm: R3_TO_LWREG_VM_V (15);
  1025. lw_r16_vm: R3_TO_LWREG_VM (16);
  1026. lw_r17_vm: R3_TO_LWREG_VM_V (17);
  1027. lw_r18_vm: R3_TO_LWREG_VM_V (18);
  1028. lw_r19_vm: R3_TO_LWREG_VM (19);
  1029. lw_r20_vm: R3_TO_LWREG_VM (20);
  1030. lw_r21_vm: R3_TO_LWREG_VM (21);
  1031. lw_r22_vm: R3_TO_LWREG_VM (22);
  1032. lw_r23_vm: R3_TO_LWREG_VM (23);
  1033. lw_r24_vm: R3_TO_LWREG_VM (24);
  1034. lw_r25_vm: R3_TO_LWREG_VM (25);
  1035. lw_r26_vm: R3_TO_LWREG_VM (26);
  1036. lw_r27_vm: R3_TO_LWREG_VM (27);
  1037. lw_r28_vm: R3_TO_LWREG_VM (28);
  1038. lw_r29_vm: R3_TO_LWREG_VM (29);
  1039. lw_r30_vm: R3_TO_LWREG_VM (30);
  1040. lw_r31_vm: R3_TO_LWREG_VM_V (31);
  1041. sw_table_vm:
  1042. sw_r0_vm: SWREG_TO_R3_VM (0);
  1043. sw_r1_vm: SWREG_TO_R3_VM_V (1);
  1044. sw_r2_vm: SWREG_TO_R3_VM_V (2);
  1045. sw_r3_vm: SWREG_TO_R3_VM_V (3);
  1046. sw_r4_vm: SWREG_TO_R3_VM_V (4);
  1047. sw_r5_vm: SWREG_TO_R3_VM_V (5);
  1048. sw_r6_vm: SWREG_TO_R3_VM_V (6);
  1049. sw_r7_vm: SWREG_TO_R3_VM_V (7);
  1050. sw_r8_vm: SWREG_TO_R3_VM_V (8);
  1051. sw_r9_vm: SWREG_TO_R3_VM_V (9);
  1052. sw_r10_vm: SWREG_TO_R3_VM_V (10);
  1053. sw_r11_vm: SWREG_TO_R3_VM_V (11);
  1054. sw_r12_vm: SWREG_TO_R3_VM_V (12);
  1055. sw_r13_vm: SWREG_TO_R3_VM_V (13);
  1056. sw_r14_vm: SWREG_TO_R3_VM (14);
  1057. sw_r15_vm: SWREG_TO_R3_VM_V (15);
  1058. sw_r16_vm: SWREG_TO_R3_VM (16);
  1059. sw_r17_vm: SWREG_TO_R3_VM_V (17);
  1060. sw_r18_vm: SWREG_TO_R3_VM_V (18);
  1061. sw_r19_vm: SWREG_TO_R3_VM (19);
  1062. sw_r20_vm: SWREG_TO_R3_VM (20);
  1063. sw_r21_vm: SWREG_TO_R3_VM (21);
  1064. sw_r22_vm: SWREG_TO_R3_VM (22);
  1065. sw_r23_vm: SWREG_TO_R3_VM (23);
  1066. sw_r24_vm: SWREG_TO_R3_VM (24);
  1067. sw_r25_vm: SWREG_TO_R3_VM (25);
  1068. sw_r26_vm: SWREG_TO_R3_VM (26);
  1069. sw_r27_vm: SWREG_TO_R3_VM (27);
  1070. sw_r28_vm: SWREG_TO_R3_VM (28);
  1071. sw_r29_vm: SWREG_TO_R3_VM (29);
  1072. sw_r30_vm: SWREG_TO_R3_VM (30);
  1073. sw_r31_vm: SWREG_TO_R3_VM_V (31);
  1074. #endif /* CONFIG_MMU */
  1075. /* Temporary data structures used in the handler */
  1076. .section .data
  1077. .align 4
  1078. ex_tmp_data_loc_0:
  1079. .byte 0
  1080. ex_tmp_data_loc_1:
  1081. .byte 0
  1082. ex_tmp_data_loc_2:
  1083. .byte 0
  1084. ex_tmp_data_loc_3:
  1085. .byte 0
  1086. ex_reg_op:
  1087. .byte 0