From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6ZD-0006ww-Nj for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZE6Z8-0008SD-94 for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:31 -0400 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:34363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6Z7-0008RV-Uc for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:26 -0400 Received: by pabvl15 with SMTP id vl15so187481570pab.1 for ; Sat, 11 Jul 2015 19:00:25 -0700 (PDT) From: Peter Crosthwaite Date: Sat, 11 Jul 2015 19:00:04 -0700 Message-Id: <50def3c16a368c2d5157a2bc18ab604ec6ecc914.1436665556.git.crosthwaite.peter@gmail.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 7/8] disas: mips: 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 , Leon Alrae , afaerber@suse.de, Aurelien Jarno , Peter Crosthwaite From: Peter Crosthwaite Move the target_disas() mips specifics to the QOM disas_set_info hook and delete the #ifdef specific code in disas.c. Cc: Aurelien Jarno Cc: Leon Alrae Signed-off-by: Peter Crosthwaite --- Testing: mips-test$ ./run-qemu -d in_asm -S 2> err QEMU 2.3.90 monitor - type 'help' for more information (qemu) x/i 0xbfc00000 0xbfc00000: j 0xbfc00580 (qemu) c (qemu) q mips-test$ more err IN: 0xbfc00000: j 0xbfc00580 0xbfc00004: nop IN: 0xbfc00580: li a0,2 0xbfc00584: lui sp,0x8000 ... --- disas.c | 12 ------------ target-mips/cpu.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/disas.c b/disas.c index eee369e..28decc9 100644 --- a/disas.c +++ b/disas.c @@ -238,12 +238,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_MIPS) -#ifdef TARGET_WORDS_BIGENDIAN - s.info.print_insn = print_insn_big_mips; -#else - s.info.print_insn = print_insn_little_mips; -#endif #elif defined(TARGET_ALPHA) s.info.mach = bfd_mach_alpha_ev6; s.info.print_insn = print_insn_alpha; @@ -445,12 +439,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu, s.info.endian = BFD_ENDIAN_LITTLE; } s.info.print_insn = print_insn_ppc; -#elif defined(TARGET_MIPS) -#ifdef TARGET_WORDS_BIGENDIAN - s.info.print_insn = print_insn_big_mips; -#else - s.info.print_insn = print_insn_little_mips; -#endif #endif if (!s.info.print_insn) { monitor_printf(mon, "0x" TARGET_FMT_lx diff --git a/target-mips/cpu.c b/target-mips/cpu.c index 4027d0f..83ab2b0 100644 --- a/target-mips/cpu.c +++ b/target-mips/cpu.c @@ -97,6 +97,14 @@ static void mips_cpu_reset(CPUState *s) #endif } +static void mips_cpu_disas_set_info(CPUState *s, disassemble_info *info) { +#ifdef TARGET_WORDS_BIGENDIAN + info->print_insn = print_insn_big_mips; +#else + info->print_insn = print_insn_little_mips; +#endif +} + static void mips_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); @@ -153,6 +161,8 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->gdb_num_core_regs = 73; cc->gdb_stop_before_watchpoint = true; + + cc->disas_set_info = mips_cpu_disas_set_info; } static const TypeInfo mips_cpu_type_info = { -- 1.9.1