hw_exception_handler.S 31 KB

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