1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _CPU_MOXIE_H
20#define _CPU_MOXIE_H
21
22#include "qemu-common.h"
23
24#define TARGET_LONG_BITS 32
25
26#define CPUArchState struct CPUMoxieState
27
28#define MOXIE_EX_DIV0 0
29#define MOXIE_EX_BAD 1
30#define MOXIE_EX_IRQ 2
31#define MOXIE_EX_SWI 3
32#define MOXIE_EX_MMU_MISS 4
33#define MOXIE_EX_BREAK 16
34
35#include "exec/cpu-defs.h"
36#include "fpu/softfloat.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 CPU_COMMON
59
60} CPUMoxieState;
61
62#include "qom/cpu.h"
63
64#define TYPE_MOXIE_CPU "moxie-cpu"
65
66#define MOXIE_CPU_CLASS(klass) \
67 OBJECT_CLASS_CHECK(MoxieCPUClass, (klass), TYPE_MOXIE_CPU)
68#define MOXIE_CPU(obj) \
69 OBJECT_CHECK(MoxieCPU, (obj), TYPE_MOXIE_CPU)
70#define MOXIE_CPU_GET_CLASS(obj) \
71 OBJECT_GET_CLASS(MoxieCPUClass, (obj), TYPE_MOXIE_CPU)
72
73
74
75
76
77
78
79typedef struct MoxieCPUClass {
80
81 CPUClass parent_class;
82
83
84 DeviceRealize parent_realize;
85 void (*parent_reset)(CPUState *cpu);
86} MoxieCPUClass;
87
88
89
90
91
92
93
94typedef struct MoxieCPU {
95
96 CPUState parent_obj;
97
98
99 CPUMoxieState env;
100} MoxieCPU;
101
102static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)
103{
104 return container_of(env, MoxieCPU, env);
105}
106
107#define ENV_GET_CPU(e) CPU(moxie_env_get_cpu(e))
108
109#define ENV_OFFSET offsetof(MoxieCPU, env)
110
111MoxieCPU *cpu_moxie_init(const char *cpu_model);
112int cpu_moxie_exec(CPUState *cpu);
113void moxie_cpu_do_interrupt(CPUState *cs);
114void moxie_cpu_dump_state(CPUState *cpu, FILE *f,
115 fprintf_function cpu_fprintf, int flags);
116hwaddr moxie_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
117void moxie_translate_init(void);
118int cpu_moxie_signal_handler(int host_signum, void *pinfo,
119 void *puc);
120
121#define cpu_init(cpu_model) CPU(cpu_moxie_init(cpu_model))
122
123#define cpu_exec cpu_moxie_exec
124#define cpu_signal_handler cpu_moxie_signal_handler
125
126static inline int cpu_mmu_index(CPUMoxieState *env, bool ifetch)
127{
128 return 0;
129}
130
131#include "exec/cpu-all.h"
132#include "exec/exec-all.h"
133
134static inline void cpu_get_tb_cpu_state(CPUMoxieState *env, target_ulong *pc,
135 target_ulong *cs_base, int *flags)
136{
137 *pc = env->pc;
138 *cs_base = 0;
139 *flags = 0;
140}
141
142int moxie_cpu_handle_mmu_fault(CPUState *cpu, vaddr address,
143 int rw, int mmu_idx);
144
145#endif
146