Statistics
| Branch: | Revision:

root / target-mips / exec.h @ 2cbd949d

History | View | Annotate | Download (3.4 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
#include "cpu.h"
14
#include "exec-all.h"
15

    
16
#if !defined(CONFIG_USER_ONLY)
17
#include "softmmu_exec.h"
18
#endif /* !defined(CONFIG_USER_ONLY) */
19

    
20
void do_mtc0_status_debug(uint32_t old, uint32_t val);
21
void do_mtc0_status_irqraise_debug(void);
22
void dump_fpu(CPUState *env);
23
void fpu_dump_state(CPUState *env, FILE *f,
24
                    int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
25
                    int flags);
26

    
27
int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
28
                               int mmu_idx, int is_softmmu);
29
void do_interrupt (CPUState *env);
30
void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra);
31

    
32
void do_raise_exception_err (uint32_t exception, int error_code);
33
void do_raise_exception (uint32_t exception);
34

    
35
uint32_t cpu_mips_get_random (CPUState *env);
36
uint32_t cpu_mips_get_count (CPUState *env);
37
void cpu_mips_store_count (CPUState *env, uint32_t value);
38
void cpu_mips_store_compare (CPUState *env, uint32_t value);
39
void cpu_mips_start_count(CPUState *env);
40
void cpu_mips_stop_count(CPUState *env);
41
void cpu_mips_update_irq (CPUState *env);
42
void cpu_mips_clock_init (CPUState *env);
43
void cpu_mips_tlb_flush (CPUState *env, int flush_global);
44

    
45
static inline void env_to_regs(void)
46
{
47
}
48

    
49
static inline void regs_to_env(void)
50
{
51
}
52

    
53
static inline int cpu_halted(CPUState *env)
54
{
55
    if (!env->halted)
56
        return 0;
57
    if (env->interrupt_request &
58
        (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)) {
59
        env->halted = 0;
60
        return 0;
61
    }
62
    return EXCP_HALTED;
63
}
64

    
65
static inline void compute_hflags(CPUState *env)
66
{
67
    env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 |
68
                     MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU |
69
                     MIPS_HFLAG_UX);
70
    if (!(env->CP0_Status & (1 << CP0St_EXL)) &&
71
        !(env->CP0_Status & (1 << CP0St_ERL)) &&
72
        !(env->hflags & MIPS_HFLAG_DM)) {
73
        env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU;
74
    }
75
#if defined(TARGET_MIPS64)
76
    if (((env->hflags & MIPS_HFLAG_KSU) != MIPS_HFLAG_UM) ||
77
        (env->CP0_Status & (1 << CP0St_PX)) ||
78
        (env->CP0_Status & (1 << CP0St_UX)))
79
        env->hflags |= MIPS_HFLAG_64;
80
    if (env->CP0_Status & (1 << CP0St_UX))
81
        env->hflags |= MIPS_HFLAG_UX;
82
#endif
83
    if ((env->CP0_Status & (1 << CP0St_CU0)) ||
84
        !(env->hflags & MIPS_HFLAG_KSU))
85
        env->hflags |= MIPS_HFLAG_CP0;
86
    if (env->CP0_Status & (1 << CP0St_CU1))
87
        env->hflags |= MIPS_HFLAG_FPU;
88
    if (env->CP0_Status & (1 << CP0St_FR))
89
        env->hflags |= MIPS_HFLAG_F64;
90
    if (env->insn_flags & ISA_MIPS32R2) {
91
        if (env->active_fpu.fcr0 & (1 << FCR0_F64))
92
            env->hflags |= MIPS_HFLAG_COP1X;
93
    } else if (env->insn_flags & ISA_MIPS32) {
94
        if (env->hflags & MIPS_HFLAG_64)
95
            env->hflags |= MIPS_HFLAG_COP1X;
96
    } else if (env->insn_flags & ISA_MIPS4) {
97
        /* All supported MIPS IV CPUs use the XX (CU3) to enable
98
           and disable the MIPS IV extensions to the MIPS III ISA.
99
           Some other MIPS IV CPUs ignore the bit, so the check here
100
           would be too restrictive for them.  */
101
        if (env->CP0_Status & (1 << CP0St_CU3))
102
            env->hflags |= MIPS_HFLAG_COP1X;
103
    }
104
}
105

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