disas: QOMify m68k specific disas setup

Move the target_disas() m68k 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>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Peter Crosthwaite 2015-07-11 19:00:00 -07:00 committed by Andreas Färber
parent 9f87a4cacd
commit 4f669905d9
2 changed files with 8 additions and 5 deletions

View File

@ -235,8 +235,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code,
}
s.info.disassembler_options = (char *)"any";
s.info.print_insn = print_insn_ppc;
#elif defined(TARGET_M68K)
s.info.print_insn = print_insn_m68k;
#elif defined(TARGET_MIPS)
#ifdef TARGET_WORDS_BIGENDIAN
s.info.print_insn = print_insn_big_mips;
@ -445,8 +443,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
s.info.endian = BFD_ENDIAN_LITTLE;
}
s.info.print_insn = print_insn_ppc;
#elif defined(TARGET_M68K)
s.info.print_insn = print_insn_m68k;
#elif defined(TARGET_MIPS)
#ifdef TARGET_WORDS_BIGENDIAN
s.info.print_insn = print_insn_big_mips;

View File

@ -61,6 +61,11 @@ static void m68k_cpu_reset(CPUState *s)
tlb_flush(s, 1);
}
static void m68k_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
{
info->print_insn = print_insn_m68k;
}
/* CPU models */
static ObjectClass *m68k_cpu_class_by_name(const char *cpu_model)
@ -208,11 +213,13 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
#endif
cc->cpu_exec_enter = m68k_cpu_exec_enter;
cc->cpu_exec_exit = m68k_cpu_exec_exit;
cc->disas_set_info = m68k_cpu_disas_set_info;
dc->vmsd = &vmstate_m68k_cpu;
cc->gdb_num_core_regs = 18;
cc->gdb_core_xml_file = "cf-core.xml";
dc->vmsd = &vmstate_m68k_cpu;
/*
* Reason: m68k_cpu_initfn() calls cpu_exec_init(), which saves
* the object in cpus -> dangling pointer after final