Skip to content

Commit

Permalink
disas: QOMify moxie specific disas setup
Browse files Browse the repository at this point in the history
Move the target_disas() moxie specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Cc: Anthony Green <green@moxielogic.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
pcrost authored and afaerber committed Oct 22, 2015
1 parent dbad6b7 commit 9f87a4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 0 additions & 6 deletions disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,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;
Expand Down Expand Up @@ -459,9 +456,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;
Expand Down
7 changes: 7 additions & 0 deletions target-moxie/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/*
* Reason: moxie_cpu_initfn() calls cpu_exec_init(), which saves
Expand Down

0 comments on commit 9f87a4c

Please sign in to comment.