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