Skip to contentSkip to conversation

Remove some of the old libopcode based disassemblers

RFC PATCH In review Thomas Huth 3 participants 10 messages Apr 12, 2022 – May 17, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Remove some of the old libopcode based disassemblers

Many of the disassemblers in the disas folder are based on old versions from the GNU tools (libopcode, GDB, ...) that were still licensed under the GPL v2. The GNU tools switched to GPL v3 at one point in time, so QEMU is stuck with the old versions, i.e. these files did not see much updates for new processors anymore. But for most architectures, we're preferring the Capstone disassembler now anyway, so the old libopcode disassemblers are also hardly used anymore.

I'm not 100% sure (thus this is marked as RFC), but I think we could simply drop the old disassemblers nowadays, and hardly anybody would miss them, since we now always embed capstone as a submodule anyway. Or is there still an advantage in keeping these old files around?

This RFC series tackles with s390, arm (32-bit) and i386 ... I wanted to get some feedback first, but if we agree that these can be removed, the sparc, mips and ppc disassemblers likely can be removed, too. (I think we should keep m68k.c since Capstone does not have support for Coldfire CPUs yet).

Thomas Huth (3):
disas: Remove old libopcode s390 disassembler
disas: Remove old libopcode arm disassembler
disas: Remove old libopcode i386 disassembler

 include/disas/dis-asm.h |    3 -
 disas.c                 |    3 -
 disas/arm.c             | 4012 -----------------------
 disas/i386.c            | 6771 ---------------------------------------
 disas/s390.c            | 1892 -----------
 target/arm/cpu.c        |    8 -
 target/i386/cpu.c       |    1 -
 target/s390x/cpu.c      |    1 -
 MAINTAINERS             |    6 -
 disas/meson.build       |    3 -
 10 files changed, 12700 deletions(-)
 delete mode 100644 disas/arm.c
 delete mode 100644 disas/i386.c
 delete mode 100644 disas/s390.c
Signature · 1 line
2.27.0
#1 lore raw

RFC PATCH 1/3 disas: Remove old libopcode s390 disassembler

Capstone should be superior to the old libopcode disassembler, so we can drop the old file nowadays.

---
 include/disas/dis-asm.h |    1 -
 disas/s390.c            | 1892 ---------------------------------------
 target/s390x/cpu.c      |    1 -
 MAINTAINERS             |    2 -
 disas/meson.build       |    1 -
 5 files changed, 1897 deletions(-)
 delete mode 100644 disas/s390.c
include/disas/dis-asm.h +0 -1
index fadf6a65ef..aebd23dc20 100644
@@ -450,7 +450,6 @@ int print_insn_d10v             (bfd_vma, disassemble_info*);
 int print_insn_v850             (bfd_vma, disassemble_info*);
 int print_insn_tic30            (bfd_vma, disassemble_info*);
 int print_insn_ppc              (bfd_vma, disassemble_info*);
-int print_insn_s390             (bfd_vma, disassemble_info*);
 int print_insn_crisv32          (bfd_vma, disassemble_info*);
 int print_insn_crisv10          (bfd_vma, disassemble_info*);
 int print_insn_microblaze       (bfd_vma, disassemble_info*);
disas/s390.c deleted +0 -1892

1,892 lines not on this page · raw message

