Revision e37e863f target-mips/helper.c
b/target-mips/helper.c | ||
---|---|---|
17 | 17 |
* License along with this library; if not, write to the Free Software |
18 | 18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | 19 |
*/ |
20 |
#include "exec.h" |
|
20 |
#include <stdarg.h> |
|
21 |
#include <stdlib.h> |
|
22 |
#include <stdio.h> |
|
23 |
#include <string.h> |
|
24 |
#include <inttypes.h> |
|
25 |
#include <signal.h> |
|
26 |
#include <assert.h> |
|
27 |
|
|
28 |
#include "cpu.h" |
|
29 |
#include "exec-all.h" |
|
21 | 30 |
|
22 | 31 |
/* MIPS32 4K MMU emulation */ |
23 | 32 |
#ifdef MIPS_USES_R4K_TLB |
... | ... | |
142 | 151 |
return -1; |
143 | 152 |
return phys_addr; |
144 | 153 |
} |
145 |
#endif |
|
146 |
|
|
147 |
#if !defined(CONFIG_USER_ONLY) |
|
148 |
|
|
149 |
#define MMUSUFFIX _mmu |
|
150 |
#define GETPC() (__builtin_return_address(0)) |
|
151 |
|
|
152 |
#define SHIFT 0 |
|
153 |
#include "softmmu_template.h" |
|
154 |
|
|
155 |
#define SHIFT 1 |
|
156 |
#include "softmmu_template.h" |
|
157 |
|
|
158 |
#define SHIFT 2 |
|
159 |
#include "softmmu_template.h" |
|
160 |
|
|
161 |
#define SHIFT 3 |
|
162 |
#include "softmmu_template.h" |
|
163 |
|
|
164 |
void tlb_fill (target_ulong addr, int is_write, int is_user, void *retaddr) |
|
165 |
{ |
|
166 |
TranslationBlock *tb; |
|
167 |
CPUState *saved_env; |
|
168 |
unsigned long pc; |
|
169 |
int ret; |
|
170 |
|
|
171 |
/* XXX: hack to restore env in all cases, even if not called from |
|
172 |
generated code */ |
|
173 |
saved_env = env; |
|
174 |
env = cpu_single_env; |
|
175 |
ret = cpu_mips_handle_mmu_fault(env, addr, is_write, is_user, 1); |
|
176 |
if (ret) { |
|
177 |
if (retaddr) { |
|
178 |
/* now we have a real cpu fault */ |
|
179 |
pc = (unsigned long)retaddr; |
|
180 |
tb = tb_find_pc(pc); |
|
181 |
if (tb) { |
|
182 |
/* the PC is inside the translated code. It means that we have |
|
183 |
a virtual CPU fault */ |
|
184 |
cpu_restore_state(tb, env, pc, NULL); |
|
185 |
} |
|
186 |
} |
|
187 |
do_raise_exception_err(env->exception_index, env->error_code); |
|
188 |
} |
|
189 |
env = saved_env; |
|
190 |
} |
|
191 | 154 |
|
192 | 155 |
void cpu_mips_init_mmu (CPUState *env) |
193 | 156 |
{ |
194 | 157 |
} |
195 |
|
|
196 | 158 |
#endif /* !defined(CONFIG_USER_ONLY) */ |
197 | 159 |
|
198 | 160 |
int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
Also available in: Unified diff