]>
Commit | Line | Data |
---|---|---|
3e457172 BS |
1 | #include "cpu.h" |
2 | #include "dyngen-exec.h" | |
1a2fb1c0 | 3 | #include "helper.h" |
e8af50a3 | 4 | |
3e457172 | 5 | #if !defined(CONFIG_USER_ONLY) |
d2889a3e BS |
6 | static void do_unaligned_access(target_ulong addr, int is_write, int is_user, |
7 | void *retaddr); | |
8 | ||
ee5bbe38 | 9 | #define MMUSUFFIX _mmu |
d2889a3e | 10 | #define ALIGNED_ONLY |
ee5bbe38 FB |
11 | |
12 | #define SHIFT 0 | |
13 | #include "softmmu_template.h" | |
14 | ||
15 | #define SHIFT 1 | |
16 | #include "softmmu_template.h" | |
17 | ||
18 | #define SHIFT 2 | |
19 | #include "softmmu_template.h" | |
20 | ||
21 | #define SHIFT 3 | |
22 | #include "softmmu_template.h" | |
23 | ||
c2bc0e38 BS |
24 | /* XXX: make it generic ? */ |
25 | static void cpu_restore_state2(void *retaddr) | |
26 | { | |
27 | TranslationBlock *tb; | |
28 | unsigned long pc; | |
29 | ||
30 | if (retaddr) { | |
31 | /* now we have a real cpu fault */ | |
32 | pc = (unsigned long)retaddr; | |
33 | tb = tb_find_pc(pc); | |
34 | if (tb) { | |
35 | /* the PC is inside the translated code. It means that we have | |
36 | a virtual CPU fault */ | |
618ba8e6 | 37 | cpu_restore_state(tb, env, pc); |
c2bc0e38 BS |
38 | } |
39 | } | |
40 | } | |
41 | ||
d2889a3e BS |
42 | static void do_unaligned_access(target_ulong addr, int is_write, int is_user, |
43 | void *retaddr) | |
44 | { | |
94554550 | 45 | #ifdef DEBUG_UNALIGNED |
c2bc0e38 BS |
46 | printf("Unaligned access to 0x" TARGET_FMT_lx " from 0x" TARGET_FMT_lx |
47 | "\n", addr, env->pc); | |
94554550 | 48 | #endif |
c2bc0e38 | 49 | cpu_restore_state2(retaddr); |
bc265319 | 50 | helper_raise_exception(env, TT_UNALIGNED); |
d2889a3e | 51 | } |
ee5bbe38 FB |
52 | |
53 | /* try to fill the TLB and return an exception if error. If retaddr is | |
54 | NULL, it means that the function was called in C code (i.e. not | |
55 | from generated code or from helper.c) */ | |
56 | /* XXX: fix it to restore all registers */ | |
bccd9ec5 BS |
57 | void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx, |
58 | void *retaddr) | |
ee5bbe38 | 59 | { |
ee5bbe38 | 60 | int ret; |
ee5bbe38 FB |
61 | CPUState *saved_env; |
62 | ||
ee5bbe38 | 63 | saved_env = env; |
bccd9ec5 | 64 | env = env1; |
ee5bbe38 | 65 | |
97b348e7 | 66 | ret = cpu_sparc_handle_mmu_fault(env, addr, is_write, mmu_idx); |
ee5bbe38 | 67 | if (ret) { |
c2bc0e38 | 68 | cpu_restore_state2(retaddr); |
1162c041 | 69 | cpu_loop_exit(env); |
ee5bbe38 FB |
70 | } |
71 | env = saved_env; | |
72 | } | |
73 | ||
3c7b48b7 | 74 | #endif /* !CONFIG_USER_ONLY */ |