aboutsummaryrefslogtreecommitdiff
path: root/include/opcode
diff options
context:
space:
mode:
authorFrancois H. Theron <francois.theron@netronome.com>2018-04-30 17:02:59 +0100
committerNick Clifton <nickc@redhat.com>2018-04-30 17:02:59 +0100
commitfe944acf8f858cfe6bcfd00670a88847a464717c (patch)
tree63cfbbb8631a3c6624f1263aa0608ea6c796c5c4 /include/opcode
parentd33bc52e51fdb6c464c1c8e8fdf9b2007b522b57 (diff)
downloadbinutils-fe944acf8f858cfe6bcfd00670a88847a464717c.zip
binutils-fe944acf8f858cfe6bcfd00670a88847a464717c.tar.gz
binutils-fe944acf8f858cfe6bcfd00670a88847a464717c.tar.bz2
This patch adds support to objdump for disassembly of NFP (Netronome Flow Processor) ELF files (.nffw) as well as some basic readelf support.
bfd * Makefile.am: Added NFP files to build. * archures.c: Added bfd_arch_nfp * config.bfd: Added NFP support. * configure.ac: Added NFP support. * cpu-nfp.c: New, for NFP support. * elf-bfd.h: Added elf_section_info() * elf64-nfp.c: New, for NFP support. * po/SRC-POTFILES.in: Added NFP source files. * targets.c: Added nfp_elf64_vec * bfd-in2.h: Regenerate. * Makefile.in: Regenerate. * configure: Regenerate. binutils* readelf.c: Very basic support for EM_NFP and its section types. * testsuite/binutils-all/nfp: New directory. * testsuite/binutils-all/nfp/objdump.exp: New file. Run new tests. * testsuite/binutils-all/nfp/test2_ctx8.d: New file. * testsuite/binutils-all/nfp/test2_no-pc_ctx4.d: New file. * testsuite/binutils-all/nfp/test1.d: New file. * testsuite/binutils-all/nfp/nfp6000.nffw: New file. * testsuite/binutils-all/nfp/test2_nfp6000.nffw: New file. * NEWS: Mention the new support. include * dis-asm.h: Added print_nfp_disassembler_options prototype. * elf/common.h: Added EM_NFP, officially assigned. See Google Group Generic System V Application Binary Interface. * elf/nfp.h: New, for NFP support. * opcode/nfp.h: New, for NFP support. opcodes Makefile.am: Added nfp-dis.c. configure.ac: Added bfd_nfp_arch. disassemble.h: Added print_insn_nfp prototype. disassemble.c: Added ARCH_nfp and call to print_insn_nfp nfp-dis.c: New, for NFP support. po/POTFILES.in: Added nfp-dis.c to the list. Makefile.in: Regenerate. configure: Regenerate.
Diffstat (limited to 'include/opcode')
-rw-r--r--include/opcode/nfp.h180
1 files changed, 180 insertions, 0 deletions
diff --git a/include/opcode/nfp.h b/include/opcode/nfp.h
new file mode 100644
index 0000000..6d9efaf
--- /dev/null
+++ b/include/opcode/nfp.h
@@ -0,0 +1,180 @@
+/* nfp.h. NFP opcode list.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ Contributed by Francois H. Theron <francois.theron@netronome.com>
+
+ This file is part of the GNU opcodes library.
+
+ GDB, GAS, and the GNU binutils are free software; you can redistribute
+ them and/or modify them under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either version 3,
+ or (at your option) any later version.
+
+ GDB, GAS, and the GNU binutils are distributed in the hope that they
+ will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; see the file COPYING3. If not, write to the Free
+ Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+#ifndef _NFP_H_
+#define _NFP_H_
+
+#include "bfd.h"
+#include "elf/nfp.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* The bfd_vma type has the description below, so we use that and BFD_VMA_FMT
+ instead of uint64_t or bfd_uint64_t.
+ "Represent a target address. Also used as a generic unsigned type
+ which is guaranteed to be big enough to hold any arithmetic types
+ we need to deal with."
+
+ We use ME versions for most of this rather than NFP family and revision
+ numbers. The version numbers are currently 2.7 and 2.8 and to avoid long
+ names with many underscores we'll just use 27 and 28 until some feature
+ number makes it necessary to do something different. */
+
+#define NFP_ME27_INSTR_MASK_CMD ((bfd_vma) 0x008000000000)
+#define NFP_ME27_INSTR_CMD ((bfd_vma) 0x000000000000)
+#define NFP_ME27_INSTR_IS_CMD(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_CMD) == NFP_ME27_INSTR_CMD)
+
+#define NFP_ME27_INSTR_MASK_ALU_SHF ((bfd_vma) 0x1ee000000000)
+#define NFP_ME27_INSTR_ALU_SHF ((bfd_vma) 0x008000000000)
+#define NFP_ME27_INSTR_IS_ALU_SHF(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_ALU_SHF) == NFP_ME27_INSTR_ALU_SHF)
+
+#define NFP_ME27_INSTR_MASK_ALU ((bfd_vma) 0x1ee000000000)
+#define NFP_ME27_INSTR_ALU ((bfd_vma) 0x00a000000000)
+#define NFP_ME27_INSTR_IS_ALU(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_ALU) == NFP_ME27_INSTR_ALU)
+
+#define NFP_ME27_INSTR_MASK_IMMED ((bfd_vma) 0x1ff900000000)
+#define NFP_ME27_INSTR_IMMED ((bfd_vma) 0x00f000000000)
+#define NFP_ME27_INSTR_IS_IMMED(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_IMMED) == NFP_ME27_INSTR_IMMED)
+
+#define NFP_ME27_INSTR_MASK_LD_FIELD ((bfd_vma) 0x1ffa00e00000)
+#define NFP_ME27_INSTR_LD_FIELD ((bfd_vma) 0x00c000000000)
+#define NFP_ME27_INSTR_IS_LD_FIELD(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_LD_FIELD) == NFP_ME27_INSTR_LD_FIELD)
+
+#define NFP_ME27_INSTR_MASK_CTX_ARB ((bfd_vma) 0x00f800000000)
+#define NFP_ME27_INSTR_CTX_ARB ((bfd_vma) 0x00e000000000)
+#define NFP_ME27_INSTR_IS_CTX_ARB(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_CTX_ARB) == NFP_ME27_INSTR_CTX_ARB)
+
+#define NFP_ME27_INSTR_MASK_LOCAL_CSR ((bfd_vma) 0x1ffe00100000)
+#define NFP_ME27_INSTR_LOCAL_CSR ((bfd_vma) 0x00fc00000000)
+#define NFP_ME27_INSTR_IS_LOCAL_CSR(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_LOCAL_CSR) == NFP_ME27_INSTR_LOCAL_CSR)
+
+#define NFP_ME27_INSTR_MASK_BRANCH ((bfd_vma) 0x00f8000c3ce0)
+#define NFP_ME27_INSTR_BRANCH ((bfd_vma) 0x00d800000020)
+#define NFP_ME27_INSTR_IS_BRANCH(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_BRANCH) == NFP_ME27_INSTR_BRANCH)
+
+#define NFP_ME27_INSTR_MASK_BR_BYTE ((bfd_vma) 0x00f800000000)
+#define NFP_ME27_INSTR_BR_BYTE ((bfd_vma) 0x00c800000000)
+#define NFP_ME27_INSTR_IS_BR_BYTE(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_BR_BYTE) == NFP_ME27_INSTR_BR_BYTE)
+
+#define NFP_ME27_INSTR_MASK_BR_BIT ((bfd_vma) 0x00f800080300)
+#define NFP_ME27_INSTR_BR_BIT ((bfd_vma) 0x00d000000000)
+#define NFP_ME27_INSTR_IS_BR_BIT(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_BR_BIT) == NFP_ME27_INSTR_BR_BIT)
+
+#define NFP_ME27_INSTR_MASK_BR_ALU ((bfd_vma) 0x1fff80000000)
+#define NFP_ME27_INSTR_BR_ALU ((bfd_vma) 0x00e800000000)
+#define NFP_ME27_INSTR_IS_BR_ALU(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_BR_ALU) == NFP_ME27_INSTR_BR_ALU)
+
+#define NFP_ME27_INSTR_MASK_MULT ((bfd_vma) 0x1efe3f000000)
+#define NFP_ME27_INSTR_MULT ((bfd_vma) 0x00f800000000)
+#define NFP_ME27_INSTR_IS_MULT(instr) \
+ ((instr & NFP_ME27_INSTR_MASK_MULT) == NFP_ME27_INSTR_MULT)
+
+
+#define NFP_ME28_INSTR_MASK_CMD ((bfd_vma) 0x008000000000)
+#define NFP_ME28_INSTR_CMD ((bfd_vma) 0x000000000000)
+#define NFP_ME28_INSTR_IS_CMD(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_CMD) == NFP_ME28_INSTR_CMD)
+
+#define NFP_ME28_INSTR_MASK_ALU_SHF ((bfd_vma) 0x00e000000000)
+#define NFP_ME28_INSTR_ALU_SHF ((bfd_vma) 0x008000000000)
+#define NFP_ME28_INSTR_IS_ALU_SHF(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_ALU_SHF) == NFP_ME28_INSTR_ALU_SHF)
+
+#define NFP_ME28_INSTR_MASK_ALU ((bfd_vma) 0x00e000000000)
+#define NFP_ME28_INSTR_ALU ((bfd_vma) 0x00a000000000)
+#define NFP_ME28_INSTR_IS_ALU(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_ALU) == NFP_ME28_INSTR_ALU)
+
+#define NFP_ME28_INSTR_MASK_IMMED ((bfd_vma) 0x01f900000000)
+#define NFP_ME28_INSTR_IMMED ((bfd_vma) 0x00f000000000)
+#define NFP_ME28_INSTR_IS_IMMED(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_IMMED) == NFP_ME28_INSTR_IMMED)
+
+#define NFP_ME28_INSTR_MASK_LD_FIELD ((bfd_vma) 0x01fa00e00000)
+#define NFP_ME28_INSTR_LD_FIELD ((bfd_vma) 0x00c000000000)
+#define NFP_ME28_INSTR_IS_LD_FIELD(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_LD_FIELD) == NFP_ME28_INSTR_LD_FIELD)
+
+#define NFP_ME28_INSTR_MASK_CTX_ARB ((bfd_vma) 0x00f800000000)
+#define NFP_ME28_INSTR_CTX_ARB ((bfd_vma) 0x00e000000000)
+#define NFP_ME28_INSTR_IS_CTX_ARB(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_CTX_ARB) == NFP_ME28_INSTR_CTX_ARB)
+
+#define NFP_ME28_INSTR_MASK_LOCAL_CSR ((bfd_vma) 0x01fe00100000)
+#define NFP_ME28_INSTR_LOCAL_CSR ((bfd_vma) 0x00fc00000000)
+#define NFP_ME28_INSTR_IS_LOCAL_CSR(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_LOCAL_CSR) == NFP_ME28_INSTR_LOCAL_CSR)
+
+#define NFP_ME28_INSTR_MASK_BRANCH ((bfd_vma) 0x00f8000c3ce0)
+#define NFP_ME28_INSTR_BRANCH ((bfd_vma) 0x00d800000020)
+#define NFP_ME28_INSTR_IS_BRANCH(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_BRANCH) == NFP_ME28_INSTR_BRANCH)
+
+#define NFP_ME28_INSTR_MASK_BR_BYTE ((bfd_vma) 0x00f800000000)
+#define NFP_ME28_INSTR_BR_BYTE ((bfd_vma) 0x00c800000000)
+#define NFP_ME28_INSTR_IS_BR_BYTE(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_BR_BYTE) == NFP_ME28_INSTR_BR_BYTE)
+
+#define NFP_ME28_INSTR_MASK_BR_BIT ((bfd_vma) 0x00f800080300)
+#define NFP_ME28_INSTR_BR_BIT ((bfd_vma) 0x00d000000000)
+#define NFP_ME28_INSTR_IS_BR_BIT(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_BR_BIT) == NFP_ME28_INSTR_BR_BIT)
+
+#define NFP_ME28_INSTR_MASK_BR_ALU ((bfd_vma) 0x00ff80000000)
+#define NFP_ME28_INSTR_BR_ALU ((bfd_vma) 0x00e800000000)
+#define NFP_ME28_INSTR_IS_BR_ALU(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_BR_ALU) == NFP_ME28_INSTR_BR_ALU)
+
+#define NFP_ME28_INSTR_MASK_MULT ((bfd_vma) 0x00fe3f000000)
+#define NFP_ME28_INSTR_MULT ((bfd_vma) 0x00f800000000)
+#define NFP_ME28_INSTR_IS_MULT(instr) \
+ ((instr & NFP_ME28_INSTR_MASK_MULT) == NFP_ME28_INSTR_MULT)
+
+typedef struct
+{
+ int cpp_target;
+ int cpp_action;
+ int cpp_token;
+ unsigned int len_fixed;
+ unsigned int len_mask;
+ const char *mnemonic;
+}
+nfp_cmd_mnemonic;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NFP_H_ */