disas: add libvixl to support A64 disassembly
v2 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.
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
* if you have a visceral dislike of the idea of C++ in the QEMU binary now would be a good time to say OMG WTF BBQ
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
This patchset sits on top of target-arm.next.
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/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 +- 22 files changed, 6736 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/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
PATCH v2 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
@@ -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
PATCH v2 2/5 rules.mak: Link with C++ if we have a C++ compiler
In reply to Peter MaydellIf 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
@@ -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
PATCH v2 3/5 disas: Add subset of libvixl sources for A64 disassembler
In reply to Peter MaydellAdd 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/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 +++ 14 files changed, 6608 insertions(+) create mode 100644 disas/libvixl/LICENCE 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
@@ -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/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
26 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.
PATCH v2 4/5 disas/libvixl: Fix upstream libvixl compilation issues
In reply to Peter MaydellFix 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
@@ -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
@@ -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
@@ -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
PATCH v2 5/5 disas: Implement disassembly output for A64
In reply to Peter MaydellFrom: 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
@@ -4611,6 +4611,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -4029,7 +4029,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
Ping for review/testing/comments on this version, please?
thanks
-- PMM
Quoted 94 lines · Peter Maydell
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.
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
* if you have a visceral dislike of the idea of C++ in the QEMU binary now would be a good time to say OMG WTF BBQChanges 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 andaarch64.cinto 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 filesChanges 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 andaarch64.ca 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 hostsThis patchset sits on top of target-arm.next.
You can find a git tree here:
git://git.linaro.org/people/peter.maydell/qemu-arm.gita64-vixl
web UI:
https://git.linaro.org/people/peter.maydell/qemu-arm.git/shortlog/refs/heads/a64-vixlClaudio Fontana (1):
disas: Implement disassembly output for A64Peter 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 issuesconfigure | 4 + disas.c | 14 +- disas/Makefile.objs | 5 + disas/arm-a64.cc | 87 ++ disas/libvixl/LICENCE | 30 + disas/libvixl/Makefile.objs | 8 + 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 +- 22 files changed, 6736 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/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--
1.8.5
Richard Henderson
Reviewed-byQuoted 1 line · Peter Maydell
Ping for review/testing/comments on this version, please?
I skipped the contents of libvixl itself, but the configure and interface changes look ok to me.
r~
Quoted 99 lines
thanks
-- PMMQuoted 94 lines · Peter Maydell
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.
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
* if you have a visceral dislike of the idea of C++ in the QEMU binary now would be a good time to say OMG WTF BBQChanges 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 andaarch64.cinto 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 filesChanges 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 andaarch64.ca 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 hostsThis patchset sits on top of target-arm.next.
You can find a git tree here:
git://git.linaro.org/people/peter.maydell/qemu-arm.gita64-vixl
web UI:
https://git.linaro.org/people/peter.maydell/qemu-arm.git/shortlog/refs/heads/a64-vixlClaudio Fontana (1):
disas: Implement disassembly output for A64Peter 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 issuesconfigure | 4 + disas.c | 14 +- disas/Makefile.objs | 5 + disas/arm-a64.cc | 87 ++ disas/libvixl/LICENCE | 30 + disas/libvixl/Makefile.objs | 8 + 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 +- 22 files changed, 6736 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/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--
1.8.5
Quoted 1 line · Peter Maydell
Ping for review/testing/comments on this version, please?
I still dislike the idea of importing so much code in particular for something that is incomplete: as far as I can see, AdvSIMD instructions are not supported. The very least that should be done would be to add a file that gives a rough status of what is and what is not implemented.
And what if the vixl authors never implement AdvSIMD? This is the most difficult part of Aarch64 to disassemble (integer and FP instructions are really easy to disassemble). Will someone add these and will vixl authors accept the changes or will we then start diverging from vixl implementation? Is vixl even still supported or in development (no commit for 6 months)?
We need an Aarch64 disassembler, but IMHO these questions should be answered before proceeding.
Laurent
Quoted 99 lines
thanks
-- PMMQuoted 94 lines · Peter Maydell
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.
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
* if you have a visceral dislike of the idea of C++ in the QEMU binary now would be a good time to say OMG WTF BBQChanges 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 andaarch64.cinto 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 filesChanges 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 andaarch64.ca 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 hostsThis patchset sits on top of target-arm.next.
You can find a git tree here:
git://git.linaro.org/people/peter.maydell/qemu-arm.gita64-vixl
web UI:
https://git.linaro.org/people/peter.maydell/qemu-arm.git/shortlog/refs/heads/a64-vixlClaudio Fontana (1):
disas: Implement disassembly output for A64Peter 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 issuesconfigure | 4 + disas.c | 14 +- disas/Makefile.objs | 5 + disas/arm-a64.cc | 87 ++ disas/libvixl/LICENCE | 30 + disas/libvixl/Makefile.objs | 8 + 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 +- 22 files changed, 6736 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/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--
1.8.5
Quoted 9 lines · Laurent Desnogues
Quoted 1 line · Peter Maydell
Ping for review/testing/comments on this version, please?
I still dislike the idea of importing so much code in particular for something that is incomplete: as far as I can see, AdvSIMD instructions are not supported. The very least that should be done would be to add a file that gives a rough status of what is and what is not implemented.
I can add some text to a brief README file, sure.
Quoted 6 lines
And what if the vixl authors never implement AdvSIMD? This is the most difficult part of Aarch64 to disassemble (integer and FP instructions are really easy to disassemble). Will someone add these and will vixl authors accept the changes or will we then start diverging from vixl implementation? Is vixl even still supported or in development (no commit for 6 months)?
As I understand the situation, it is supported but the model is more "we'll push out a release occasionally when we've done a big chunk of work" rather than a continuously updated public-facing git tree.
This is no worse at all (in fact better) than the situation we have with the binutils disassemblers in the tree at the moment -- those are effectively totally unmaintained by their upstream as a result of the GPL2/GPL3 split.
I agree that it would be nice if we supported the SIMD instructions in the disassembler. Adding them to vixl should be no worse than adding them to anything else, and I'd rather have a disassembler that supported at least the integer set than none at all.
thanks
-- PMM
Quoted 30 lines · Peter Maydell
Quoted 9 lines · Laurent Desnogues
Quoted 1 line · Peter Maydell
Ping for review/testing/comments on this version, please?
I still dislike the idea of importing so much code in particular for something that is incomplete: as far as I can see, AdvSIMD instructions are not supported. The very least that should be done would be to add a file that gives a rough status of what is and what is not implemented.
I can add some text to a brief README file, sure.
Quoted 6 lines
And what if the vixl authors never implement AdvSIMD? This is the most difficult part of Aarch64 to disassemble (integer and FP instructions are really easy to disassemble). Will someone add these and will vixl authors accept the changes or will we then start diverging from vixl implementation? Is vixl even still supported or in development (no commit for 6 months)?
As I understand the situation, it is supported but the model is more "we'll push out a release occasionally when we've done a big chunk of work" rather than a continuously updated public-facing git tree.
This is no worse at all (in fact better) than the situation we have with the binutils disassemblers in the tree at the moment -- those are effectively totally unmaintained by their upstream as a result of the GPL2/GPL3 split.
Quoted 5 lines
I agree that it would be nice if we supported the SIMD instructions in the disassembler. Adding them to vixl should be no worse than adding them to anything else, and I'd rather have a disassembler that supported at least the integer set than none at all.
That looks OK to me.
Thanks,
Laurent
Quoted 31 lines · Laurent Desnogues
Quoted 30 lines · Peter Maydell
Quoted 9 lines · Laurent Desnogues
Quoted 1 line · Peter Maydell
Ping for review/testing/comments on this version, please?
I still dislike the idea of importing so much code in particular for something that is incomplete: as far as I can see, AdvSIMD instructions are not supported. The very least that should be done would be to add a file that gives a rough status of what is and what is not implemented.
I can add some text to a brief README file, sure.
Quoted 6 lines
And what if the vixl authors never implement AdvSIMD? This is the most difficult part of Aarch64 to disassemble (integer and FP instructions are really easy to disassemble). Will someone add these and will vixl authors accept the changes or will we then start diverging from vixl implementation? Is vixl even still supported or in development (no commit for 6 months)?
As I understand the situation, it is supported but the model is more "we'll push out a release occasionally when we've done a big chunk of work" rather than a continuously updated public-facing git tree.
This is no worse at all (in fact better) than the situation we have with the binutils disassemblers in the tree at the moment -- those are effectively totally unmaintained by their upstream as a result of the GPL2/GPL3 split.
Quoted 7 lines
Quoted 5 lines
I agree that it would be nice if we supported the SIMD instructions in the disassembler. Adding them to vixl should be no worse than adding them to anything else, and I'd rather have a disassembler that supported at least the integer set than none at all.
That looks OK to me.
Thanks. Here's some proposed text for a disas/libvixl/README:
===begin===
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.
===endit===
(borrowed from https://github.com/armvixl/vixl/README.md
and edited to remove things that only really apply to the simulator).
thanks
-- PMM