aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Crosthwaite <crosthwaitepeter@gmail.com>2015-07-11 19:00:03 -0700
committerAndreas Färber <afaerber@suse.de>2015-10-22 15:49:40 +0200
commitd49dd523e459a4c001a0c87a438fd2fa1f5b4bae (patch)
tree05b19cd7381891f69690a548e0753d220cdff851
parent20984673e68ebd069222512c876b846ff2425cc0 (diff)
downloadqemu-d49dd523e459a4c001a0c87a438fd2fa1f5b4bae.zip
qemu-d49dd523e459a4c001a0c87a438fd2fa1f5b4bae.tar.gz
qemu-d49dd523e459a4c001a0c87a438fd2fa1f5b4bae.tar.bz2
disas: QOMify sh4 specific disas setup
Move the target_disas() sh4 specifics to the CPUClass::disas_set_info() hook and delete the #ifdef specific code in disas.c. Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Acked-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--disas.c6
-rw-r--r--target-sh4/cpu.c11
2 files changed, 10 insertions, 7 deletions
diff --git a/disas.c b/disas.c
index b687c98..2676e2f 100644
--- a/disas.c
+++ b/disas.c
@@ -236,9 +236,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code,
#else
s.info.print_insn = print_insn_little_mips;
#endif
-#elif defined(TARGET_SH4)
- s.info.mach = bfd_mach_sh4;
- s.info.print_insn = print_insn_sh;
#elif defined(TARGET_ALPHA)
s.info.mach = bfd_mach_alpha_ev6;
s.info.print_insn = print_insn_alpha;
@@ -436,9 +433,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
#else
s.info.print_insn = print_insn_little_mips;
#endif
-#elif defined(TARGET_SH4)
- s.info.mach = bfd_mach_sh4;
- s.info.print_insn = print_insn_sh;
#endif
if (!s.info.print_insn) {
monitor_printf(mon, "0x" TARGET_FMT_lx
diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
index 64e4467..d7e2fbd 100644
--- a/target-sh4/cpu.c
+++ b/target-sh4/cpu.c
@@ -70,6 +70,12 @@ static void superh_cpu_reset(CPUState *s)
set_default_nan_mode(1, &env->fp_status);
}
+static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
+{
+ info->mach = bfd_mach_sh4;
+ info->print_insn = print_insn_sh;
+}
+
typedef struct SuperHCPUListState {
fprintf_function cpu_fprintf;
FILE *file;
@@ -288,9 +294,12 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
#else
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
#endif
- dc->vmsd = &vmstate_sh_cpu;
+ cc->disas_set_info = superh_cpu_disas_set_info;
+
cc->gdb_num_core_regs = 59;
+ dc->vmsd = &vmstate_sh_cpu;
+
/*
* Reason: superh_cpu_initfn() calls cpu_exec_init(), which saves
* the object in cpus -> dangling pointer after final