From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6Z2-0006il-Q7 for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZE6Yz-0008KP-9J for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:20 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:35066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6Yz-0008KJ-1k for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:17 -0400 Received: by pactm7 with SMTP id tm7so187829270pac.2 for ; Sat, 11 Jul 2015 19:00:16 -0700 (PDT) From: Peter Crosthwaite Date: Sat, 11 Jul 2015 18:59:59 -0700 Message-Id: <6a162fbb8e51e1a2f18b86cfcfd9db4b9cb57b86.1436665556.git.crosthwaite.peter@gmail.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 2/8] disas: moxie: QOMify target specific disas setup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Crosthwaite , afaerber@suse.de, Anthony Green , Peter Crosthwaite From: Peter Crosthwaite 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 Signed-off-by: Peter Crosthwaite --- 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