1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef MOXIE_CPU_H
21#define MOXIE_CPU_H
22
23#include "qemu-common.h"
24
25#define TARGET_LONG_BITS 32
26
27#define CPUArchState struct CPUMoxieState
28
29#define MOXIE_EX_DIV0 0
30#define MOXIE_EX_BAD 1
31#define MOXIE_EX_IRQ 2
32#define MOXIE_EX_SWI 3
33#define MOXIE_EX_MMU_MISS 4
34#define MOXIE_EX_BREAK 16
35
36#include "exec/cpu-defs.h"
37
38#define TARGET_PAGE_BITS 12
39
40#define TARGET_PHYS_ADDR_SPACE_BITS 32
41#define TARGET_VIRT_ADDR_SPACE_BITS 32
42
43#define NB_MMU_MODES 1
44
45typedef struct CPUMoxieState {
46
47 uint32_t flags;
48 uint32_t gregs[16];
49 uint32_t sregs[256];
50 uint32_t pc;
51
52
53 uint32_t cc_a;
54 uint32_t cc_b;
55
56 void *irq[8];
57
58
59 struct {} end_reset_fields;
60
61 CPU_COMMON
62
63} CPUMoxieState;
64
65#include "qom/cpu.h"
66
67#define TYPE_MOXIE_CPU "moxie-cpu"
68
69#define MOXIE_CPU_CLASS(klass) \
70 OBJECT_CLASS_CHECK(MoxieCPUClass, (klass), TYPE_MOXIE_CPU)
71#define MOXIE_CPU(obj) \
72 OBJECT_CHECK(MoxieCPU, (obj), TYPE_MOXIE_CPU)
73#define MOXIE_CPU_GET_CLASS(obj) \
74 OBJECT_GET_CLASS(MoxieCPUClass, (obj), TYPE_MOXIE_CPU)
75
76
77
78
79
80
81
82typedef struct MoxieCPUClass {
83
84 CPUClass parent_class;
85
86
87 DeviceRealize parent_realize;
88 void (*parent_reset)(CPUState *cpu);
89} MoxieCPUClass;
90
91
92
93
94
95
96
97typedef struct MoxieCPU {
98
99 CPUState parent_obj;
100
101
102 CPUMoxieState env;
103} MoxieCPU;
104
105static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)
106{
107 return container_of(env, MoxieCPU, env);
108}
109
110#define ENV_GET_CPU(e) CPU(moxie_env_get_cpu(e))
111
112#define ENV_OFFSET offsetof(MoxieCPU, env)
113
114void moxie_cpu_do_interrupt(CPUState *cs);
115void moxie_cpu_dump_state(CPUState *cpu, FILE *f,
116 fprintf_function cpu_fprintf, int flags);
117hwaddr moxie_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
118void moxie_translate_init(void);
119int cpu_moxie_signal_handler(int host_signum, void *pinfo,
120 void *puc);
121
122#define MOXIE_CPU_TYPE_SUFFIX "-" TYPE_MOXIE_CPU
123#define MOXIE_CPU_TYPE_NAME(model) model MOXIE_CPU_TYPE_SUFFIX
124#define CPU_RESOLVING_TYPE TYPE_MOXIE_CPU
125
126#define cpu_signal_handler cpu_moxie_signal_handler
127
128static inline int cpu_mmu_index(CPUMoxieState *env, bool ifetch)
129{
130 return 0;
131}
132
133#include "exec/cpu-all.h"
134
135static inline void cpu_get_tb_cpu_state(CPUMoxieState *env, target_ulong *pc,
136 target_ulong *cs_base, uint32_t *flags)
137{
138 *pc = env->pc;
139 *cs_base = 0;
140 *flags = 0;
141}
142
143int moxie_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
144 int rw, int mmu_idx);
145
146#endif
147