disas: QOMify lm32 specific disas setup

Move the target_disas() lm32 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: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Peter Crosthwaite 2015-07-11 19:00:02 -07:00 committed by Andreas Färber
parent df0900eb89
commit 20984673e6
2 changed files with 7 additions and 6 deletions

View File

@ -242,9 +242,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code,
#elif defined(TARGET_ALPHA)
s.info.mach = bfd_mach_alpha_ev6;
s.info.print_insn = print_insn_alpha;
#elif defined(TARGET_LM32)
s.info.mach = bfd_mach_lm32;
s.info.print_insn = print_insn_lm32;
#endif
if (s.info.print_insn == NULL) {
s.info.print_insn = print_insn_od_target;
@ -442,9 +439,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
#elif defined(TARGET_SH4)
s.info.mach = bfd_mach_sh4;
s.info.print_insn = print_insn_sh;
#elif defined(TARGET_LM32)
s.info.mach = bfd_mach_lm32;
s.info.print_insn = print_insn_lm32;
#endif
if (!s.info.print_insn) {
monitor_printf(mon, "0x" TARGET_FMT_lx

View File

@ -131,6 +131,12 @@ static void lm32_cpu_reset(CPUState *s)
tlb_flush(s, 1);
}
static void lm32_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
{
info->mach = bfd_mach_lm32;
info->print_insn = print_insn_lm32;
}
static void lm32_cpu_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cs = CPU(dev);
@ -275,6 +281,7 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
cc->gdb_num_core_regs = 32 + 7;
cc->gdb_stop_before_watchpoint = true;
cc->debug_excp_handler = lm32_debug_excp_handler;
cc->disas_set_info = lm32_cpu_disas_set_info;
/*
* Reason: lm32_cpu_initfn() calls cpu_exec_init(), which saves