Statistics
| Branch: | Revision:

root / target-mips / exec.h @ aa343735

History | View | Annotate | Download (6.8 kB)

1
#if !defined(__QEMU_MIPS_EXEC_H__)
2
#define __QEMU_MIPS_EXEC_H__
3

    
4
//#define DEBUG_OP
5

    
6
#include "config.h"
7
#include "mips-defs.h"
8
#include "dyngen-exec.h"
9
#include "cpu-defs.h"
10

    
11
register struct CPUMIPSState *env asm(AREG0);
12

    
13
#if TARGET_LONG_BITS > HOST_LONG_BITS
14
#define T0 (env->t0)
15
#define T1 (env->t1)
16
#define T2 (env->t2)
17
#else
18
register target_ulong T0 asm(AREG1);
19
register target_ulong T1 asm(AREG2);
20
register target_ulong T2 asm(AREG3);
21
#endif
22

    
23
#if defined (USE_HOST_FLOAT_REGS)
24
#error "implement me."
25
#else
26
#define FDT0 (env->fpu->ft0.fd)
27
#define FDT1 (env->fpu->ft1.fd)
28
#define FDT2 (env->fpu->ft2.fd)
29
#define FST0 (env->fpu->ft0.fs[FP_ENDIAN_IDX])
30
#define FST1 (env->fpu->ft1.fs[FP_ENDIAN_IDX])
31
#define FST2 (env->fpu->ft2.fs[FP_ENDIAN_IDX])
32
#define FSTH0 (env->fpu->ft0.fs[!FP_ENDIAN_IDX])
33
#define FSTH1 (env->fpu->ft1.fs[!FP_ENDIAN_IDX])
34
#define FSTH2 (env->fpu->ft2.fs[!FP_ENDIAN_IDX])
35
#define DT0 (env->fpu->ft0.d)
36
#define DT1 (env->fpu->ft1.d)
37
#define DT2 (env->fpu->ft2.d)
38
#define WT0 (env->fpu->ft0.w[FP_ENDIAN_IDX])
39
#define WT1 (env->fpu->ft1.w[FP_ENDIAN_IDX])
40
#define WT2 (env->fpu->ft2.w[FP_ENDIAN_IDX])
41
#define WTH0 (env->fpu->ft0.w[!FP_ENDIAN_IDX])
42
#define WTH1 (env->fpu->ft1.w[!FP_ENDIAN_IDX])
43
#define WTH2 (env->fpu->ft2.w[!FP_ENDIAN_IDX])
44
#endif
45

    
46
#if defined (DEBUG_OP)
47
# define RETURN() __asm__ __volatile__("nop" : : : "memory");
48
#else
49
# define RETURN() __asm__ __volatile__("" : : : "memory");
50
#endif
51

    
52
#include "cpu.h"
53
#include "exec-all.h"
54

    
55
#if !defined(CONFIG_USER_ONLY)
56
#include "softmmu_exec.h"
57
#endif /* !defined(CONFIG_USER_ONLY) */
58

    
59
#if defined(TARGET_MIPSN32) || defined(TARGET_MIPS64)
60
#if TARGET_LONG_BITS > HOST_LONG_BITS
61
void do_dsll (void);
62
void do_dsll32 (void);
63
void do_dsra (void);
64
void do_dsra32 (void);
65
void do_dsrl (void);
66
void do_dsrl32 (void);
67
void do_drotr (void);
68
void do_drotr32 (void);
69
void do_dsllv (void);
70
void do_dsrav (void);
71
void do_dsrlv (void);
72
void do_drotrv (void);
73
#endif
74
#endif
75

    
76
#if HOST_LONG_BITS < 64
77
void do_div (void);
78
#endif
79
#if TARGET_LONG_BITS > HOST_LONG_BITS
80
void do_mult (void);
81
void do_multu (void);
82
void do_madd (void);
83
void do_maddu (void);
84
void do_msub (void);
85
void do_msubu (void);
86
#endif
87
#if defined(TARGET_MIPSN32) || defined(TARGET_MIPS64)
88
void do_ddiv (void);
89
#if TARGET_LONG_BITS > HOST_LONG_BITS
90
void do_ddivu (void);
91
#endif
92
#endif
93
void do_mfc0_random(void);
94
void do_mfc0_count(void);
95
void do_mtc0_entryhi(uint32_t in);
96
void do_mtc0_status_debug(uint32_t old, uint32_t val);
97
void do_mtc0_status_irqraise_debug(void);
98
void dump_fpu(CPUState *env);
99
void fpu_dump_state(CPUState *env, FILE *f,
100
                    int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
101
                    int flags);
102
void dump_sc (void);
103
void do_pmon (int function);
104

    
105
void dump_sc (void);
106

    
107
int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
108
                               int is_user, int is_softmmu);
109
void do_interrupt (CPUState *env);
110
void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra);
111

    
112
void cpu_loop_exit(void);
113
void do_raise_exception_err (uint32_t exception, int error_code);
114
void do_raise_exception (uint32_t exception);
115
void do_raise_exception_direct_err (uint32_t exception, int error_code);
116
void do_raise_exception_direct (uint32_t exception);
117

    
118
void cpu_dump_state(CPUState *env, FILE *f,
119
                    int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
120
                    int flags);
