]>
Commit | Line | Data |
---|---|---|
48e06fe0 BK |
1 | /* |
2 | * Copyright (c) 2012-2014 Bastian Koppelmann C-Lab/University Paderborn | |
3 | * | |
4 | * This library is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU Lesser General Public | |
6 | * License as published by the Free Software Foundation; either | |
7 | * version 2 of the License, or (at your option) any later version. | |
8 | * | |
9 | * This library is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * Lesser General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU Lesser General Public | |
15 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. | |
16 | */ | |
17 | #include <stdlib.h> | |
18 | #include "cpu.h" | |
19 | #include "qemu/host-utils.h" | |
20 | #include "exec/helper-proto.h" | |
21 | #include "exec/cpu_ldst.h" | |
22 | ||
2d30267e BK |
23 | static inline void QEMU_NORETURN do_raise_exception_err(CPUTriCoreState *env, |
24 | uint32_t exception, | |
25 | int error_code, | |
26 | uintptr_t pc) | |
27 | { | |
28 | CPUState *cs = CPU(tricore_env_get_cpu(env)); | |
29 | cs->exception_index = exception; | |
30 | env->error_code = error_code; | |
31 | ||
32 | if (pc) { | |
33 | /* now we have a real cpu fault */ | |
34 | cpu_restore_state(cs, pc); | |
35 | } | |
36 | ||
37 | cpu_loop_exit(cs); | |
38 | } | |
39 | ||
40 | static inline void QEMU_NORETURN do_raise_exception(CPUTriCoreState *env, | |
41 | uint32_t exception, | |
42 | uintptr_t pc) | |
43 | { | |
44 | do_raise_exception_err(env, exception, 0, pc); | |
45 | } | |
46 | ||
48e06fe0 BK |
47 | void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx, |
48 | uintptr_t retaddr) | |
49 | { | |
2d30267e BK |
50 | int ret; |
51 | ret = cpu_tricore_handle_mmu_fault(cs, addr, is_write, mmu_idx); | |
52 | if (ret) { | |
53 | TriCoreCPU *cpu = TRICORE_CPU(cs); | |
54 | CPUTriCoreState *env = &cpu->env; | |
55 | do_raise_exception_err(env, cs->exception_index, | |
56 | env->error_code, retaddr); | |
57 | } | |
48e06fe0 | 58 | } |