From: Peter Crosthwaite <crosthwaitepe...@gmail.com> Move the target_disas() moxie specifics to the QOM disas_set_info hook and delete the #ifdef specific code in disas.c.
Cc: Anthony Green <gr...@moxielogic.com> Signed-off-by: Peter Crosthwaite <crosthwaite.pe...@gmail.com> --- I don't have any easy way to test this. Is there a simple binary image somewhere I can pass in to see disas of handful of instructions? --- disas.c | 6 ------ target-moxie/cpu.c | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/disas.c b/disas.c index e62c934..6c86129 100644 --- a/disas.c +++ b/disas.c @@ -257,9 +257,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_MOXIE) - s.info.mach = bfd_arch_moxie; - s.info.print_insn = print_insn_moxie; #elif defined(TARGET_LM32) s.info.mach = bfd_mach_lm32; s.info.print_insn = print_insn_lm32; @@ -477,9 +474,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_MOXIE) - s.info.mach = bfd_arch_moxie; - s.info.print_insn = print_insn_moxie; #elif defined(TARGET_LM32) s.info.mach = bfd_mach_lm32; s.info.print_insn = print_insn_lm32; diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c index 6b035aa..4044cca 100644 --- a/target-moxie/cpu.c +++ b/target-moxie/cpu.c @@ -48,6 +48,12 @@ static void moxie_cpu_reset(CPUState *s) tlb_flush(s, 1); } +static void moxie_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) +{ + info->mach = bfd_arch_moxie; + info->print_insn = print_insn_moxie; +} + static void moxie_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); @@ -114,6 +120,7 @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data) cc->get_phys_page_debug = moxie_cpu_get_phys_page_debug; cc->vmsd = &vmstate_moxie_cpu; #endif + cc->disas_set_info = moxie_cpu_disas_set_info; } static void moxielite_initfn(Object *obj) -- 1.9.1