4 * Copyright (c) 2005 Samuel Tardieu
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
23 #include "exec/exec-all.h"
26 #if !defined(CONFIG_USER_ONLY)
27 #include "hw/sh4/sh_intc.h"
28 #include "sysemu/runstate.h"
32 #define MMU_ITLB_MISS (-1)
33 #define MMU_ITLB_MULTIPLE (-2)
34 #define MMU_ITLB_VIOLATION (-3)
35 #define MMU_DTLB_MISS_READ (-4)
36 #define MMU_DTLB_MISS_WRITE (-5)
37 #define MMU_DTLB_INITIAL_WRITE (-6)
38 #define MMU_DTLB_VIOLATION_READ (-7)
39 #define MMU_DTLB_VIOLATION_WRITE (-8)
40 #define MMU_DTLB_MULTIPLE (-9)
41 #define MMU_DTLB_MISS (-10)
42 #define MMU_IADDR_ERROR (-11)
43 #define MMU_DADDR_ERROR_READ (-12)
44 #define MMU_DADDR_ERROR_WRITE (-13)
46 #if defined(CONFIG_USER_ONLY)
48 int cpu_sh4_is_cached(CPUSH4State
*env
, target_ulong addr
)
50 /* For user mode, only U0 area is cacheable. */
51 return !(addr
& 0x80000000);
54 #else /* !CONFIG_USER_ONLY */
56 void superh_cpu_do_interrupt(CPUState
*cs
)
58 CPUSH4State
*env
= cpu_env(cs
);
59 int do_irq
= cs
->interrupt_request
& CPU_INTERRUPT_HARD
;
60 int do_exp
, irq_vector
= cs
->exception_index
;
62 /* prioritize exceptions over interrupts */
64 do_exp
= cs
->exception_index
!= -1;
65 do_irq
= do_irq
&& (cs
->exception_index
== -1);
67 if (env
->sr
& (1u << SR_BL
)) {
68 if (do_exp
&& cs
->exception_index
!= 0x1e0) {
69 /* In theory a masked exception generates a reset exception,
70 which in turn jumps to the reset vector. However this only
71 works when using a bootloader. When using a kernel and an
72 initrd, they need to be reloaded and the program counter
73 should be loaded with the kernel entry point.
74 qemu_system_reset_request takes care of that. */
75 qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET
);
78 if (do_irq
&& !env
->in_sleep
) {
85 irq_vector
= sh_intc_get_pending_vector(env
->intc_handle
,
86 (env
->sr
>> 4) & 0xf);
87 if (irq_vector
== -1) {
92 if (qemu_loglevel_mask(CPU_LOG_INT
)) {
94 switch (cs
->exception_index
) {
96 expname
= "addr_error";
102 expname
= "tlb_violation";
105 expname
= "illegal_instruction";
108 expname
= "slot_illegal_instruction";
111 expname
= "fpu_disable";
114 expname
= "slot_fpu";
117 expname
= "data_write";
120 expname
= "dtlb_miss_write";
123 expname
= "dtlb_violation_write";
126 expname
= "fpu_exception";
129 expname
= "initial_page_write";
135 expname
= do_irq
? "interrupt" : "???";
138 qemu_log("exception 0x%03x [%s] raised\n",
139 irq_vector
, expname
);
140 log_cpu_state(cs
, 0);
143 env
->ssr
= cpu_read_sr(env
);
145 env
->sgr
= env
->gregs
[15];
146 env
->sr
|= (1u << SR_BL
) | (1u << SR_MD
) | (1u << SR_RB
);
149 if (env
->flags
& TB_FLAG_DELAY_SLOT_MASK
) {
150 /* Branch instruction should be executed again before delay slot. */
152 /* Clear flags for exception/interrupt routine. */
153 env
->flags
&= ~TB_FLAG_DELAY_SLOT_MASK
;
157 env
->expevt
= cs
->exception_index
;
158 switch (cs
->exception_index
) {
162 env
->sr
&= ~(1u << SR_FD
);
163 env
->sr
|= 0xf << 4; /* IMASK */
164 env
->pc
= 0xa0000000;
168 env
->pc
= env
->vbr
+ 0x400;
171 env
->spc
+= 2; /* special case for TRAPA */
174 env
->pc
= env
->vbr
+ 0x100;
181 env
->intevt
= irq_vector
;
182 env
->pc
= env
->vbr
+ 0x600;
187 static void update_itlb_use(CPUSH4State
* env
, int itlbnb
)
189 uint8_t or_mask
= 0, and_mask
= (uint8_t) - 1;
208 env
->mmucr
&= (and_mask
<< 24) | 0x00ffffff;
209 env
->mmucr
|= (or_mask
<< 24);
212 static int itlb_replacement(CPUSH4State
* env
)
214 if ((env
->mmucr
& 0xe0000000) == 0xe0000000) {
217 if ((env
->mmucr
& 0x98000000) == 0x18000000) {
220 if ((env
->mmucr
& 0x54000000) == 0x04000000) {
223 if ((env
->mmucr
& 0x2c000000) == 0x00000000) {
226 cpu_abort(env_cpu(env
), "Unhandled itlb_replacement");
229 /* Find the corresponding entry in the right TLB
230 Return entry, MMU_DTLB_MISS or MMU_DTLB_MULTIPLE
232 static int find_tlb_entry(CPUSH4State
* env
, target_ulong address
,
233 tlb_t
* entries
, uint8_t nbtlb
, int use_asid
)
235 int match
= MMU_DTLB_MISS
;
240 asid
= env
->pteh
& 0xff;
242 for (i
= 0; i
< nbtlb
; i
++) {
244 continue; /* Invalid entry */
245 if (!entries
[i
].sh
&& use_asid
&& entries
[i
].asid
!= asid
)
246 continue; /* Bad ASID */
247 start
= (entries
[i
].vpn
<< 10) & ~(entries
[i
].size
- 1);
248 end
= start
+ entries
[i
].size
- 1;
249 if (address
>= start
&& address
<= end
) { /* Match */
250 if (match
!= MMU_DTLB_MISS
)
251 return MMU_DTLB_MULTIPLE
; /* Multiple match */
258 static void increment_urc(CPUSH4State
* env
)
263 urb
= ((env
->mmucr
) >> 18) & 0x3f;
264 urc
= ((env
->mmucr
) >> 10) & 0x3f;
266 if ((urb
> 0 && urc
> urb
) || urc
> (UTLB_SIZE
- 1))
268 env
->mmucr
= (env
->mmucr
& 0xffff03ff) | (urc
<< 10);
271 /* Copy and utlb entry into itlb
274 static int copy_utlb_entry_itlb(CPUSH4State
*env
, int utlb
)
279 itlb
= itlb_replacement(env
);
280 ientry
= &env
->itlb
[itlb
];
282 tlb_flush_page(env_cpu(env
), ientry
->vpn
<< 10);
284 *ientry
= env
->utlb
[utlb
];
285 update_itlb_use(env
, itlb
);
290 Return entry, MMU_ITLB_MISS, MMU_ITLB_MULTIPLE or MMU_DTLB_MULTIPLE
292 static int find_itlb_entry(CPUSH4State
* env
, target_ulong address
,
297 e
= find_tlb_entry(env
, address
, env
->itlb
, ITLB_SIZE
, use_asid
);
298 if (e
== MMU_DTLB_MULTIPLE
) {
299 e
= MMU_ITLB_MULTIPLE
;
300 } else if (e
== MMU_DTLB_MISS
) {
303 update_itlb_use(env
, e
);
309 Return entry, MMU_DTLB_MISS, MMU_DTLB_MULTIPLE */
310 static int find_utlb_entry(CPUSH4State
* env
, target_ulong address
, int use_asid
)
312 /* per utlb access */
316 return find_tlb_entry(env
, address
, env
->utlb
, UTLB_SIZE
, use_asid
);
319 /* Match address against MMU
320 Return MMU_OK, MMU_DTLB_MISS_READ, MMU_DTLB_MISS_WRITE,
321 MMU_DTLB_INITIAL_WRITE, MMU_DTLB_VIOLATION_READ,
322 MMU_DTLB_VIOLATION_WRITE, MMU_ITLB_MISS,
323 MMU_ITLB_MULTIPLE, MMU_ITLB_VIOLATION,
324 MMU_IADDR_ERROR, MMU_DADDR_ERROR_READ, MMU_DADDR_ERROR_WRITE.
326 static int get_mmu_address(CPUSH4State
* env
, target_ulong
* physical
,
327 int *prot
, target_ulong address
,
328 MMUAccessType access_type
)
331 tlb_t
*matching
= NULL
;
333 use_asid
= !(env
->mmucr
& MMUCR_SV
) || !(env
->sr
& (1u << SR_MD
));
335 if (access_type
== MMU_INST_FETCH
) {
336 n
= find_itlb_entry(env
, address
, use_asid
);
338 matching
= &env
->itlb
[n
];
339 if (!(env
->sr
& (1u << SR_MD
)) && !(matching
->pr
& 2)) {
340 n
= MMU_ITLB_VIOLATION
;
345 n
= find_utlb_entry(env
, address
, use_asid
);
347 n
= copy_utlb_entry_itlb(env
, n
);
348 matching
= &env
->itlb
[n
];
349 if (!(env
->sr
& (1u << SR_MD
)) && !(matching
->pr
& 2)) {
350 n
= MMU_ITLB_VIOLATION
;
352 *prot
= PAGE_READ
| PAGE_EXEC
;
353 if ((matching
->pr
& 1) && matching
->d
) {
357 } else if (n
== MMU_DTLB_MULTIPLE
) {
358 n
= MMU_ITLB_MULTIPLE
;
359 } else if (n
== MMU_DTLB_MISS
) {
364 n
= find_utlb_entry(env
, address
, use_asid
);
366 matching
= &env
->utlb
[n
];
367 if (!(env
->sr
& (1u << SR_MD
)) && !(matching
->pr
& 2)) {
368 n
= (access_type
== MMU_DATA_STORE
)
369 ? MMU_DTLB_VIOLATION_WRITE
: MMU_DTLB_VIOLATION_READ
;
370 } else if ((access_type
== MMU_DATA_STORE
) && !(matching
->pr
& 1)) {
371 n
= MMU_DTLB_VIOLATION_WRITE
;
372 } else if ((access_type
== MMU_DATA_STORE
) && !matching
->d
) {
373 n
= MMU_DTLB_INITIAL_WRITE
;
376 if ((matching
->pr
& 1) && matching
->d
) {
380 } else if (n
== MMU_DTLB_MISS
) {
381 n
= (access_type
== MMU_DATA_STORE
)
382 ? MMU_DTLB_MISS_WRITE
: MMU_DTLB_MISS_READ
;
387 *physical
= ((matching
->ppn
<< 10) & ~(matching
->size
- 1))
388 | (address
& (matching
->size
- 1));
393 static int get_physical_address(CPUSH4State
* env
, target_ulong
* physical
,
394 int *prot
, target_ulong address
,
395 MMUAccessType access_type
)
397 /* P1, P2 and P4 areas do not use translation */
398 if ((address
>= 0x80000000 && address
< 0xc0000000) || address
>= 0xe0000000) {
399 if (!(env
->sr
& (1u << SR_MD
))
400 && (address
< 0xe0000000 || address
>= 0xe4000000)) {
401 /* Unauthorized access in user mode (only store queues are available) */
402 qemu_log_mask(LOG_GUEST_ERROR
, "Unauthorized access\n");
403 if (access_type
== MMU_DATA_LOAD
) {
404 return MMU_DADDR_ERROR_READ
;
405 } else if (access_type
== MMU_DATA_STORE
) {
406 return MMU_DADDR_ERROR_WRITE
;
408 return MMU_IADDR_ERROR
;
411 if (address
>= 0x80000000 && address
< 0xc0000000) {
412 /* Mask upper 3 bits for P1 and P2 areas */
413 *physical
= address
& 0x1fffffff;
417 *prot
= PAGE_READ
| PAGE_WRITE
| PAGE_EXEC
;
421 /* If MMU is disabled, return the corresponding physical page */
422 if (!(env
->mmucr
& MMUCR_AT
)) {
423 *physical
= address
& 0x1FFFFFFF;
424 *prot
= PAGE_READ
| PAGE_WRITE
| PAGE_EXEC
;
428 /* We need to resort to the MMU */
429 return get_mmu_address(env
, physical
, prot
, address
, access_type
);
432 hwaddr
superh_cpu_get_phys_page_debug(CPUState
*cs
, vaddr addr
)
434 target_ulong physical
;
437 if (get_physical_address(cpu_env(cs
), &physical
, &prot
, addr
, MMU_DATA_LOAD
)
445 void cpu_load_tlb(CPUSH4State
* env
)
447 CPUState
*cs
= env_cpu(env
);
448 int n
= cpu_mmucr_urc(env
->mmucr
);
449 tlb_t
* entry
= &env
->utlb
[n
];
452 /* Overwriting valid entry in utlb. */
453 target_ulong address
= entry
->vpn
<< 10;
454 tlb_flush_page(cs
, address
);
457 /* Take values into cpu status from registers. */
458 entry
->asid
= (uint8_t)cpu_pteh_asid(env
->pteh
);
459 entry
->vpn
= cpu_pteh_vpn(env
->pteh
);
460 entry
->v
= (uint8_t)cpu_ptel_v(env
->ptel
);
461 entry
->ppn
= cpu_ptel_ppn(env
->ptel
);
462 entry
->sz
= (uint8_t)cpu_ptel_sz(env
->ptel
);
465 entry
->size
= 1024; /* 1K */
468 entry
->size
= 1024 * 4; /* 4K */
471 entry
->size
= 1024 * 64; /* 64K */
474 entry
->size
= 1024 * 1024; /* 1M */
477 cpu_abort(cs
, "Unhandled load_tlb");
480 entry
->sh
= (uint8_t)cpu_ptel_sh(env
->ptel
);
481 entry
->c
= (uint8_t)cpu_ptel_c(env
->ptel
);
482 entry
->pr
= (uint8_t)cpu_ptel_pr(env
->ptel
);
483 entry
->d
= (uint8_t)cpu_ptel_d(env
->ptel
);
484 entry
->wt
= (uint8_t)cpu_ptel_wt(env
->ptel
);
485 entry
->sa
= (uint8_t)cpu_ptea_sa(env
->ptea
);
486 entry
->tc
= (uint8_t)cpu_ptea_tc(env
->ptea
);
489 void cpu_sh4_invalidate_tlb(CPUSH4State
*s
)
494 for (i
= 0; i
< UTLB_SIZE
; i
++) {
495 tlb_t
* entry
= &s
->utlb
[i
];
499 for (i
= 0; i
< ITLB_SIZE
; i
++) {
500 tlb_t
* entry
= &s
->itlb
[i
];
504 tlb_flush(env_cpu(s
));
507 uint32_t cpu_sh4_read_mmaped_itlb_addr(CPUSH4State
*s
,
510 int index
= (addr
& 0x00000300) >> 8;
511 tlb_t
* entry
= &s
->itlb
[index
];
513 return (entry
->vpn
<< 10) |
518 void cpu_sh4_write_mmaped_itlb_addr(CPUSH4State
*s
, hwaddr addr
,
521 uint32_t vpn
= (mem_value
& 0xfffffc00) >> 10;
522 uint8_t v
= (uint8_t)((mem_value
& 0x00000100) >> 8);
523 uint8_t asid
= (uint8_t)(mem_value
& 0x000000ff);
525 int index
= (addr
& 0x00000300) >> 8;
526 tlb_t
* entry
= &s
->itlb
[index
];
528 /* Overwriting valid entry in itlb. */
529 target_ulong address
= entry
->vpn
<< 10;
530 tlb_flush_page(env_cpu(s
), address
);
537 uint32_t cpu_sh4_read_mmaped_itlb_data(CPUSH4State
*s
,
540 int array
= (addr
& 0x00800000) >> 23;
541 int index
= (addr
& 0x00000300) >> 8;
542 tlb_t
* entry
= &s
->itlb
[index
];
545 /* ITLB Data Array 1 */
546 return (entry
->ppn
<< 10) |
549 ((entry
->sz
& 1) << 6) |
550 ((entry
->sz
& 2) << 4) |
554 /* ITLB Data Array 2 */
555 return (entry
->tc
<< 1) |
560 void cpu_sh4_write_mmaped_itlb_data(CPUSH4State
*s
, hwaddr addr
,
563 int array
= (addr
& 0x00800000) >> 23;
564 int index
= (addr
& 0x00000300) >> 8;
565 tlb_t
* entry
= &s
->itlb
[index
];
568 /* ITLB Data Array 1 */
570 /* Overwriting valid entry in utlb. */
571 target_ulong address
= entry
->vpn
<< 10;
572 tlb_flush_page(env_cpu(s
), address
);
574 entry
->ppn
= (mem_value
& 0x1ffffc00) >> 10;
575 entry
->v
= (mem_value
& 0x00000100) >> 8;
576 entry
->sz
= (mem_value
& 0x00000080) >> 6 |
577 (mem_value
& 0x00000010) >> 4;
578 entry
->pr
= (mem_value
& 0x00000040) >> 5;
579 entry
->c
= (mem_value
& 0x00000008) >> 3;
580 entry
->sh
= (mem_value
& 0x00000002) >> 1;
582 /* ITLB Data Array 2 */
583 entry
->tc
= (mem_value
& 0x00000008) >> 3;
584 entry
->sa
= (mem_value
& 0x00000007);
588 uint32_t cpu_sh4_read_mmaped_utlb_addr(CPUSH4State
*s
,
591 int index
= (addr
& 0x00003f00) >> 8;
592 tlb_t
* entry
= &s
->utlb
[index
];
594 increment_urc(s
); /* per utlb access */
596 return (entry
->vpn
<< 10) |
601 void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State
*s
, hwaddr addr
,
604 int associate
= addr
& 0x0000080;
605 uint32_t vpn
= (mem_value
& 0xfffffc00) >> 10;
606 uint8_t d
= (uint8_t)((mem_value
& 0x00000200) >> 9);
607 uint8_t v
= (uint8_t)((mem_value
& 0x00000100) >> 8);
608 uint8_t asid
= (uint8_t)(mem_value
& 0x000000ff);
609 int use_asid
= !(s
->mmucr
& MMUCR_SV
) || !(s
->sr
& (1u << SR_MD
));
613 tlb_t
* utlb_match_entry
= NULL
;
614 int needs_tlb_flush
= 0;
617 for (i
= 0; i
< UTLB_SIZE
; i
++) {
618 tlb_t
* entry
= &s
->utlb
[i
];
622 if (entry
->vpn
== vpn
623 && (!use_asid
|| entry
->asid
== asid
|| entry
->sh
)) {
624 if (utlb_match_entry
) {
625 CPUState
*cs
= env_cpu(s
);
627 /* Multiple TLB Exception */
628 cs
->exception_index
= 0x140;
636 utlb_match_entry
= entry
;
638 increment_urc(s
); /* per utlb access */
642 for (i
= 0; i
< ITLB_SIZE
; i
++) {
643 tlb_t
* entry
= &s
->itlb
[i
];
644 if (entry
->vpn
== vpn
645 && (!use_asid
|| entry
->asid
== asid
|| entry
->sh
)) {
648 if (utlb_match_entry
)
649 *entry
= *utlb_match_entry
;
656 if (needs_tlb_flush
) {
657 tlb_flush_page(env_cpu(s
), vpn
<< 10);
660 int index
= (addr
& 0x00003f00) >> 8;
661 tlb_t
* entry
= &s
->utlb
[index
];
663 CPUState
*cs
= env_cpu(s
);
665 /* Overwriting valid entry in utlb. */
666 target_ulong address
= entry
->vpn
<< 10;
667 tlb_flush_page(cs
, address
);
677 uint32_t cpu_sh4_read_mmaped_utlb_data(CPUSH4State
*s
,
680 int array
= (addr
& 0x00800000) >> 23;
681 int index
= (addr
& 0x00003f00) >> 8;
682 tlb_t
* entry
= &s
->utlb
[index
];
684 increment_urc(s
); /* per utlb access */
687 /* ITLB Data Array 1 */
688 return (entry
->ppn
<< 10) |
691 ((entry
->sz
& 1) << 6) |
692 ((entry
->sz
& 2) << 4) |
698 /* ITLB Data Array 2 */
699 return (entry
->tc
<< 1) |
704 void cpu_sh4_write_mmaped_utlb_data(CPUSH4State
*s
, hwaddr addr
,
707 int array
= (addr
& 0x00800000) >> 23;
708 int index
= (addr
& 0x00003f00) >> 8;
709 tlb_t
* entry
= &s
->utlb
[index
];
711 increment_urc(s
); /* per utlb access */
714 /* UTLB Data Array 1 */
716 /* Overwriting valid entry in utlb. */
717 target_ulong address
= entry
->vpn
<< 10;
718 tlb_flush_page(env_cpu(s
), address
);
720 entry
->ppn
= (mem_value
& 0x1ffffc00) >> 10;
721 entry
->v
= (mem_value
& 0x00000100) >> 8;
722 entry
->sz
= (mem_value
& 0x00000080) >> 6 |
723 (mem_value
& 0x00000010) >> 4;
724 entry
->pr
= (mem_value
& 0x00000060) >> 5;
725 entry
->c
= (mem_value
& 0x00000008) >> 3;
726 entry
->d
= (mem_value
& 0x00000004) >> 2;
727 entry
->sh
= (mem_value
& 0x00000002) >> 1;
728 entry
->wt
= (mem_value
& 0x00000001);
730 /* UTLB Data Array 2 */
731 entry
->tc
= (mem_value
& 0x00000008) >> 3;
732 entry
->sa
= (mem_value
& 0x00000007);
736 int cpu_sh4_is_cached(CPUSH4State
* env
, target_ulong addr
)
739 int use_asid
= !(env
->mmucr
& MMUCR_SV
) || !(env
->sr
& (1u << SR_MD
));
742 if (env
->sr
& (1u << SR_MD
)) {
743 /* For privileged mode, P2 and P4 area is not cacheable. */
744 if ((0xA0000000 <= addr
&& addr
< 0xC0000000) || 0xE0000000 <= addr
)
747 /* For user mode, only U0 area is cacheable. */
748 if (0x80000000 <= addr
)
753 * TODO : Evaluate CCR and check if the cache is on or off.
754 * Now CCR is not in CPUSH4State, but in SH7750State.
755 * When you move the ccr into CPUSH4State, the code will be
759 /* check if operand cache is enabled or not. */
764 /* if MMU is off, no check for TLB. */
765 if (env
->mmucr
& MMUCR_AT
)
769 n
= find_tlb_entry(env
, addr
, env
->itlb
, ITLB_SIZE
, use_asid
);
771 return env
->itlb
[n
].c
;
773 n
= find_tlb_entry(env
, addr
, env
->utlb
, UTLB_SIZE
, use_asid
);
775 return env
->utlb
[n
].c
;
780 bool superh_cpu_exec_interrupt(CPUState
*cs
, int interrupt_request
)
782 if (interrupt_request
& CPU_INTERRUPT_HARD
) {
783 /* Delay slots are indivisible, ignore interrupts */
784 if (cpu_env(cs
)->flags
& TB_FLAG_DELAY_SLOT_MASK
) {
787 superh_cpu_do_interrupt(cs
);
794 bool superh_cpu_tlb_fill(CPUState
*cs
, vaddr address
, int size
,
795 MMUAccessType access_type
, int mmu_idx
,
796 bool probe
, uintptr_t retaddr
)
798 CPUSH4State
*env
= cpu_env(cs
);
801 target_ulong physical
;
804 ret
= get_physical_address(env
, &physical
, &prot
, address
, access_type
);
807 address
&= TARGET_PAGE_MASK
;
808 physical
&= TARGET_PAGE_MASK
;
809 tlb_set_page(cs
, address
, physical
, prot
, mmu_idx
, TARGET_PAGE_SIZE
);
816 if (ret
!= MMU_DTLB_MULTIPLE
&& ret
!= MMU_ITLB_MULTIPLE
) {
817 env
->pteh
= (env
->pteh
& PTEH_ASID_MASK
) | (address
& PTEH_VPN_MASK
);
823 case MMU_DTLB_MISS_READ
:
824 cs
->exception_index
= 0x040;
826 case MMU_DTLB_MULTIPLE
:
827 case MMU_ITLB_MULTIPLE
:
828 cs
->exception_index
= 0x140;
830 case MMU_ITLB_VIOLATION
:
831 cs
->exception_index
= 0x0a0;
833 case MMU_DTLB_MISS_WRITE
:
834 cs
->exception_index
= 0x060;
836 case MMU_DTLB_INITIAL_WRITE
:
837 cs
->exception_index
= 0x080;
839 case MMU_DTLB_VIOLATION_READ
:
840 cs
->exception_index
= 0x0a0;
842 case MMU_DTLB_VIOLATION_WRITE
:
843 cs
->exception_index
= 0x0c0;
845 case MMU_IADDR_ERROR
:
846 case MMU_DADDR_ERROR_READ
:
847 cs
->exception_index
= 0x0e0;
849 case MMU_DADDR_ERROR_WRITE
:
850 cs
->exception_index
= 0x100;
853 cpu_abort(cs
, "Unhandled MMU fault");
855 cpu_loop_exit_restore(cs
, retaddr
);
857 #endif /* !CONFIG_USER_ONLY */