Revisão | f0102cd18f384684d16ffaf34f04ee59146303b8 (tree) |
---|---|
Hora | 2019-05-22 23:05:01 |
Autor | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
target/rx: CPU definition
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
@@ -0,0 +1,239 @@ | ||
1 | +/* | |
2 | + * QEMU RX CPU | |
3 | + * | |
4 | + * Copyright (c) 2019 Yoshinori Sato | |
5 | + * | |
6 | + * This program is free software; you can redistribute it and/or modify it | |
7 | + * under the terms and conditions of the GNU General Public License, | |
8 | + * version 2 or later, as published by the Free Software Foundation. | |
9 | + * | |
10 | + * This program is distributed in the hope it will be useful, but WITHOUT | |
11 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | + * more details. | |
14 | + * | |
15 | + * You should have received a copy of the GNU General Public License along with | |
16 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | + */ | |
18 | + | |
19 | +#include "qemu/osdep.h" | |
20 | +#include "qemu/qemu-print.h" | |
21 | +#include "qapi/error.h" | |
22 | +#include "cpu.h" | |
23 | +#include "qemu-common.h" | |
24 | +#include "migration/vmstate.h" | |
25 | +#include "exec/exec-all.h" | |
26 | +#include "hw/loader.h" | |
27 | +#include "fpu/softfloat.h" | |
28 | + | |
29 | +static void rx_cpu_set_pc(CPUState *cs, vaddr value) | |
30 | +{ | |
31 | + RXCPU *cpu = RXCPU(cs); | |
32 | + | |
33 | + cpu->env.pc = value; | |
34 | +} | |
35 | + | |
36 | +static void rx_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) | |
37 | +{ | |
38 | + RXCPU *cpu = RXCPU(cs); | |
39 | + | |
40 | + cpu->env.pc = tb->pc; | |
41 | +} | |
42 | + | |
43 | +static bool rx_cpu_has_work(CPUState *cs) | |
44 | +{ | |
45 | + return cs->interrupt_request & | |
46 | + (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIR); | |
47 | +} | |
48 | + | |
49 | +static void rx_cpu_reset(CPUState *s) | |
50 | +{ | |
51 | + RXCPU *cpu = RXCPU(s); | |
52 | + RXCPUClass *rcc = RXCPU_GET_CLASS(cpu); | |
53 | + CPURXState *env = &cpu->env; | |
54 | + uint32_t *resetvec; | |
55 | + | |
56 | + rcc->parent_reset(s); | |
57 | + | |
58 | + memset(env, 0, offsetof(CPURXState, end_reset_fields)); | |
59 | + | |
60 | + resetvec = rom_ptr(0xfffffffc, 4); | |
61 | + if (resetvec) { | |
62 | + /* In the case of kernel, it is ignored because it is not set. */ | |
63 | + env->pc = ldl_p(resetvec); | |
64 | + } | |
65 | + rx_cpu_unpack_psw(env, 0, 1); | |
66 | + env->regs[0] = env->isp = env->usp = 0; | |
67 | + env->fpsw = 0; | |
68 | + set_flush_to_zero(1, &env->fp_status); | |
69 | + set_flush_inputs_to_zero(1, &env->fp_status); | |
70 | +} | |
71 | + | |
72 | +static void rx_cpu_list_entry(gpointer data, gpointer user_data) | |
73 | +{ | |
74 | + const char *typename = object_class_get_name(OBJECT_CLASS(data)); | |
75 | + int len = strlen(typename) - strlen(RX_CPU_TYPE_SUFFIX); | |
76 | + | |
77 | + qemu_printf("%.*s\n", len, typename); | |
78 | +} | |
79 | + | |
80 | +void rx_cpu_list(void) | |
81 | +{ | |
82 | + GSList *list; | |
83 | + list = object_class_get_list_sorted(TYPE_RXCPU, false); | |
84 | + g_slist_foreach(list, rx_cpu_list_entry, NULL); | |
85 | + g_slist_free(list); | |
86 | +} | |
87 | + | |
88 | +static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) | |
89 | +{ | |
90 | + ObjectClass *oc; | |
91 | + char *typename = NULL; | |
92 | + | |
93 | + typename = g_strdup_printf(RX_CPU_TYPE_NAME("")); | |
94 | + oc = object_class_by_name(typename); | |
95 | + if (oc != NULL && object_class_is_abstract(oc)) { | |
96 | + oc = NULL; | |
97 | + } | |
98 | + | |
99 | + g_free(typename); | |
100 | + return oc; | |
101 | +} | |
102 | + | |
103 | +static void rx_cpu_realize(DeviceState *dev, Error **errp) | |
104 | +{ | |
105 | + CPUState *cs = CPU(dev); | |
106 | + RXCPUClass *rcc = RXCPU_GET_CLASS(dev); | |
107 | + Error *local_err = NULL; | |
108 | + | |
109 | + cpu_exec_realizefn(cs, &local_err); | |
110 | + if (local_err != NULL) { | |
111 | + error_propagate(errp, local_err); | |
112 | + return; | |
113 | + } | |
114 | + | |
115 | + cpu_reset(cs); | |
116 | + qemu_init_vcpu(cs); | |
117 | + | |
118 | + rcc->parent_realize(dev, errp); | |
119 | +} | |
120 | + | |
121 | +static void rx_cpu_set_irq(void *opaque, int no, int request) | |
122 | +{ | |
123 | + RXCPU *cpu = opaque; | |
124 | + CPUState *cs = CPU(cpu); | |
125 | + int irq = request & 0xff; | |
126 | + | |
127 | + static const int mask[] = { | |
128 | + [RX_CPU_IRQ] = CPU_INTERRUPT_HARD, | |
129 | + [RX_CPU_FIR] = CPU_INTERRUPT_FIR, | |
130 | + }; | |
131 | + if (irq) { | |
132 | + cpu->env.req_irq = irq; | |
133 | + cpu->env.req_ipl = (request >> 8) & 0x0f; | |
134 | + cpu_interrupt(cs, mask[no]); | |
135 | + } else { | |
136 | + cpu_reset_interrupt(cs, mask[no]); | |
137 | + } | |
138 | +} | |
139 | + | |
140 | +static void rx_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) | |
141 | +{ | |
142 | + info->mach = bfd_mach_rx; | |
143 | + info->print_insn = print_insn_rx; | |
144 | +} | |
145 | + | |
146 | +static void rx_cpu_init(Object *obj) | |
147 | +{ | |
148 | + CPUState *cs = CPU(obj); | |
149 | + RXCPU *cpu = RXCPU(obj); | |
150 | + CPURXState *env = &cpu->env; | |
151 | + | |
152 | + cs->env_ptr = env; | |
153 | + qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2); | |
154 | +} | |
155 | + | |
156 | + | |
157 | +static bool rx_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, | |
158 | + MMUAccessType access_type, int mmu_idx, | |
159 | + bool probe, uintptr_t retaddr) | |
160 | +{ | |
161 | + uint32_t address, physical, prot; | |
162 | + | |
163 | + /* | |
164 | + RX has no-MMU | |
165 | + Only linear mapping | |
166 | + */ | |
167 | + address = physical = addr & TARGET_PAGE_MASK; | |
168 | + prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | |
169 | + tlb_set_page(cs, address, physical, prot, mmu_idx, TARGET_PAGE_SIZE); | |
170 | + return true; | |
171 | +} | |
172 | + | |
173 | +static void rxcpu_class_init(ObjectClass *klass, void *data) | |
174 | +{ | |
175 | + DeviceClass *dc = DEVICE_CLASS(klass); | |
176 | + CPUClass *cc = CPU_CLASS(klass); | |
177 | + RXCPUClass *rcc = RXCPU_CLASS(klass); | |
178 | + | |
179 | + device_class_set_parent_realize(dc, rx_cpu_realize, | |
180 | + &rcc->parent_realize); | |
181 | + | |
182 | + rcc->parent_reset = cc->reset; | |
183 | + cc->reset = rx_cpu_reset; | |
184 | + | |
185 | + cc->class_by_name = rx_cpu_class_by_name; | |
186 | + cc->has_work = rx_cpu_has_work; | |
187 | + cc->do_interrupt = rx_cpu_do_interrupt; | |
188 | + cc->cpu_exec_interrupt = rx_cpu_exec_interrupt; | |
189 | + cc->dump_state = rx_cpu_dump_state; | |
190 | + cc->set_pc = rx_cpu_set_pc; | |
191 | + cc->synchronize_from_tb = rx_cpu_synchronize_from_tb; | |
192 | + cc->gdb_read_register = rx_cpu_gdb_read_register; | |
193 | + cc->gdb_write_register = rx_cpu_gdb_write_register; | |
194 | + cc->get_phys_page_debug = rx_cpu_get_phys_page_debug; | |
195 | + cc->disas_set_info = rx_cpu_disas_set_info; | |
196 | + cc->tcg_initialize = rx_translate_init; | |
197 | + cc->tlb_fill = rx_cpu_tlb_fill; | |
198 | + cc->gdb_num_core_regs = 26; | |
199 | +} | |
200 | + | |
201 | +static const TypeInfo rxcpu_info = { | |
202 | + .name = TYPE_RXCPU, | |
203 | + .parent = TYPE_CPU, | |
204 | + .instance_size = sizeof(RXCPU), | |
205 | + .instance_init = rx_cpu_init, | |
206 | + .abstract = false, | |
207 | + .class_size = sizeof(RXCPUClass), | |
208 | + .class_init = rxcpu_class_init, | |
209 | +}; | |
210 | + | |
211 | +static void rxcpu_register_types(void) | |
212 | +{ | |
213 | + type_register_static(&rxcpu_info); | |
214 | +} | |
215 | + | |
216 | +type_init(rxcpu_register_types) | |
217 | + | |
218 | +static uint32_t extable[32]; | |
219 | + | |
220 | +void rx_load_image(RXCPU *cpu, const char *filename, | |
221 | + uint32_t start, uint32_t size) | |
222 | +{ | |
223 | + long kernel_size; | |
224 | + int i; | |
225 | + | |
226 | + kernel_size = load_image_targphys(filename, start, size); | |
227 | + if (kernel_size < 0) { | |
228 | + fprintf(stderr, "qemu: could not load kernel '%s'\n", filename); | |
229 | + exit(1); | |
230 | + } | |
231 | + cpu->env.pc = start; | |
232 | + | |
233 | + /* setup exception trap trampoline */ | |
234 | + /* linux kernel only works little-endian mode */ | |
235 | + for (i = 0; i < 32; i++) { | |
236 | + extable[i] = cpu_to_le32(0x10 + i * 4); | |
237 | + } | |
238 | + rom_add_blob_fixed("extable", extable, sizeof(extable), 0xffffff80); | |
239 | +} |
@@ -0,0 +1,227 @@ | ||
1 | +/* | |
2 | + * RX emulation definition | |
3 | + * | |
4 | + * Copyright (c) 2019 Yoshinori Sato | |
5 | + * | |
6 | + * This program is free software; you can redistribute it and/or modify it | |
7 | + * under the terms and conditions of the GNU General Public License, | |
8 | + * version 2 or later, as published by the Free Software Foundation. | |
9 | + * | |
10 | + * This program is distributed in the hope it will be useful, but WITHOUT | |
11 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | + * more details. | |
14 | + * | |
15 | + * You should have received a copy of the GNU General Public License along with | |
16 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | + */ | |
18 | + | |
19 | +#ifndef RX_CPU_H | |
20 | +#define RX_CPU_H | |
21 | + | |
22 | +#include "qemu/bitops.h" | |
23 | +#include "qemu-common.h" | |
24 | +#include "hw/registerfields.h" | |
25 | +#include "qom/cpu.h" | |
26 | + | |
27 | +#define TYPE_RXCPU "rxcpu" | |
28 | + | |
29 | +#define RXCPU_CLASS(klass) \ | |
30 | + OBJECT_CLASS_CHECK(RXCPUClass, (klass), TYPE_RXCPU) | |
31 | +#define RXCPU(obj) \ | |
32 | + OBJECT_CHECK(RXCPU, (obj), TYPE_RXCPU) | |
33 | +#define RXCPU_GET_CLASS(obj) \ | |
34 | + OBJECT_GET_CLASS(RXCPUClass, (obj), TYPE_RXCPU) | |
35 | + | |
36 | +/* | |
37 | + * RXCPUClass: | |
38 | + * @parent_realize: The parent class' realize handler. | |
39 | + * @parent_reset: The parent class' reset handler. | |
40 | + * | |
41 | + * A RX CPU model. | |
42 | + */ | |
43 | +typedef struct RXCPUClass { | |
44 | + /*< private >*/ | |
45 | + CPUClass parent_class; | |
46 | + /*< public >*/ | |
47 | + | |
48 | + DeviceRealize parent_realize; | |
49 | + void (*parent_reset)(CPUState *cpu); | |
50 | + | |
51 | +} RXCPUClass; | |
52 | + | |
53 | +#define TARGET_LONG_BITS 32 | |
54 | +#define TARGET_PAGE_BITS 12 | |
55 | + | |
56 | +#define CPUArchState struct CPURXState | |
57 | + | |
58 | +#include "exec/cpu-defs.h" | |
59 | + | |
60 | +#define TARGET_PHYS_ADDR_SPACE_BITS 32 | |
61 | +#define TARGET_VIRT_ADDR_SPACE_BITS 32 | |
62 | + | |
63 | +/* PSW define */ | |
64 | +REG32(PSW, 0) | |
65 | +FIELD(PSW, C, 0, 1) | |
66 | +FIELD(PSW, Z, 1, 1) | |
67 | +FIELD(PSW, S, 2, 1) | |
68 | +FIELD(PSW, O, 3, 1) | |
69 | +FIELD(PSW, I, 16, 1) | |
70 | +FIELD(PSW, U, 17, 1) | |
71 | +FIELD(PSW, PM, 20, 1) | |
72 | +FIELD(PSW, IPL, 24, 4) | |
73 | + | |
74 | +/* FPSW define */ | |
75 | +REG32(FPSW, 0) | |
76 | +FIELD(FPSW, RM, 0, 2) | |
77 | +FIELD(FPSW, CV, 2, 1) | |
78 | +FIELD(FPSW, CO, 3, 1) | |
79 | +FIELD(FPSW, CZ, 4, 1) | |
80 | +FIELD(FPSW, CU, 5, 1) | |
81 | +FIELD(FPSW, CX, 6, 1) | |
82 | +FIELD(FPSW, CE, 7, 1) | |
83 | +FIELD(FPSW, CAUSE, 2, 6) | |
84 | +FIELD(FPSW, DN, 8, 1) | |
85 | +FIELD(FPSW, EV, 10, 1) | |
86 | +FIELD(FPSW, EO, 11, 1) | |
87 | +FIELD(FPSW, EZ, 12, 1) | |
88 | +FIELD(FPSW, EU, 13, 1) | |
89 | +FIELD(FPSW, EX, 14, 1) | |
90 | +FIELD(FPSW, ENABLE, 10, 5) | |
91 | +FIELD(FPSW, FV, 26, 1) | |
92 | +FIELD(FPSW, FO, 27, 1) | |
93 | +FIELD(FPSW, FZ, 28, 1) | |
94 | +FIELD(FPSW, FU, 29, 1) | |
95 | +FIELD(FPSW, FX, 30, 1) | |
96 | +FIELD(FPSW, FLAGS, 26, 4) | |
97 | +FIELD(FPSW, FS, 31, 1) | |
98 | + | |
99 | +#define NB_MMU_MODES 1 | |
100 | +#define MMU_MODE0_SUFFIX _all | |
101 | + | |
102 | +enum { | |
103 | + NUM_REGS = 16, | |
104 | +}; | |
105 | + | |
106 | +typedef struct CPURXState { | |
107 | + /* CPU registers */ | |
108 | + uint32_t regs[NUM_REGS]; /* general registers */ | |
109 | + uint32_t psw_o; /* O bit of status register */ | |
110 | + uint32_t psw_s; /* S bit of status register */ | |
111 | + uint32_t psw_z; /* Z bit of status register */ | |
112 | + uint32_t psw_c; /* C bit of status register */ | |
113 | + uint32_t psw_u; | |
114 | + uint32_t psw_i; | |
115 | + uint32_t psw_pm; | |
116 | + uint32_t psw_ipl; | |
117 | + uint32_t bpsw; /* backup status */ | |
118 | + uint32_t bpc; /* backup pc */ | |
119 | + uint32_t isp; /* global base register */ | |
120 | + uint32_t usp; /* vector base register */ | |
121 | + uint32_t pc; /* program counter */ | |
122 | + uint32_t intb; /* interrupt vector */ | |
123 | + uint32_t fintv; | |
124 | + uint32_t fpsw; | |
125 | + uint64_t acc; | |
126 | + | |
127 | + /* Fields up to this point are cleared by a CPU reset */ | |
128 | + struct {} end_reset_fields; | |
129 | + | |
130 | + /* Internal use */ | |
131 | + uint32_t in_sleep; | |
132 | + uint32_t req_irq; /* Requested interrupt no (hard) */ | |
133 | + uint32_t req_ipl; /* Requested interrupt level */ | |
134 | + uint32_t ack_irq; /* execute irq */ | |
135 | + uint32_t ack_ipl; /* execute ipl */ | |
136 | + float_status fp_status; | |
137 | + qemu_irq ack; /* Interrupt acknowledge */ | |
138 | + | |
139 | + CPU_COMMON | |
140 | +} CPURXState; | |
141 | + | |
142 | +/* | |
143 | + * RXCPU: | |
144 | + * @env: #CPURXState | |
145 | + * | |
146 | + * A RX CPU | |
147 | + */ | |
148 | +struct RXCPU { | |
149 | + /*< private >*/ | |
150 | + CPUState parent_obj; | |
151 | + /*< public >*/ | |
152 | + | |
153 | + CPURXState env; | |
154 | +}; | |
155 | + | |
156 | +typedef struct RXCPU RXCPU; | |
157 | + | |
158 | +static inline RXCPU *rx_env_get_cpu(CPURXState *env) | |
159 | +{ | |
160 | + return container_of(env, RXCPU, env); | |
161 | +} | |
162 | + | |
163 | +#define ENV_GET_CPU(e) CPU(rx_env_get_cpu(e)) | |
164 | + | |
165 | +#define ENV_OFFSET offsetof(RXCPU, env) | |
166 | + | |
167 | +#define RX_CPU_TYPE_SUFFIX "-" TYPE_RXCPU | |
168 | +#define RX_CPU_TYPE_NAME(model) model RX_CPU_TYPE_SUFFIX | |
169 | +#define CPU_RESOLVING_TYPE TYPE_RXCPU | |
170 | + | |
171 | +extern const char rx_crname[][6]; | |
172 | + | |
173 | +void rx_cpu_do_interrupt(CPUState *cpu); | |
174 | +bool rx_cpu_exec_interrupt(CPUState *cpu, int int_req); | |
175 | +void rx_cpu_dump_state(CPUState *cpu, FILE *f, int flags); | |
176 | +int rx_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg); | |
177 | +int rx_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); | |
178 | +hwaddr rx_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); | |
179 | + | |
180 | +void rx_translate_init(void); | |
181 | +int cpu_rx_signal_handler(int host_signum, void *pinfo, | |
182 | + void *puc); | |
183 | + | |
184 | +void rx_cpu_list(void); | |
185 | +void rx_load_image(RXCPU *cpu, const char *filename, | |
186 | + uint32_t start, uint32_t size); | |
187 | +void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte); | |
188 | + | |
189 | +#define cpu_signal_handler cpu_rx_signal_handler | |
190 | +#define cpu_list rx_cpu_list | |
191 | + | |
192 | +#include "exec/cpu-all.h" | |
193 | + | |
194 | +#define CPU_INTERRUPT_SOFT CPU_INTERRUPT_TGT_INT_0 | |
195 | +#define CPU_INTERRUPT_FIR CPU_INTERRUPT_TGT_INT_1 | |
196 | + | |
197 | +#define RX_CPU_IRQ 0 | |
198 | +#define RX_CPU_FIR 1 | |
199 | + | |
200 | +static inline void cpu_get_tb_cpu_state(CPURXState *env, target_ulong *pc, | |
201 | + target_ulong *cs_base, uint32_t *flags) | |
202 | +{ | |
203 | + *pc = env->pc; | |
204 | + *cs_base = 0; | |
205 | + *flags = FIELD_DP32(0, PSW, PM, env->psw_pm); | |
206 | +} | |
207 | + | |
208 | +static inline int cpu_mmu_index(CPURXState *env, bool ifetch) | |
209 | +{ | |
210 | + return 0; | |
211 | +} | |
212 | + | |
213 | +static inline uint32_t rx_cpu_pack_psw(CPURXState *env) | |
214 | +{ | |
215 | + uint32_t psw = 0; | |
216 | + psw = FIELD_DP32(psw, PSW, IPL, env->psw_ipl); | |
217 | + psw = FIELD_DP32(psw, PSW, PM, env->psw_pm); | |
218 | + psw = FIELD_DP32(psw, PSW, U, env->psw_u); | |
219 | + psw = FIELD_DP32(psw, PSW, I, env->psw_i); | |
220 | + psw = FIELD_DP32(psw, PSW, O, env->psw_o >> 31); | |
221 | + psw = FIELD_DP32(psw, PSW, S, env->psw_s >> 31); | |
222 | + psw = FIELD_DP32(psw, PSW, Z, env->psw_z == 0); | |
223 | + psw = FIELD_DP32(psw, PSW, C, env->psw_c); | |
224 | + return psw; | |
225 | +} | |
226 | + | |
227 | +#endif /* RX_CPU_H */ |
@@ -0,0 +1,112 @@ | ||
1 | +/* | |
2 | + * RX gdb server stub | |
3 | + * | |
4 | + * Copyright (c) 2019 Yoshinori Sato | |
5 | + * | |
6 | + * This program is free software; you can redistribute it and/or modify it | |
7 | + * under the terms and conditions of the GNU General Public License, | |
8 | + * version 2 or later, as published by the Free Software Foundation. | |
9 | + * | |
10 | + * This program is distributed in the hope it will be useful, but WITHOUT | |
11 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | + * more details. | |
14 | + * | |
15 | + * You should have received a copy of the GNU General Public License along with | |
16 | + * this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | + */ | |
18 | +#include "qemu/osdep.h" | |
19 | +#include "qemu-common.h" | |
20 | +#include "cpu.h" | |
21 | +#include "exec/gdbstub.h" | |
22 | + | |
23 | +int rx_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) | |
24 | +{ | |
25 | + RXCPU *cpu = RXCPU(cs); | |
26 | + CPURXState *env = &cpu->env; | |
27 | + | |
28 | + switch (n) { | |
29 | + case 0 ... 15: | |
30 | + return gdb_get_regl(mem_buf, env->regs[n]); | |
31 | + case 16: | |
32 | + return gdb_get_regl(mem_buf, (env->psw_u) ? env->regs[0] : env->usp); | |
33 | + case 17: | |
34 | + return gdb_get_regl(mem_buf, (!env->psw_u) ? env->regs[0] : env->isp); | |
35 | + case 18: | |
36 | + return gdb_get_regl(mem_buf, rx_cpu_pack_psw(env)); | |
37 | + case 19: | |
38 | + return gdb_get_regl(mem_buf, env->pc); | |
39 | + case 20: | |
40 | + return gdb_get_regl(mem_buf, env->intb); | |
41 | + case 21: | |
42 | + return gdb_get_regl(mem_buf, env->bpsw); | |
43 | + case 22: | |
44 | + return gdb_get_regl(mem_buf, env->bpc); | |
45 | + case 23: | |
46 | + return gdb_get_regl(mem_buf, env->fintv); | |
47 | + case 24: | |
48 | + return gdb_get_regl(mem_buf, env->fpsw); | |
49 | + case 25: | |
50 | + return 0; | |
51 | + } | |
52 | + return 0; | |
53 | +} | |
54 | + | |
55 | +int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) | |
56 | +{ | |
57 | + RXCPU *cpu = RXCPU(cs); | |
58 | + CPURXState *env = &cpu->env; | |
59 | + uint32_t psw; | |
60 | + switch (n) { | |
61 | + case 0 ... 15: | |
62 | + env->regs[n] = ldl_p(mem_buf); | |
63 | + if (n == 0) { | |
64 | + if (env->psw_u) { | |
65 | + env->usp = env->regs[0]; | |
66 | + } else { | |
67 | + env->isp = env->regs[0]; | |
68 | + } | |
69 | + } | |
70 | + break; | |
71 | + case 16: | |
72 | + env->usp = ldl_p(mem_buf); | |
73 | + if (env->psw_u) { | |
74 | + env->regs[0] = ldl_p(mem_buf); | |
75 | + } | |
76 | + break; | |
77 | + case 17: | |
78 | + env->isp = ldl_p(mem_buf); | |
79 | + if (!env->psw_u) { | |
80 | + env->regs[0] = ldl_p(mem_buf); | |
81 | + } | |
82 | + break; | |
83 | + case 18: | |
84 | + psw = ldl_p(mem_buf); | |
85 | + rx_cpu_unpack_psw(env, psw, 1); | |
86 | + break; | |
87 | + case 19: | |
88 | + env->pc = ldl_p(mem_buf); | |
89 | + break; | |
90 | + case 20: | |
91 | + env->intb = ldl_p(mem_buf); | |
92 | + break; | |
93 | + case 21: | |
94 | + env->bpsw = ldl_p(mem_buf); | |
95 | + break; | |
96 | + case 22: | |
97 | + env->bpc = ldl_p(mem_buf); | |
98 | + break; | |
99 | + case 23: | |
100 | + env->fintv = ldl_p(mem_buf); | |
101 | + break; | |
102 | + case 24: | |
103 | + env->fpsw = ldl_p(mem_buf); | |
104 | + break; | |
105 | + case 25: | |
106 | + return 8; | |
107 | + default: | |
108 | + return 0; | |
109 | + } | |
110 | + | |
111 | + return 4; | |
112 | +} |
@@ -0,0 +1,38 @@ | ||
1 | +/* | |
2 | + * QEMU monitor | |
3 | + * | |
4 | + * Copyright (c) 2003-2004 Fabrice Bellard | |
5 | + * | |
6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | + * of this software and associated documentation files (the "Software"), to deal | |
8 | + * in the Software without restriction, including without limitation the rights | |
9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | + * copies of the Software, and to permit persons to whom the Software is | |
11 | + * furnished to do so, subject to the following conditions: | |
12 | + * | |
13 | + * The above copyright notice and this permission notice shall be included in | |
14 | + * all copies or substantial portions of the Software. | |
15 | + * | |
16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | + * THE SOFTWARE. | |
23 | + */ | |
24 | +#include "qemu/osdep.h" | |
25 | +#include "cpu.h" | |
26 | +#include "monitor/monitor.h" | |
27 | +#include "monitor/hmp-target.h" | |
28 | +#include "hmp.h" | |
29 | + | |
30 | +void hmp_info_tlb(Monitor *mon, const QDict *qdict) | |
31 | +{ | |
32 | + CPUArchState *env = mon_get_cpu_env(); | |
33 | + | |
34 | + if (!env) { | |
35 | + monitor_printf(mon, "No CPU available\n"); | |
36 | + return; | |
37 | + } | |
38 | +} |
@@ -468,14 +468,3 @@ void QEMU_NORETURN helper_rxbrk(CPURXState *env) | ||
468 | 468 | { |
469 | 469 | raise_exception(env, 0x100, 0); |
470 | 470 | } |
471 | - | |
472 | -void tlb_fill(CPUState *cs, target_ulong addr, int size, | |
473 | - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) | |
474 | -{ | |
475 | - uint32_t address, physical, prot; | |
476 | - | |
477 | - /* Linear mapping */ | |
478 | - address = physical = addr & TARGET_PAGE_MASK; | |
479 | - prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | |
480 | - tlb_set_page(cs, address, physical, prot, mmu_idx, TARGET_PAGE_SIZE); | |
481 | -} |