diff mbox

[8/8] disas: alpha: QOMify target specific disas setup

Message ID 21b172aab23848f86ff0d121c5d7cc14e8742374.1436665556.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite July 12, 2015, 2 a.m. UTC
From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

Move the target_disas() alpha specifics to the QOM disas_set_info hook
and delete the #ifdef specific code in disas.c.

This also makes monitor_disas() consistent with target_disas(), as
monitor_disas() was missing a set of the BFD (This was an omission from
commit b9bec751c8c8b08d8055da32306eb105db03031b).

Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
Testing:
$ ./alpha-softmmu/qemu-system-alpha -nographic -d in_asm -S 2> err
QEMU 2.3.90 monitor - type 'help' for more information
(qemu) info registers
     PC  fffffc0000000000
...
(qemu) x/i 0xfffffc0000000000
0xfffffc0000000000:  br gp,0xfffffc0000000004
(qemu) x/i 0xfffffc0000000004
0xfffffc0000000004:  ldah   gp,1(gp)
(qemu) c
(qemu) PCI: 00:00:0 class 0300 id 1013:00b8
PCI:   region 0: 10000000
PCI:   region 1: 12000000
PCI: 00:01:0 class 0200 id 8086:100e
PCI:   region 0: 12020000
PCI:   region 1: 0000c000
PCI: 00:02:0 class 0101 id 1095:0646
PCI:   region 0: 0000c040
PCI:   region 1: 0000c048
PCI:   region 3: 0000c04c
>>> QEMU: Terminated

$ more err
IN: __start
0xfffffc0000000000:  br gp,0xfffffc0000000004
0xfffffc0000000004:  ldah   gp,1(gp)
0xfffffc0000000008:  lda    gp,12108(gp)
0xfffffc000000000c:  hw_mtpr    gp,0x32
0xfffffc0000000010:  lda    t0,7
---
 disas.c            | 5 -----
 target-alpha/cpu.c | 8 ++++++++
 2 files changed, 8 insertions(+), 5 deletions(-)

Comments

Peter Crosthwaite Aug. 16, 2015, 2:40 a.m. UTC | #1
Ping!

On Sat, Jul 11, 2015 at 7:00 PM, Peter Crosthwaite
<crosthwaitepeter@gmail.com> wrote:
> From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
>
> Move the target_disas() alpha specifics to the QOM disas_set_info hook
> and delete the #ifdef specific code in disas.c.
>
> This also makes monitor_disas() consistent with target_disas(), as
> monitor_disas() was missing a set of the BFD (This was an omission from
> commit b9bec751c8c8b08d8055da32306eb105db03031b).
>
> Cc: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
> Testing:
> $ ./alpha-softmmu/qemu-system-alpha -nographic -d in_asm -S 2> err
> QEMU 2.3.90 monitor - type 'help' for more information
> (qemu) info registers
>      PC  fffffc0000000000
> ...
> (qemu) x/i 0xfffffc0000000000
> 0xfffffc0000000000:  br gp,0xfffffc0000000004
> (qemu) x/i 0xfffffc0000000004
> 0xfffffc0000000004:  ldah   gp,1(gp)
> (qemu) c
> (qemu) PCI: 00:00:0 class 0300 id 1013:00b8
> PCI:   region 0: 10000000
> PCI:   region 1: 12000000
> PCI: 00:01:0 class 0200 id 8086:100e
> PCI:   region 0: 12020000
> PCI:   region 1: 0000c000
> PCI: 00:02:0 class 0101 id 1095:0646
> PCI:   region 0: 0000c040
> PCI:   region 1: 0000c048
> PCI:   region 3: 0000c04c
>>>> QEMU: Terminated
>
> $ more err
> IN: __start
> 0xfffffc0000000000:  br gp,0xfffffc0000000004
> 0xfffffc0000000004:  ldah   gp,1(gp)
> 0xfffffc0000000008:  lda    gp,12108(gp)
> 0xfffffc000000000c:  hw_mtpr    gp,0x32
> 0xfffffc0000000010:  lda    t0,7
> ---
>  disas.c            | 5 -----
>  target-alpha/cpu.c | 8 ++++++++
>  2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/disas.c b/disas.c
> index 28decc9..4c1a129 100644
> --- a/disas.c
> +++ b/disas.c
> @@ -238,9 +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_ALPHA)
> -    s.info.mach = bfd_mach_alpha_ev6;
> -    s.info.print_insn = print_insn_alpha;
>  #endif
>      if (s.info.print_insn == NULL) {
>          s.info.print_insn = print_insn_od_target;
> @@ -422,8 +419,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
>          s.info.mach = bfd_mach_i386_i386;
>      }
>      s.info.print_insn = print_insn_i386;
> -#elif defined(TARGET_ALPHA)
> -    s.info.print_insn = print_insn_alpha;
>  #elif defined(TARGET_PPC)
>      if (flags & 0xFFFF) {
>          /* If we have a precise definition of the instruction set, use it. */
> diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
> index 421d7e5..49625cf 100644
> --- a/target-alpha/cpu.c
> +++ b/target-alpha/cpu.c
> @@ -46,6 +46,12 @@ static bool alpha_cpu_has_work(CPUState *cs)
>                                      | CPU_INTERRUPT_MCHK);
>  }
>
> +static void alpha_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
> +{
> +    info->mach = bfd_mach_alpha_ev6;
> +    info->print_insn = print_insn_alpha;
> +}
> +
>  static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
>  {
>      CPUState *cs = CPU(dev);
> @@ -298,6 +304,8 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
>      dc->vmsd = &vmstate_alpha_cpu;
>  #endif
>      cc->gdb_num_core_regs = 67;
> +
> +    cc->disas_set_info = alpha_cpu_disas_set_info;
>  }
>
>  static const TypeInfo alpha_cpu_type_info = {
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/disas.c b/disas.c
index 28decc9..4c1a129 100644
--- a/disas.c
+++ b/disas.c
@@ -238,9 +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_ALPHA)
-    s.info.mach = bfd_mach_alpha_ev6;
-    s.info.print_insn = print_insn_alpha;
 #endif
     if (s.info.print_insn == NULL) {
         s.info.print_insn = print_insn_od_target;
@@ -422,8 +419,6 @@  void monitor_disas(Monitor *mon, CPUState *cpu,
         s.info.mach = bfd_mach_i386_i386;
     }
     s.info.print_insn = print_insn_i386;
-#elif defined(TARGET_ALPHA)
-    s.info.print_insn = print_insn_alpha;
 #elif defined(TARGET_PPC)
     if (flags & 0xFFFF) {
         /* If we have a precise definition of the instruction set, use it. */
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 421d7e5..49625cf 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -46,6 +46,12 @@  static bool alpha_cpu_has_work(CPUState *cs)
                                     | CPU_INTERRUPT_MCHK);
 }
 
+static void alpha_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
+{
+    info->mach = bfd_mach_alpha_ev6;
+    info->print_insn = print_insn_alpha;
+}
+
 static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cs = CPU(dev);
@@ -298,6 +304,8 @@  static void alpha_cpu_class_init(ObjectClass *oc, void *data)
     dc->vmsd = &vmstate_alpha_cpu;
 #endif
     cc->gdb_num_core_regs = 67;
+
+    cc->disas_set_info = alpha_cpu_disas_set_info;
 }
 
 static const TypeInfo alpha_cpu_type_info = {