Rework ASI instructions (Aurelien Jarno)
[qemu] / target-sparc / exec.h
1 #ifndef EXEC_SPARC_H
2 #define EXEC_SPARC_H 1
3 #include "config.h"
4 #include "dyngen-exec.h"
5
6 register struct CPUSPARCState *env asm(AREG0);
7
8 #ifdef TARGET_SPARC64
9 #define T0 (env->t0)
10 #define T1 (env->t1)
11 #define T2 (env->t2)
12 #define REGWPTR env->regwptr
13 #else
14 register uint32_t T0 asm(AREG1);
15 register uint32_t T1 asm(AREG2);
16
17 #undef REG_REGWPTR // Broken
18 #ifdef REG_REGWPTR
19 #if defined(__sparc__)
20 register uint32_t *REGWPTR asm(AREG4);
21 #else
22 register uint32_t *REGWPTR asm(AREG3);
23 #endif
24 #define reg_REGWPTR
25
26 #ifdef AREG4
27 register uint32_t T2 asm(AREG4);
28 #define reg_T2
29 #else
30 #define T2 (env->t2)
31 #endif
32
33 #else
34 #define REGWPTR env->regwptr
35 register uint32_t T2 asm(AREG3);
36 #endif
37 #define reg_T2
38 #endif
39
40 #define FT0 (env->ft0)
41 #define FT1 (env->ft1)
42 #define DT0 (env->dt0)
43 #define DT1 (env->dt1)
44
45 #include "cpu.h"
46 #include "exec-all.h"
47
48 void cpu_lock(void);
49 void cpu_unlock(void);
50 void cpu_loop_exit(void);
51 void helper_flush(target_ulong addr);
52 void helper_ld_asi(int asi, int size, int sign);
53 void helper_st_asi(int asi, int size);
54 void helper_rett(void);
55 void helper_ldfsr(void);
56 void set_cwp(int new_cwp);
57 void do_fitos(void);
58 void do_fitod(void);
59 void do_fabss(void);
60 void do_fsqrts(void);
61 void do_fsqrtd(void);
62 void do_fcmps(void);
63 void do_fcmpd(void);
64 void do_fcmpes(void);
65 void do_fcmped(void);
66 #ifdef TARGET_SPARC64
67 void do_fabsd(void);
68 void do_fcmps_fcc1(void);
69 void do_fcmpd_fcc1(void);
70 void do_fcmps_fcc2(void);
71 void do_fcmpd_fcc2(void);
72 void do_fcmps_fcc3(void);
73 void do_fcmpd_fcc3(void);
74 void do_fcmpes_fcc1(void);
75 void do_fcmped_fcc1(void);
76 void do_fcmpes_fcc2(void);
77 void do_fcmped_fcc2(void);
78 void do_fcmpes_fcc3(void);
79 void do_fcmped_fcc3(void);
80 void do_popc();
81 void do_wrpstate();
82 void do_done();
83 void do_retry();
84 #endif
85 void do_ldd_kernel(target_ulong addr);
86 void do_ldd_user(target_ulong addr);
87 void do_ldd_raw(target_ulong addr);
88 void do_interrupt(int intno);
89 void raise_exception(int tt);
90 void check_ieee_exceptions();
91 void memcpy32(target_ulong *dst, const target_ulong *src);
92 target_ulong mmu_probe(CPUState *env, target_ulong address, int mmulev);
93 void dump_mmu(CPUState *env);
94 void helper_debug();
95 void do_wrpsr();
96 void do_rdpsr();
97
98 /* XXX: move that to a generic header */
99 #if !defined(CONFIG_USER_ONLY)
100 #include "softmmu_exec.h"
101 #endif /* !defined(CONFIG_USER_ONLY) */
102
103 static inline void env_to_regs(void)
104 {
105 #if defined(reg_REGWPTR)
106     REGWPTR = env->regbase + (env->cwp * 16);
107     env->regwptr = REGWPTR;
108 #endif
109 }
110
111 static inline void regs_to_env(void)
112 {
113 }
114
115 int cpu_sparc_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
116                                int is_user, int is_softmmu);
117
118 static inline int cpu_halted(CPUState *env) {
119     if (!env->halted)
120         return 0;
121     if ((env->interrupt_request & CPU_INTERRUPT_HARD) && (env->psret != 0)) {
122         env->halted = 0;
123         return 0;
124     }
125     return EXCP_HALTED;
126 }
127
128 #endif