target/s390x/cpu.c +0 -1
index ccdbaf84d5..c31bb2351f 100644
@@ -178,7 +178,6 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
 static void s390_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
 {
     info->mach = bfd_mach_s390_64;
-    info->print_insn = print_insn_s390;
     info->cap_arch = CS_ARCH_SYSZ;
     info->cap_insn_unit = 2;
     info->cap_insn_split = 6;
MAINTAINERS +0 -2
index 4ad2451e03..226fd877ba 100644
@@ -305,7 +305,6 @@ S: Maintained
 F: target/s390x/
 F: target/s390x/tcg
 F: hw/s390x/
-F: disas/s390.c
 F: tests/tcg/s390x/
 L: [email protected]
 
@@ -3307,7 +3306,6 @@ S390 TCG target
 M: Richard Henderson <[email protected]>
 S: Maintained
 F: tcg/s390/
-F: disas/s390.c
 L: [email protected]
 
 SPARC TCG target
disas/meson.build +0 -1
index 449f99e1de..e3e1b67923 100644
@@ -16,7 +16,6 @@ common_ss.add(when: 'CONFIG_NANOMIPS_DIS', if_true: files('nanomips.cpp'))
 common_ss.add(when: 'CONFIG_NIOS2_DIS', if_true: files('nios2.c'))
 common_ss.add(when: 'CONFIG_PPC_DIS', if_true: files('ppc.c'))
 common_ss.add(when: 'CONFIG_RISCV_DIS', if_true: files('riscv.c'))
-common_ss.add(when: 'CONFIG_S390_DIS', if_true: files('s390.c'))
 common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
 common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c'))
 common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c'))
Signature · 1 line
2.27.0
#2 lore raw

RFC PATCH 2/3 disas: Remove old libopcode arm disassembler

In reply to Thomas Huth

Capstone should be superior to the old libopcode disassembler, so we can drop the old file nowadays.

---
 include/disas/dis-asm.h |    1 -
 disas.c                 |    1 -
 disas/arm.c             | 4012 ---------------------------------------
 target/arm/cpu.c        |    8 -
 MAINTAINERS             |    2 -
 disas/meson.build       |    1 -
 6 files changed, 4025 deletions(-)
 delete mode 100644 disas/arm.c
include/disas/dis-asm.h +0 -1
index aebd23dc20..e857f0ae8b 100644
@@ -429,7 +429,6 @@ int print_insn_h8500            (bfd_vma, disassemble_info*);
 int print_insn_arm_a64          (bfd_vma, disassemble_info*);
 int print_insn_alpha            (bfd_vma, disassemble_info*);
 disassembler_ftype arc_get_disassembler (int, int);
-int print_insn_arm              (bfd_vma, disassemble_info*);
 int print_insn_sparc            (bfd_vma, disassemble_info*);
 int print_insn_big_a29k         (bfd_vma, disassemble_info*);
 int print_insn_little_a29k      (bfd_vma, disassemble_info*);
disas.c +0 -1
index 3dab4482d1..c8fe024ba0 100644
@@ -192,7 +192,6 @@ static void initialize_debug_host(CPUDebug *s)
     s->info.mach = bfd_mach_sparc_v9b;
 #elif defined(__arm__)
     /* TCG only generates code for arm mode.  */
-    s->info.print_insn = print_insn_arm;
     s->info.cap_arch = CS_ARCH_ARM;
 #elif defined(__MIPSEB__)
     s->info.print_insn = print_insn_big_mips;
disas/arm.c deleted +0 -4012

2,986 lines not on this page · raw message

target/arm/cpu.c +0 -8
index 5d4ca7a227..57f44784c7 100644

Lines of this file are not shown. View the raw message.

MAINTAINERS +0 -2
index 226fd877ba..28c5208fa3 100644

Lines of this file are not shown. View the raw message.

disas/meson.build +0 -1
index e3e1b67923..a6402e7e1c 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.27.0

Part of the diff is not shown here. View the raw message.

#3 lore raw

RFC PATCH 3/3 disas: Remove old libopcode i386 disassembler

In reply to Thomas Huth

Capstone should be superior to the old libopcode disassembler, so we can drop the old file nowadays.

---
 include/disas/dis-asm.h |    1 -
 disas.c                 |    2 -
 disas/i386.c            | 6771 ---------------------------------------
 target/i386/cpu.c       |    1 -
 MAINTAINERS             |    2 -
 disas/meson.build       |    1 -
 6 files changed, 6778 deletions(-)
 delete mode 100644 disas/i386.c
include/disas/dis-asm.h +0 -1
index e857f0ae8b..6484caca9e 100644
@@ -418,7 +418,6 @@ int print_insn_tci(bfd_vma, disassemble_info*);
 int print_insn_big_mips         (bfd_vma, disassemble_info*);
 int print_insn_little_mips      (bfd_vma, disassemble_info*);
 int print_insn_nanomips         (bfd_vma, disassemble_info*);
-int print_insn_i386             (bfd_vma, disassemble_info*);
 int print_insn_m68k             (bfd_vma, disassemble_info*);
 int print_insn_z8001            (bfd_vma, disassemble_info*);
 int print_insn_z8002            (bfd_vma, disassemble_info*);
disas.c +0 -2
index c8fe024ba0..d1f2b84704 100644
@@ -153,14 +153,12 @@ static void initialize_debug_host(CPUDebug *s)
     s->info.print_insn = print_insn_tci;
 #elif defined(__i386__)
     s->info.mach = bfd_mach_i386_i386;
-    s->info.print_insn = print_insn_i386;
     s->info.cap_arch = CS_ARCH_X86;
     s->info.cap_mode = CS_MODE_32;
     s->info.cap_insn_unit = 1;
     s->info.cap_insn_split = 8;
 #elif defined(__x86_64__)
     s->info.mach = bfd_mach_x86_64;
-    s->info.print_insn = print_insn_i386;
     s->info.cap_arch = CS_ARCH_X86;
     s->info.cap_mode = CS_MODE_64;
     s->info.cap_insn_unit = 1;
disas/i386.c deleted +0 -6771

2,979 lines not on this page · raw message

target/i386/cpu.c +0 -1
index cb6b5467d0..a2641e3ab2 100644

Lines of this file are not shown. View the raw message.

MAINTAINERS +0 -2
index 28c5208fa3..3e83e48ba9 100644

Lines of this file are not shown. View the raw message.

disas/meson.build +0 -1
index a6402e7e1c..b0d18b9d47 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.27.0

Part of the diff is not shown here. View the raw message.

Reviewed-by on the v1 series
#4 lore raw
In reply to Thomas Huth
Quoted 20 lines · Thomas Huth

Many of the disassemblers in the disas folder are based on old versions from the GNU tools (libopcode, GDB, ...) that were still licensed under the GPL v2. The GNU tools switched to GPL v3 at one point in time, so QEMU is stuck with the old versions, i.e. these files did not see much updates for new processors anymore. But for most architectures, we're preferring the Capstone disassembler now anyway, so the old libopcode disassemblers are also hardly used anymore.

I'm not 100% sure (thus this is marked as RFC), but I think we could simply drop the old disassemblers nowadays, and hardly anybody would miss them, since we now always embed capstone as a submodule anyway. Or is there still an advantage in keeping these old files around?

This RFC series tackles with s390, arm (32-bit) and i386 ... I wanted to get some feedback first, but if we agree that these can be removed, the sparc, mips and ppc disassemblers likely can be removed, too. (I think we should keep m68k.c since Capstone does not have support for Coldfire CPUs yet).

Quoted 5 lines

Thomas Huth (3):
disas: Remove old libopcode s390 disassembler
disas: Remove old libopcode arm disassembler
disas: Remove old libopcode i386 disassembler

r~

Reviewed-by Philippe Mathieu-Daudé on the v1 series
#5 lore raw
In reply to Thomas Huth
Quoted 25 lines · Thomas Huth

Many of the disassemblers in the disas folder are based on old versions from the GNU tools (libopcode, GDB, ...) that were still licensed under the GPL v2. The GNU tools switched to GPL v3 at one point in time, so QEMU is stuck with the old versions, i.e. these files did not see much updates for new processors anymore. But for most architectures, we're preferring the Capstone disassembler now anyway, so the old libopcode disassemblers are also hardly used anymore.

I'm not 100% sure (thus this is marked as RFC), but I think we could simply drop the old disassemblers nowadays, and hardly anybody would miss them, since we now always embed capstone as a submodule anyway. Or is there still an advantage in keeping these old files around?

This RFC series tackles with s390, arm (32-bit) and i386 ... I wanted to get some feedback first, but if we agree that these can be removed, the sparc, mips and ppc disassemblers likely can be removed, too. (I think we should keep m68k.c since Capstone does not have support for Coldfire CPUs yet).

Thomas Huth (3):
disas: Remove old libopcode s390 disassembler
disas: Remove old libopcode arm disassembler
disas: Remove old libopcode i386 disassembler

Quoted 5 lines
  disas/arm.c             | 4012 -----------------------
  disas/i386.c            | 6771 ---------------------------------------
  disas/s390.c            | 1892 -----------
  10 files changed, 12700 deletions(-)

o_O Nice!

#6 lore raw
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 28 lines · Thomas Huth

Many of the disassemblers in the disas folder are based on old versions from the GNU tools (libopcode, GDB, ...) that were still licensed under the GPL v2. The GNU tools switched to GPL v3 at one point in time, so QEMU is stuck with the old versions, i.e. these files did not see much updates for new processors anymore. But for most architectures, we're preferring the Capstone disassembler now anyway, so the old libopcode disassemblers are also hardly used anymore.

I'm not 100% sure (thus this is marked as RFC), but I think we could simply drop the old disassemblers nowadays, and hardly anybody would miss them, since we now always embed capstone as a submodule anyway. Or is there still an advantage in keeping these old files around?

This RFC series tackles with s390, arm (32-bit) and i386 ... I wanted to get some feedback first, but if we agree that these can be removed, the sparc, mips and ppc disassemblers likely can be removed, too. (I think we should keep m68k.c since Capstone does not have support for Coldfire CPUs yet).

Thomas Huth (3):
   disas: Remove old libopcode s390 disassembler
   disas: Remove old libopcode arm disassembler
   disas: Remove old libopcode i386 disassembler

  disas/arm.c             | 4012 ----------------------- disas/i386.c            | 6771 --------------------------------------- disas/s390.c            | 1892 -----------

Quoted 5 lines
Quoted 1 line
  10 files changed, 12700 deletions(-)

o_O Nice!

Thanks, just a little bit too late - it's in my current pull request already :-)

By the way, what about MIPS? Could MIPS be switched to Capstone, too, so that we could finally remove disas/mips.c ? (We're not using capstone there yet, and MIPS has so many flavours, big and little endian, 32- and 64-bit ... so that I'm unsure whether there was a reason for not using Capstone there, or whether it just hasn't been tried out yet?)

Thomas

#7 lore raw
Quoted 31 lines · Thomas Huth
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 28 lines · Thomas Huth

Many of the disassemblers in the disas folder are based on old versions from the GNU tools (libopcode, GDB, ...) that were still licensed under the GPL v2. The GNU tools switched to GPL v3 at one point in time, so QEMU is stuck with the old versions, i.e. these files did not see much updates for new processors anymore. But for most architectures, we're preferring the Capstone disassembler now anyway, so the old libopcode disassemblers are also hardly used anymore.

I'm not 100% sure (thus this is marked as RFC), but I think we could simply drop the old disassemblers nowadays, and hardly anybody would miss them, since we now always embed capstone as a submodule anyway. Or is there still an advantage in keeping these old files around?

This RFC series tackles with s390, arm (32-bit) and i386 ... I wanted to get some feedback first, but if we agree that these can be removed, the sparc, mips and ppc disassemblers likely can be removed, too. (I think we should keep m68k.c since Capstone does not have support for Coldfire CPUs yet).

Thomas Huth (3):
   disas: Remove old libopcode s390 disassembler
   disas: Remove old libopcode arm disassembler
   disas: Remove old libopcode i386 disassembler

  disas/arm.c             | 4012 ----------------------- disas/i386.c            | 6771 --------------------------------------- disas/s390.c            | 1892 -----------

Quoted 7 lines
Quoted 5 lines
Quoted 1 line
  10 files changed, 12700 deletions(-)

o_O Nice!

Thanks, just a little bit too late - it's in my current pull request already :-)

NP, trying to catch up.

Quoted 1 line

By the way, what about MIPS? Could MIPS be switched to Capstone, too, so that we could finally remove disas/mips.c ? (We're not using capstone there yet, and MIPS has so many flavours, big and little endian, 32- and 64-bit ... so that I'm unsure whether there was a reason for not using Capstone there, or whether it just hasn't been tried out yet?)

Last I remember is Richard saying "the capstone backend for mips is not in terribly good shape":
https://lore.kernel.org/qemu-devel/[email protected]/

My long-term hope is to switch to decodetree.

#8 lore raw

Capstone for MIPS (was: Re: [RFC PATCH 0/3] Remove some of the old libopcode based disassemblers)

Quoted 1 line · Philippe Mathieu-Daudé

On 9/5/22 15:18, Thomas Huth wrote:

[...]

Quoted 5 lines
Quoted 1 line

By the way, what about MIPS? Could MIPS be switched to Capstone, too, so that we could finally remove disas/mips.c ? (We're not using capstone there yet, and MIPS has so many flavours, big and little endian, 32- and 64-bit ... so that I'm unsure whether there was a reason for not using Capstone there, or whether it just hasn't been tried out yet?)

Last I remember is Richard saying "the capstone backend for mips is not in terribly good shape":
https://lore.kernel.org/qemu-devel/[email protected]/

That was in 2017, in the Capstone 3.x days ... maybe the situation has improved nowadays?

Thomas

#9 lore raw

Re: Capstone for MIPS (was: Re: [RFC PATCH 0/3] Remove some of the old libopcode based disassemblers)

Quoted 10 lines · Thomas Huth
Quoted 1 line · Philippe Mathieu-Daudé

On 9/5/22 15:18, Thomas Huth wrote:

[...]

Quoted 5 lines
Quoted 1 line

By the way, what about MIPS? Could MIPS be switched to Capstone, too, so that we could finally remove disas/mips.c ? (We're not using capstone there yet, and MIPS has so many flavours, big and little endian, 32- and 64-bit ... so that I'm unsure whether there was a reason for not using Capstone there, or whether it just hasn't been tried out yet?)

Last I remember is Richard saying "the capstone backend for mips is not in terribly good shape":
https://lore.kernel.org/qemu-devel/[email protected]/

That was in 2017, in the Capstone 3.x days ... maybe the situation has improved nowadays?

I don't see any substantive changes to the capstone mips backend since 2016. Almost all changes to arch/Mips since then are changes to function prototypes as the internal api evolves. I.e. just enough to keep it compiling.

r~