Skip to contentSkip to conversation

disas: add libvixl to support A64 disassembly

PATCH In review Peter Maydell 3 participants 12 messages Feb 5, 2014 – Feb 6, 2014

lore
Share & tools
lore
#0 lore raw

v3 cover disas: add libvixl to support A64 disassembly

Hi. This is a rebased and mildly cleaned up version of Claudio's RFC patchset from last year to add libvixl to QEMU and use it for A64 disassembly.

Since this has now got review and the only change is adding the README I'm planning to put it in my next target-arm pull request.

Paolo: just a heads-up: I have a feeling the rules.mak changes clash slightly with the ones in your modules patches.

NOTE NOTE NOTE
* we now link with g++, not gcc (even if the target doesn't happen to need the A64 disassembler, since it's a bit hard to tell whether there's a C++-source .o file in the link)
* I've tested Linux (including static link of linux-user) and MacOS hosts, but not Windows

Changes v2 -> v3:
* added a README clarifying that libvixl's disassembly support is not complete and that contributions should go to libvixl upstream first for preference

Changes v1 -> v2:
* fixed minor libvixl bugs that meant it didn't build on 32 bit hosts or on Windows
* only import the files we need from libvixl, rather than pulling in 10000 lines of code we never even compile
* merge aarch64-cxx.cc and aarch64.c into one file
* rename 'aarch64' to 'A64' since the instruction set we're disassembling here is named A64, not AArch64
* tidied the makefiles a little so we only apply the libvixl specific flags to those files

Changes RFC -> v1:
* some support for C++ compilation is already in master, so the rules.mak changes are smaller and simpler
* I've fixed the output to better fit in a qemu debug log trace
* I simplified the interface between aarch64-cxx.cc and aarch64.c a little bit
* correctly handle the "no C++ compiler, so no A64 disassembler" build case
* added support for using this as a disassembler for A64 targets as well as hosts

You can find a git tree here:
git://git.linaro.org/people/peter.maydell/qemu-arm.git a64-vixl
web UI:
https://git.linaro.org/people/peter.maydell/qemu-arm.git/shortlog/refs/heads/a64-vixl

Claudio Fontana (1):
disas: Implement disassembly output for A64

Peter Maydell (4):
rules.mak: Support .cc as a C++ source file suffix rules.mak: Link with C++ if we have a C++ compiler
disas: Add subset of libvixl sources for A64 disassembler disas/libvixl: Fix upstream libvixl compilation issues

 configure                             |    4 +
 disas.c                               |   14 +-
 disas/Makefile.objs                   |    5 +
 disas/arm-a64.cc                      |   87 ++
 disas/libvixl/LICENCE                 |   30 +
 disas/libvixl/Makefile.objs           |    8 +
 disas/libvixl/README                  |   12 +
 disas/libvixl/a64/assembler-a64.h     | 1784 +++++++++++++++++++++++++++++++++
 disas/libvixl/a64/constants-a64.h     | 1104 ++++++++++++++++++++
 disas/libvixl/a64/cpu-a64.h           |   56 ++
 disas/libvixl/a64/decoder-a64.cc      |  712 +++++++++++++
 disas/libvixl/a64/decoder-a64.h       |  198 ++++
 disas/libvixl/a64/disasm-a64.cc       | 1678 +++++++++++++++++++++++++++++++
 disas/libvixl/a64/disasm-a64.h        |  109 ++
 disas/libvixl/a64/instructions-a64.cc |  238 +++++
 disas/libvixl/a64/instructions-a64.h  |  344 +++++++
 disas/libvixl/globals.h               |   65 ++
 disas/libvixl/platform.h              |   43 +
 disas/libvixl/utils.cc                |  120 +++
 disas/libvixl/utils.h                 |  126 +++
 include/disas/bfd.h                   |    1 +
 rules.mak                             |   14 +-
 target-arm/translate-a64.c            |    2 +-
 23 files changed, 6748 insertions(+), 6 deletions(-)
 create mode 100644 disas/arm-a64.cc
 create mode 100644 disas/libvixl/LICENCE
 create mode 100644 disas/libvixl/Makefile.objs
 create mode 100644 disas/libvixl/README
 create mode 100644 disas/libvixl/a64/assembler-a64.h
 create mode 100644 disas/libvixl/a64/constants-a64.h
 create mode 100644 disas/libvixl/a64/cpu-a64.h
 create mode 100644 disas/libvixl/a64/decoder-a64.cc
 create mode 100644 disas/libvixl/a64/decoder-a64.h
 create mode 100644 disas/libvixl/a64/disasm-a64.cc
 create mode 100644 disas/libvixl/a64/disasm-a64.h
 create mode 100644 disas/libvixl/a64/instructions-a64.cc
 create mode 100644 disas/libvixl/a64/instructions-a64.h
 create mode 100644 disas/libvixl/globals.h
 create mode 100644 disas/libvixl/platform.h
 create mode 100644 disas/libvixl/utils.cc
 create mode 100644 disas/libvixl/utils.h
Signature · 1 line
1.8.5
#1 lore raw

PATCH v3 1/5 rules.mak: Support .cc as a C++ source file suffix

The A64 disassembler libvixl uses .cc as its suffix for C++ source files, so add support for it (we already support .cpp).

---
 rules.mak | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
rules.mak +5 -1
index 49edb9b..cd9187e 100644
@@ -8,6 +8,7 @@ MAKEFLAGS += -rR
 %.d:
 %.h:
 %.c:
+%.cc:
 %.cpp:
 %.m:
 %.mak:
@@ -54,6 +55,9 @@ endif
 %.o: %.asm
 	$(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<,"  AS    $(TARGET_DIR)$@")
 
+%.o: %.cc
+	$(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CXX   $(TARGET_DIR)$@")
+
 %.o: %.cpp
 	$(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CXX   $(TARGET_DIR)$@")
 
@@ -77,7 +81,7 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
 cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
               >/dev/null 2>&1 && echo OK), $2, $3)
 
-VPATH_SUFFIXES = %.c %.h %.S %.cpp %.m %.mak %.texi %.sh %.rc
+VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc
 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
 
 # find-in-path
Signature · 1 line
1.8.5
#2 lore raw

PATCH v3 2/5 rules.mak: Link with C++ if we have a C++ compiler

In reply to Peter Maydell

If we have a C++ compiler available, link with it, because we might be linking some C++ files in. This allows us to include C++ object files in the QEMU binary proper.

---
 rules.mak | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
rules.mak +6 -2
index cd9187e..391d6eb 100644
@@ -27,8 +27,12 @@ QEMU_INCLUDES += -I$(<D) -I$(@D)
 %.o: %.rc
 	$(call quiet-command,$(WINDRES) -I. -o $@ $<,"  RC    $(TARGET_DIR)$@")
 
+# If we have a CXX we might have some C++ objects, in which case we
+# must link with the C++ compiler, not the plain C compiler.
+LINKPROG = $(or $(CXX),$(CC))
+
 ifeq ($(LIBTOOL),)
-LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
+LINK = $(call quiet-command,$(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
        $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \
        $(LIBS),"  LINK  $(TARGET_DIR)$@")
 else
@@ -42,7 +46,7 @@ LIBTOOL += $(if $(V),,--quiet)
 
 LINK = $(call quiet-command,\
        $(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \
-       )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
+       )$(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
        $(sort $(filter %.o, $1)) $(filter-out %.o, $1) \
        $(if $(filter %.lo %.la,$^),$(version-lobj-y),$(version-obj-y)) \
        $(if $(filter %.lo %.la,$^),$(LIBTOOLFLAGS)) \
Signature · 1 line
1.8.5
#3 lore raw

PATCH v3 3/5 disas: Add subset of libvixl sources for A64 disassembler

In reply to Peter Maydell

Add the subset of the libvixl sources that are needed for the A64 disassembler support. These sources come from
https://github.com/armvixl/vixl commit 578645f14e122d2b which is VIXL release 1.1.

---
 disas/libvixl/LICENCE                 |   30 +
 disas/libvixl/README                  |   12 +
 disas/libvixl/a64/assembler-a64.h     | 1784 +++++++++++++++++++++++++++++++++
 disas/libvixl/a64/constants-a64.h     | 1104 ++++++++++++++++++++
 disas/libvixl/a64/cpu-a64.h           |   56 ++
 disas/libvixl/a64/decoder-a64.cc      |  712 +++++++++++++
 disas/libvixl/a64/decoder-a64.h       |  198 ++++
 disas/libvixl/a64/disasm-a64.cc       | 1678 +++++++++++++++++++++++++++++++
 disas/libvixl/a64/disasm-a64.h        |  109 ++
 disas/libvixl/a64/instructions-a64.cc |  238 +++++
 disas/libvixl/a64/instructions-a64.h  |  344 +++++++
 disas/libvixl/globals.h               |   66 ++
 disas/libvixl/platform.h              |   43 +
 disas/libvixl/utils.cc                |  120 +++
 disas/libvixl/utils.h                 |  126 +++
 15 files changed, 6620 insertions(+)
 create mode 100644 disas/libvixl/LICENCE
 create mode 100644 disas/libvixl/README
 create mode 100644 disas/libvixl/a64/assembler-a64.h
 create mode 100644 disas/libvixl/a64/constants-a64.h
 create mode 100644 disas/libvixl/a64/cpu-a64.h
 create mode 100644 disas/libvixl/a64/decoder-a64.cc
 create mode 100644 disas/libvixl/a64/decoder-a64.h
 create mode 100644 disas/libvixl/a64/disasm-a64.cc
 create mode 100644 disas/libvixl/a64/disasm-a64.h
 create mode 100644 disas/libvixl/a64/instructions-a64.cc
 create mode 100644 disas/libvixl/a64/instructions-a64.h
 create mode 100644 disas/libvixl/globals.h
 create mode 100644 disas/libvixl/platform.h
 create mode 100644 disas/libvixl/utils.cc
 create mode 100644 disas/libvixl/utils.h
disas/libvixl/LICENCE new file +30 -0
new file mode 100644
index 0000000..b7e160a
@@ -0,0 +1,30 @@
+LICENCE
+=======
+
+The software in this repository is covered by the following licence.
+
+// Copyright 2013, ARM Limited
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+//   * Redistributions of source code must retain the above copyright notice,
+//     this list of conditions and the following disclaimer.
+//   * Redistributions in binary form must reproduce the above copyright notice,
+//     this list of conditions and the following disclaimer in the documentation
+//     and/or other materials provided with the distribution.
+//   * Neither the name of ARM Limited nor the names of its contributors may be
+//     used to endorse or promote products derived from this software without
+//     specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
disas/libvixl/README new file +12 -0
new file mode 100644
index 0000000..96814a5
@@ -0,0 +1,12 @@
+
+The code in this directory is a subset of libvixl:
+ https://github.com/armvixl/vixl
+(specifically, it is the set of files needed for disassembly only,
+taken from libvixl 1.1).
+Bugfixes should preferably be sent upstream initially.
+
+The disassembler does not currently support the entire A64 instruction
+set. Notably:
+ * No Advanced SIMD support.
+ * Limited support for system instructions.
+ * A few miscellaneous integer and floating point instructions are missing.
disas/libvixl/a64/assembler-a64.h new file +1784 -0

1,784 lines not on this page · raw message

disas/libvixl/a64/constants-a64.h new file +1104 -0

1,104 lines not on this page · raw message

disas/libvixl/a64/cpu-a64.h new file +56 -0

56 lines not on this page · raw message

disas/libvixl/a64/decoder-a64.cc new file +712 -0

14 lines not on this page · raw message

disas/libvixl/a64/decoder-a64.h new file +198 -0

198 lines not on this page · raw message

disas/libvixl/a64/disasm-a64.cc new file +1678 -0

1,678 lines not on this page · raw message

disas/libvixl/a64/disasm-a64.h new file +109 -0

109 lines not on this page · raw message

disas/libvixl/a64/instructions-a64.cc new file +238 -0

238 lines not on this page · raw message

disas/libvixl/a64/instructions-a64.h new file +344 -0

344 lines not on this page · raw message

disas/libvixl/globals.h new file +66 -0

66 lines not on this page · raw message

disas/libvixl/platform.h new file +43 -0

43 lines not on this page · raw message

disas/libvixl/utils.cc new file +120 -0

120 lines not on this page · raw message

disas/libvixl/utils.h new file +126 -0

126 lines not on this page · raw message

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

Signature · 1 line
1.8.5

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

#4 lore raw

PATCH v3 4/5 disas/libvixl: Fix upstream libvixl compilation issues

In reply to Peter Maydell

Fix various minor issues with upstream libvixl so that it will compile successfully on the platforms QEMU cares about:
* remove unused GBytes constant (it clashes with the glib headers)
* fix suffixes on constants to use 'LL' for 64 bit constants so we can compile on 32 bit hosts

---
 disas/libvixl/a64/instructions-a64.h | 30 +++++++++++++++---------------
 disas/libvixl/globals.h              |  1 -
 disas/libvixl/utils.h                |  4 ++--
 3 files changed, 17 insertions(+), 18 deletions(-)
disas/libvixl/a64/instructions-a64.h +15 -15
index 0f31fcd..ba9068c 100644
@@ -53,19 +53,19 @@ const unsigned kSRegSizeInBytes = kSRegSize / 8;
 const unsigned kDRegSize = 64;
 const unsigned kDRegSizeLog2 = 6;
 const unsigned kDRegSizeInBytes = kDRegSize / 8;
-const int64_t kWRegMask = 0x00000000ffffffffL;
-const int64_t kXRegMask = 0xffffffffffffffffL;
-const int64_t kSRegMask = 0x00000000ffffffffL;
-const int64_t kDRegMask = 0xffffffffffffffffL;
-const int64_t kXSignMask = 0x1L << 63;
-const int64_t kWSignMask = 0x1L << 31;
+const int64_t kWRegMask = 0x00000000ffffffffLL;
+const int64_t kXRegMask = 0xffffffffffffffffLL;
+const int64_t kSRegMask = 0x00000000ffffffffLL;
+const int64_t kDRegMask = 0xffffffffffffffffLL;
+const int64_t kXSignMask = 0x1LL << 63;
+const int64_t kWSignMask = 0x1LL << 31;
 const int64_t kByteMask = 0xffL;
 const int64_t kHalfWordMask = 0xffffL;
-const int64_t kWordMask = 0xffffffffL;
-const uint64_t kXMaxUInt = 0xffffffffffffffffUL;
-const uint64_t kWMaxUInt = 0xffffffffUL;
-const int64_t kXMaxInt = 0x7fffffffffffffffL;
-const int64_t kXMinInt = 0x8000000000000000L;
+const int64_t kWordMask = 0xffffffffLL;
+const uint64_t kXMaxUInt = 0xffffffffffffffffULL;
+const uint64_t kWMaxUInt = 0xffffffffULL;
+const int64_t kXMaxInt = 0x7fffffffffffffffLL;
+const int64_t kXMinInt = 0x8000000000000000LL;
 const int32_t kWMaxInt = 0x7fffffff;
 const int32_t kWMinInt = 0x80000000;
 const unsigned kLinkRegCode = 30;
@@ -81,16 +81,16 @@ const unsigned kFloatExponentBits = 8;
 
 const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000);
 const float kFP32NegativeInfinity = rawbits_to_float(0xff800000);
-const double kFP64PositiveInfinity = rawbits_to_double(0x7ff0000000000000UL);
-const double kFP64NegativeInfinity = rawbits_to_double(0xfff0000000000000UL);
+const double kFP64PositiveInfinity = rawbits_to_double(0x7ff0000000000000ULL);
+const double kFP64NegativeInfinity = rawbits_to_double(0xfff0000000000000ULL);
 
 // This value is a signalling NaN as both a double and as a float (taking the
 // least-significant word).
-static const double kFP64SignallingNaN = rawbits_to_double(0x7ff000007f800001);
+static const double kFP64SignallingNaN = rawbits_to_double(0x7ff000007f800001ULL);
 static const float kFP32SignallingNaN = rawbits_to_float(0x7f800001);
 
 // A similar value, but as a quiet NaN.
-static const double kFP64QuietNaN = rawbits_to_double(0x7ff800007fc00001);
+static const double kFP64QuietNaN = rawbits_to_double(0x7ff800007fc00001ULL);
 static const float kFP32QuietNaN = rawbits_to_float(0x7fc00001);
 
 enum LSDataSize {
disas/libvixl/globals.h +0 -1
index 859ea69..a6a3fcc 100644
@@ -44,7 +44,6 @@ typedef uint8_t byte;
 
 const int KBytes = 1024;
 const int MBytes = 1024 * KBytes;
-const int GBytes = 1024 * MBytes;
 
   #define ABORT() printf("in %s, line %i", __FILE__, __LINE__); abort()
 #ifdef DEBUG
disas/libvixl/utils.h +2 -2
index 4e0b367..029341e 100644
@@ -36,7 +36,7 @@ namespace vixl {
 // Check number width.
 inline bool is_intn(unsigned n, int64_t x) {
   ASSERT((0 < n) && (n < 64));
-  int64_t limit = 1L << (n - 1);
+  int64_t limit = 1ULL << (n - 1);
   return (-limit <= x) && (x < limit);
 }
 
@@ -47,7 +47,7 @@ inline bool is_uintn(unsigned n, int64_t x) {
 
 inline unsigned truncate_to_intn(unsigned n, int64_t x) {
   ASSERT((0 < n) && (n < 64));
-  return (x & ((1L << n) - 1));
+  return (x & ((1ULL << n) - 1));
 }
 
 #define INT_1_TO_63_LIST(V)                                                    \
Signature · 1 line
1.8.5
#5 lore raw

PATCH v3 5/5 disas: Implement disassembly output for A64

In reply to Peter Maydell

From: Claudio Fontana <[email protected]>

Use libvixl to implement disassembly output in debug logs for A64, for use with both AArch64 hosts and targets.

[PMM:
* added support for target disassembly
* switched to custom QEMUDisassembler so the output format matches what QEMU expects
* make sure we correctly fall back to "just print hex" if we didn't build the AArch64 disassembler because of lack of a C++ compiler
* rename from 'aarch64' to 'arm-a64' because this is a disassembler for the A64 instruction set
* merge aarch64.c and aarch64-cxx.cc into one C++ file
* simplify the aarch64.c<->aarch64-cxx.cc interface]

---
 configure                   |  4 +++
 disas.c                     | 14 ++++++--
 disas/Makefile.objs         |  5 +++
 disas/arm-a64.cc            | 87 +++++++++++++++++++++++++++++++++++++++++++++
 disas/libvixl/Makefile.objs |  8 +++++
 include/disas/bfd.h         |  1 +
 target-arm/translate-a64.c  |  2 +-
 7 files changed, 118 insertions(+), 3 deletions(-)
 create mode 100644 disas/arm-a64.cc
 create mode 100644 disas/libvixl/Makefile.objs
configure +4 -0
index 236764a..8f3cc20 100755
@@ -4641,6 +4641,10 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
   arm)
     echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
     echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
+    if test -n "${cxx}"; then
+      echo "CONFIG_ARM_A64_DIS=y"  >> $config_target_mak
+      echo "CONFIG_ARM_A64_DIS=y"  >> config-all-disas.mak
+    fi
   ;;
   cris)
     echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
disas.c +12 -2
index 0203ef2..79e6944 100644
@@ -190,7 +190,7 @@ static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
 /* Disassemble this for me please... (debugging). 'flags' has the following
    values:
     i386 - 1 means 16 bit code, 2 means 64 bit code
-    arm  - bit 0 = thumb, bit 1 = reverse endian
+    arm  - bit 0 = thumb, bit 1 = reverse endian, bit 2 = A64
     ppc  - nonzero means little endian
     other targets - unused
  */
@@ -225,7 +225,15 @@ void target_disas(FILE *out, CPUArchState *env, target_ulong code,
     }
     print_insn = print_insn_i386;
 #elif defined(TARGET_ARM)
-    if (flags & 1) {
+    if (flags & 4) {
+        /* We might not be compiled with the A64 disassembler
+         * because it needs a C++ compiler; in that case we will
+         * fall through to the default print_insn_od case.
+         */
+#if defined(CONFIG_ARM_A64_DIS)
+        print_insn = print_insn_arm_a64;
+#endif
+    } else if (flags & 1) {
         print_insn = print_insn_thumb1;
     } else {
         print_insn = print_insn_arm;
@@ -356,6 +364,8 @@ void disas(FILE *out, void *code, unsigned long size)
 #elif defined(_ARCH_PPC)
     s.info.disassembler_options = (char *)"any";
     print_insn = print_insn_ppc;
+#elif defined(__aarch64__) && defined(CONFIG_ARM_A64_DIS)
+    print_insn = print_insn_arm_a64;
 #elif defined(__alpha__)
     print_insn = print_insn_alpha;
 #elif defined(__sparc__)
disas/Makefile.objs +5 -0
index 3b1e77a..41c2374 100644
@@ -1,5 +1,10 @@
+
 common-obj-$(CONFIG_ALPHA_DIS) += alpha.o
 common-obj-$(CONFIG_ARM_DIS) += arm.o
+common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o
+common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/
+libvixldir = $(SRC_PATH)/disas/libvixl
+$(obj)/arm-a64.o: QEMU_CFLAGS += -I$(libvixldir)
 common-obj-$(CONFIG_CRIS_DIS) += cris.o
 common-obj-$(CONFIG_HPPA_DIS) += hppa.o
 common-obj-$(CONFIG_I386_DIS) += i386.o
disas/arm-a64.cc new file +87 -0

87 lines not on this page · raw message

disas/libvixl/Makefile.objs new file +8 -0
new file mode 100644
index 0000000..0adb3ce
@@ -0,0 +1,8 @@
+libvixl_OBJS = utils.o \
+               a64/instructions-a64.o \
+               a64/decoder-a64.o \
+               a64/disasm-a64.o
+
+$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS += -I$(SRC_PATH)/disas/libvixl
+
+common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
include/disas/bfd.h +1 -0
index 803b6ef..8bd703c 100644
@@ -379,6 +379,7 @@ int print_insn_h8300            (bfd_vma, disassemble_info*);
 int print_insn_h8300h           (bfd_vma, disassemble_info*);
 int print_insn_h8300s           (bfd_vma, disassemble_info*);
 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*);
target-arm/translate-a64.c +1 -1
index 6c1ec1e..ee768f2 100644
@@ -7076,7 +7076,7 @@ done_generating:
         qemu_log("----------------\n");
         qemu_log("IN: %s\n", lookup_symbol(pc_start));
         log_target_disas(env, pc_start, dc->pc - pc_start,
-                         dc->thumb | (dc->bswap_code << 1));
+                         4 | (dc->bswap_code << 1));
         qemu_log("\n");
     }
 #endif
Signature · 1 line
1.8.5
#6 lore raw
In reply to Peter Maydell

Hi,

Quoted 4 lines · Peter Maydell

Changes v2 -> v3:
* added a README clarifying that libvixl's disassembly support is not complete and that contributions should go to libvixl upstream first for preference

Hmm, why aren't we simply using the binutils disassembler? It's also
(C) by ARM, so there shouldn't be any relicensing problems. And it does support AdvSIMD and system instructions.

Ciao,
Michael.

#7 lore raw
Quoted 3 lines · Michael Matz

Hmm, why aren't we simply using the binutils disassembler? It's also
(C) by ARM, so there shouldn't be any relicensing problems. And it does support AdvSIMD and system instructions.

It is GPLv3 which is not compatible with GPLv2 which QEMU requires. The contribution process for binutils involves a copyright assignment which means the FSF now have the copyright there, as I understand it.

thanks
-- PMM

#8 lore raw

Hi,

Quoted 9 lines · Peter Maydell
Quoted 3 lines · Michael Matz

Hmm, why aren't we simply using the binutils disassembler? It's also
(C) by ARM, so there shouldn't be any relicensing problems. And it does support AdvSIMD and system instructions.

It is GPLv3 which is not compatible with GPLv2 which QEMU requires. The contribution process for binutils involves a copyright assignment which means the FSF now have the copyright there, as I understand it.

The FSF always grants back rights on the contribution to the contributor. ARM could simply double-license their original contribution of the disassembler.

Ciao,
Michael.

#9 lore raw
Quoted 9 lines · Michael Matz

Hi,

Quoted 5 lines · Peter Maydell
Quoted 3 lines · Michael Matz

Hmm, why aren't we simply using the binutils disassembler? It's also
(C) by ARM, so there shouldn't be any relicensing problems. And it does support AdvSIMD and system instructions.

Quoted 8 lines
Quoted 4 lines

It is GPLv3 which is not compatible with GPLv2 which QEMU requires. The contribution process for binutils involves a copyright assignment which means the FSF now have the copyright there, as I understand it.

The FSF always grants back rights on the contribution to the contributor. ARM could simply double-license their original contribution of the disassembler.

Is dual licensing always possible given a grant-back? What if the contribution is a derivative of a GPL-3.0 licensed work?

Christopher

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.
#10 lore raw

Hi,

Quoted 6 lines · Christopher Covington
Quoted 3 lines

The FSF always grants back rights on the contribution to the contributor. ARM could simply double-license their original contribution of the disassembler.

Is dual licensing always possible given a grant-back? What if the contribution is a derivative of a GPL-3.0 licensed work?

Then it's not. I don't think that's the case with ARMs aarch64 disasm, but ultimately only ARM can say, and Peter already hinted that this all isn't possible. Which is a pity, duplicate work, inferior capability (at least for now), and such ...

Ciao,
Michael.

#11 lore raw
In reply to Michael Matz
Quoted 9 lines · Michael Matz
Quoted 4 lines · Peter Maydell

It is GPLv3 which is not compatible with GPLv2 which QEMU requires. The contribution process for binutils involves a copyright assignment which means the FSF now have the copyright there, as I understand it.

The FSF always grants back rights on the contribution to the contributor. ARM could simply double-license their original contribution of the disassembler.

I'm afraid that this is not, as I understand it,
feasible in this particular situation. Sorry.

thanks
-- PMM