qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: qemu-devel@nongnu.org
Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>,
	Leon Alrae <leon.alrae@imgtec.com>,
	afaerber@suse.de, Aurelien Jarno <aurelien@aurel32.net>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: [Qemu-devel] [PATCH 7/8] disas: mips: QOMify target specific disas setup
Date: Sat, 11 Jul 2015 19:00:04 -0700	[thread overview]
Message-ID: <50def3c16a368c2d5157a2bc18ab604ec6ecc914.1436665556.git.crosthwaite.peter@gmail.com> (raw)
In-Reply-To: <cover.1436665556.git.crosthwaite.peter@gmail.com>
In-Reply-To: <cover.1436665556.git.crosthwaite.peter@gmail.com>

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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 <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
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

  parent reply	other threads:[~2015-07-12  2:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-12  1:59 [Qemu-devel] [PATCH 0/8] Disas QOMification, round 2 Peter Crosthwaite
2015-07-12  1:59 ` [Qemu-devel] [PATCH 1/8] disas: s390x: QOMify target specific disas setup Peter Crosthwaite
2015-08-16  2:39   ` Peter Crosthwaite
2015-07-12  1:59 ` [Qemu-devel] [PATCH 2/8] disas: moxie: " Peter Crosthwaite
2015-07-12  2:00 ` [Qemu-devel] [PATCH 3/8] disas: m68k: " Peter Crosthwaite
2015-07-12  8:43   ` Laurent Vivier
2015-07-13  3:58   ` Greg Ungerer
2015-07-12  2:00 ` [Qemu-devel] [PATCH 4/8] disas: sparc: " Peter Crosthwaite
2015-07-12  2:00 ` [Qemu-devel] [PATCH 5/8] disas: lm32: " Peter Crosthwaite
2015-07-12 10:06   ` Michael Walle
2015-07-12  2:00 ` [Qemu-devel] [PATCH 6/8] disas: sh4: " Peter Crosthwaite
2015-07-14 15:47   ` Aurelien Jarno
2015-07-12  2:00 ` Peter Crosthwaite [this message]
2015-07-13 16:00   ` [Qemu-devel] [PATCH 7/8] disas: mips: " Leon Alrae
2015-07-12  2:00 ` [Qemu-devel] [PATCH 8/8] disas: alpha: " Peter Crosthwaite
2015-08-16  2:40   ` Peter Crosthwaite
2015-07-12 12:18 ` [Qemu-devel] [PATCH 0/8] Disas QOMification, round 2 Andreas Färber
2015-08-16  2:38   ` Peter Crosthwaite
2015-08-23 19:22     ` Peter Crosthwaite
2015-08-27 22:47   ` Andreas Färber
2015-08-28  4:20     ` Richard Henderson
2015-08-28 15:46       ` Andreas Färber
2015-08-28 16:02         ` Peter Maydell
2015-08-28 16:19           ` Peter Crosthwaite
2015-08-28 16:22             ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50def3c16a368c2d5157a2bc18ab604ec6ecc914.1436665556.git.crosthwaite.peter@gmail.com \
    --to=crosthwaitepeter@gmail.com \
    --cc=afaerber@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=crosthwaite.peter@gmail.com \
    --cc=leon.alrae@imgtec.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).