Fix vmstate_register_ram() for rom/device regions
[qemu/opensuse.git] / target-sparc / op_helper.c
blob02b660ddf9aa54b57a24c92adeed48e214b6324a
1 #include "cpu.h"
2 #include "dyngen-exec.h"
3 #include "helper.h"
5 #if !defined(CONFIG_USER_ONLY)
6 static void do_unaligned_access(target_ulong addr, int is_write, int is_user,
7 void *retaddr);
9 #define MMUSUFFIX _mmu
10 #define ALIGNED_ONLY
12 #define SHIFT 0
13 #include "softmmu_template.h"
15 #define SHIFT 1
16 #include "softmmu_template.h"
18 #define SHIFT 2
19 #include "softmmu_template.h"
21 #define SHIFT 3
22 #include "softmmu_template.h"
24 /* XXX: make it generic ? */
25 static void cpu_restore_state2(void *retaddr)
27 TranslationBlock *tb;
28 unsigned long pc;
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 */
37 cpu_restore_state(tb, env, pc);
42 static void do_unaligned_access(target_ulong addr, int is_write, int is_user,
43 void *retaddr)
45 #ifdef DEBUG_UNALIGNED
46 printf("Unaligned access to 0x" TARGET_FMT_lx " from 0x" TARGET_FMT_lx
47 "\n", addr, env->pc);
48 #endif
49 cpu_restore_state2(retaddr);
50 helper_raise_exception(env, TT_UNALIGNED);
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 */
57 void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx,
58 void *retaddr)
60 int ret;
61 CPUState *saved_env;
63 saved_env = env;
64 env = env1;
66 ret = cpu_sparc_handle_mmu_fault(env, addr, is_write, mmu_idx);
67 if (ret) {
68 cpu_restore_state2(retaddr);
69 cpu_loop_exit(env);
71 env = saved_env;
74 #endif /* !CONFIG_USER_ONLY */