[Qemu-devel] [PATCH 0/7] disas: Unify target_disas and monitor_disas

From:

Peter Crosthwaite

Subject:

[Qemu-devel] [PATCH 0/7] disas: Unify target_disas and monitor_disas

Date:

Mon, 4 May 2015 21:44:57 -0700

There two functions are mostly trying to do the same thing, which is
disassemble a target instruction (sequence) for printfing. The
architecture specific setup is largely duped between the two functions.
Most architectures are carbon copy and can be factored out without
issue (P1). Three architectures (microblaze, cris and ARM) are patched
to make the monitor_disas consistent with target_disas.
Microblaze is trivial, the target_disas setup is directly applicable
to monitor_disas to bring in microblaze monitor disas support (P2).
Cris had a small hiccup, a patch is needed to handle monitor_disas's
0 buffer length (P3). Then cris is patched to enable monitor disas
in same way as microblaze (P4).
ARM is the harder. The vixl A64 disas was hardcoded to fprintf with
a statically inited output stream (matching target_disas). The vixl
printfery is patched to be runtime variable (P5). ARM is also missing
setting of the disas flags from monitor.c. Fixed in (P6). P7 bring
ARM monitor disassembly online (via unification as target_disas
implementation).
Two architectures remain unresolved. PPC has some diffs
between target_disas and monitor_disas. Alpha looks easier, but I have
no test case (can anyone link me a random elf or kernel? Doesn't need
to do anything meaningful other than enter execution of instructions).
Alpha sets the BFD for target_disas but not monitor_disas? Should it
just always set the BFD? That is this:
s.info.mach = bfd_mach_alpha_ev6;
PPC sets the disassembler_options to "any" but only for target_disas.
s.info.disassembler_options = (char *)"any";
Can/should this be applied to monitor disas to remove the diff?
Regards,
Peter
Peter Crosthwaite (7):
disas: Create factored out fn for monitor and target disas
disas: microblaze: Migrate setup to common code
disas: cris: Fix 0 buffer length case
disas: cris: Migrate setup to common code
disas: arm-a64: Make printfer and stream variable
monitor: "i": Add ARM specifics
disas: arm: Use target_disas impl for monitor
disas.c | 202 ++++++++++++++++++++++++-------------------------------
disas/arm-a64.cc | 22 ++++--
disas/cris.c | 6 +-
monitor.c | 11 +++
4 files changed, 118 insertions(+), 123 deletions(-)
--
1.9.1