121
void cpu_mips_irqctrl_init (void);
122
uint32_t cpu_mips_get_random (CPUState *env);
123
uint32_t cpu_mips_get_count (CPUState *env);
124
void cpu_mips_store_count (CPUState *env, uint32_t value);
125
void cpu_mips_store_compare (CPUState *env, uint32_t value);
126
void cpu_mips_start_count(CPUState *env);
127
void cpu_mips_stop_count(CPUState *env);
128
void cpu_mips_update_irq (CPUState *env);
129
void cpu_mips_clock_init (CPUState *env);
130
void cpu_mips_tlb_flush (CPUState *env, int flush_global);
131

    
132
void do_cfc1 (int reg);
133
void do_ctc1 (int reg);
134

    
135
#define FOP_PROTO(op)              \
136
void do_float_ ## op ## _s(void);  \
137
void do_float_ ## op ## _d(void);
138
FOP_PROTO(roundl)
139
FOP_PROTO(roundw)
140
FOP_PROTO(truncl)
141
FOP_PROTO(truncw)
142
FOP_PROTO(ceill)
143
FOP_PROTO(ceilw)
144
FOP_PROTO(floorl)
145
FOP_PROTO(floorw)
146
FOP_PROTO(rsqrt)
147
FOP_PROTO(recip)
148
#undef FOP_PROTO
149

    
150
#define FOP_PROTO(op)              \
151
void do_float_ ## op ## _s(void);  \
152
void do_float_ ## op ## _d(void);  \
153
void do_float_ ## op ## _ps(void);
154
FOP_PROTO(add)
155
FOP_PROTO(sub)
156
FOP_PROTO(mul)
157
FOP_PROTO(div)
158
FOP_PROTO(recip1)
159
FOP_PROTO(recip2)
160
FOP_PROTO(rsqrt1)
161
FOP_PROTO(rsqrt2)
162
#undef FOP_PROTO
163

    
164
void do_float_cvtd_s(void);
165
void do_float_cvtd_w(void);
166
void do_float_cvtd_l(void);
167
void do_float_cvtl_d(void);
168
void do_float_cvtl_s(void);
169
void do_float_cvtps_pw(void);
170
void do_float_cvtpw_ps(void);
171
void do_float_cvts_d(void);
172
void do_float_cvts_w(void);
173
void do_float_cvts_l(void);
174
void do_float_cvts_pl(void);
175
void do_float_cvts_pu(void);
176
void do_float_cvtw_s(void);
177
void do_float_cvtw_d(void);
178

    
179
void do_float_addr_ps(void);
180
void do_float_mulr_ps(void);
181

    
182
#define FOP_PROTO(op)                      \
183
void do_cmp_d_ ## op(long cc);             \
184
void do_cmpabs_d_ ## op(long cc);          \
185
void do_cmp_s_ ## op(long cc);             \
186
void do_cmpabs_s_ ## op(long cc);          \
187
void do_cmp_ps_ ## op(long cc);            \
188
void do_cmpabs_ps_ ## op(long cc);
189

    
190
FOP_PROTO(f)
191
FOP_PROTO(un)
192
FOP_PROTO(eq)
193
FOP_PROTO(ueq)
194
FOP_PROTO(olt)
195
FOP_PROTO(ult)
196
FOP_PROTO(ole)
197
FOP_PROTO(ule)
198
FOP_PROTO(sf)
199
FOP_PROTO(ngle)
200
FOP_PROTO(seq)
201
FOP_PROTO(ngl)
202
FOP_PROTO(lt)
203
FOP_PROTO(nge)
204
FOP_PROTO(le)
205
FOP_PROTO(ngt)
206
#undef FOP_PROTO
207

    
208
static always_inline void env_to_regs(void)
209
{
210
}
211

    
212
static always_inline void regs_to_env(void)
213
{
214
}
215

    
216
static always_inline int cpu_halted(CPUState *env)
217
{
218
    if (!env->halted)
219
        return 0;
220
    if (env->interrupt_request &
221
        (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)) {
222
        env->halted = 0;
223
        return 0;
224
    }
225
    return EXCP_HALTED;
226
}
227

    
228
static always_inline void compute_hflags(CPUState *env)
229
{
230
    env->hflags &= ~(MIPS_HFLAG_64 | MIPS_HFLAG_CP0 | MIPS_HFLAG_F64 |
231
                     MIPS_HFLAG_FPU | MIPS_HFLAG_UM);
232
    if (!(env->CP0_Status & (1 << CP0St_EXL)) &&
233
        !(env->CP0_Status & (1 << CP0St_ERL)) &&
234
        !(env->hflags & MIPS_HFLAG_DM)) {
235
        if (env->CP0_Status & (1 << CP0St_UM))
236
            env->hflags |= MIPS_HFLAG_UM;
237
        if (env->CP0_Status & (1 << CP0St_R0))
238
            env->hflags |= MIPS_HFLAG_SM;
239
    }
240
#if defined(TARGET_MIPSN32) || defined(TARGET_MIPS64)
241
    if (!(env->hflags & MIPS_HFLAG_UM) ||
242
        (env->CP0_Status & (1 << CP0St_PX)) ||
243
        (env->CP0_Status & (1 << CP0St_UX)))
244
        env->hflags |= MIPS_HFLAG_64;
245
#endif
246
    if ((env->CP0_Status & (1 << CP0St_CU0)) ||
247
        (!(env->hflags & MIPS_HFLAG_UM) &&
248
         !(env->hflags & MIPS_HFLAG_SM)))
249
        env->hflags |= MIPS_HFLAG_CP0;
250
    if (env->CP0_Status & (1 << CP0St_CU1))
251
        env->hflags |= MIPS_HFLAG_FPU;
252
    if (env->CP0_Status & (1 << CP0St_FR))
253
        env->hflags |= MIPS_HFLAG_F64;
254
}
255

    
256
#endif /* !defined(__QEMU_MIPS_EXEC_H__) */