hw_exception_handler.S 33 KB

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