From 1678bd35a35a3bace2d4aee39b64d96c638651f0 Mon Sep 17 00:00:00 2001 From: "Francois H. Theron" Date: Tue, 15 May 2018 13:28:06 +0100 Subject: Fix error messages in the NFP sources when building for 32-bit targets. bfd * targets.c: Wrap nfp_elf64_vec in BFD64 ifdef. include * opcode/nfp.h: Use uint64_t instead of bfd_vma. opcodes * nfp-dis.c: Use uint64_t for instruction variables, not bfd_vma. --- opcodes/ChangeLog | 4 +++ opcodes/nfp-dis.c | 85 ++++++++++++++++++++++++++----------------------------- 2 files changed, 44 insertions(+), 45 deletions(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0586af6..ea407e3 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2018-05-15 Francois H. Theron + + * nfp-dis.c: Use uint64_t for instruction variables, not bfd_vma. + 2018-05-09 H.J. Lu * i386-opc.tbl: Remove Disp from movidir{i,64b}. diff --git a/opcodes/nfp-dis.c b/opcodes/nfp-dis.c index 30442db..9dda34b 100644 --- a/opcodes/nfp-dis.c +++ b/opcodes/nfp-dis.c @@ -39,14 +39,9 @@ #define _NFP_ERR_STOP -1 #define _NFP_ERR_CONT -8 -/* 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." */ - #define _BTST(v, b) (((v) >> b) & 1) -#define _BF(v, msb, lsb) (((v) >> (lsb)) & ((1U << ((msb) - (lsb) + 1)) - 1)) +#define _BF(v, msb, lsb) (((v) >> (lsb)) & \ + ((1U << ((msb) - (lsb) + 1)) - 1)) #define _BFS(v, msb, lsb, lshift) (_BF(v, msb, lsb) << (lshift)) #define _NFP_ME27_28_CSR_CTX_ENABLES 0x18 @@ -928,10 +923,10 @@ static const nfp_cmd_mnemonic nfp_me28_mnemonics[] = }; static int -nfp_me_print_invalid (bfd_vma instr, struct disassemble_info *dinfo) +nfp_me_print_invalid (uint64_t instr, struct disassemble_info *dinfo) { const char * err_msg = N_(":"); - dinfo->fprintf_func (dinfo->stream, "%s 0x%" BFD_VMA_FMT "x", err_msg, instr); + dinfo->fprintf_func (dinfo->stream, "%s 0x%" PRIx64, err_msg, instr); return _NFP_ERR_CONT; } @@ -1101,7 +1096,7 @@ nfp_me_print_opnd8 (unsigned int opnd, char bank, int num_ctx, int lmem_ext, } static int -nfp_me27_28_print_alu_shf (bfd_vma instr, unsigned int pred_cc, +nfp_me27_28_print_alu_shf (uint64_t instr, unsigned int pred_cc, unsigned int dst_lmext, unsigned int src_lmext, unsigned int gpr_wrboth, int num_ctx, struct disassemble_info *dinfo) @@ -1225,7 +1220,7 @@ nfp_me27_28_print_alu_shf (bfd_vma instr, unsigned int pred_cc, } static int -nfp_me27_28_print_alu (bfd_vma instr, unsigned int pred_cc, +nfp_me27_28_print_alu (uint64_t instr, unsigned int pred_cc, unsigned int dst_lmext, unsigned int src_lmext, unsigned int gpr_wrboth, int num_ctx, struct disassemble_info *dinfo) @@ -1416,7 +1411,7 @@ nfp_me27_28_print_alu (bfd_vma instr, unsigned int pred_cc, } static int -nfp_me27_28_print_immed (bfd_vma instr, unsigned int pred_cc, +nfp_me27_28_print_immed (uint64_t instr, unsigned int pred_cc, unsigned int dst_lmext, unsigned int gpr_wrboth, int num_ctx, struct disassemble_info *dinfo) @@ -1486,7 +1481,7 @@ nfp_me27_28_print_immed (bfd_vma instr, unsigned int pred_cc, } static int -nfp_me27_28_print_ld_field (bfd_vma instr, unsigned int pred_cc, +nfp_me27_28_print_ld_field (uint64_t instr, unsigned int pred_cc, unsigned int dst_lmext, unsigned int src_lmext, unsigned int gpr_wrboth, int num_ctx, struct disassemble_info *dinfo) @@ -1557,7 +1552,7 @@ nfp_me27_28_print_ld_field (bfd_vma instr, unsigned int pred_cc, } static int -nfp_me27_28_print_ctx_arb (bfd_vma instr, struct disassemble_info *dinfo) +nfp_me27_28_print_ctx_arb (uint64_t instr, struct disassemble_info *dinfo) { unsigned int resume_addr = _BFS (instr, 40, 40, 13) | _BF (instr, 34, 22); unsigned int defer = _BF (instr, 21, 20); @@ -1607,7 +1602,7 @@ nfp_me27_28_print_ctx_arb (bfd_vma instr, struct disassemble_info *dinfo) } static int -nfp_me27_28_print_local_csr (bfd_vma instr, +nfp_me27_28_print_local_csr (uint64_t instr, unsigned int src_lmext, int num_ctx, struct disassemble_info *dinfo) { @@ -1674,7 +1669,7 @@ nfp_me27_28_print_local_csr (bfd_vma instr, } static int -nfp_me27_28_print_branch (bfd_vma instr, +nfp_me27_28_print_branch (uint64_t instr, const char *br_inpstates[16], struct disassemble_info *dinfo) { @@ -1723,7 +1718,7 @@ nfp_me27_28_print_branch (bfd_vma instr, } static int -nfp_me27_28_print_br_byte (bfd_vma instr, +nfp_me27_28_print_br_byte (uint64_t instr, unsigned int src_lmext, int num_ctx, struct disassemble_info *dinfo) { @@ -1768,7 +1763,7 @@ nfp_me27_28_print_br_byte (bfd_vma instr, } static int -nfp_me27_28_print_br_bit (bfd_vma instr, unsigned int src_lmext, +nfp_me27_28_print_br_bit (uint64_t instr, unsigned int src_lmext, int num_ctx, struct disassemble_info *dinfo) { unsigned int srcA = _BF (instr, 7, 0); @@ -1807,7 +1802,7 @@ nfp_me27_28_print_br_bit (bfd_vma instr, unsigned int src_lmext, } static int -nfp_me27_28_print_br_alu (bfd_vma instr, unsigned int src_lmext, +nfp_me27_28_print_br_alu (uint64_t instr, unsigned int src_lmext, int num_ctx, struct disassemble_info *dinfo) { unsigned int srcA = _BF (instr, 9, 0); @@ -1845,7 +1840,7 @@ nfp_me27_28_print_br_alu (bfd_vma instr, unsigned int src_lmext, } static int -nfp_me27_28_print_mult (bfd_vma instr, unsigned int pred_cc, +nfp_me27_28_print_mult (uint64_t instr, unsigned int pred_cc, unsigned int dst_lmext, unsigned int src_lmext, unsigned int gpr_wrboth, int num_ctx, struct disassemble_info *dinfo) @@ -1956,7 +1951,7 @@ nfp_me_find_mnemonic (unsigned int cpp_tgt, unsigned int cpp_act, /* NFP-32xx (ME Version 2.7). */ static int -nfp_me27_print_cmd (bfd_vma instr, int third_party_32bit, +nfp_me27_print_cmd (uint64_t instr, int third_party_32bit, int num_ctx, struct disassemble_info *dinfo) { unsigned int srcA = _BF (instr, 7, 0); @@ -2158,75 +2153,75 @@ nfp_me27_print_cmd (bfd_vma instr, int third_party_32bit, } static int -nfp_me27_print_alu_shf (bfd_vma instr, int num_ctx, +nfp_me27_print_alu_shf (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_alu_shf (instr, 0, 0, 0, 0, num_ctx, dinfo); } static int -nfp_me27_print_alu (bfd_vma instr, int num_ctx, +nfp_me27_print_alu (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_alu_shf (instr, 0, 0, 0, 0, num_ctx, dinfo); } static int -nfp_me27_print_immed (bfd_vma instr, int num_ctx, +nfp_me27_print_immed (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_immed (instr, 0, 0, 0, num_ctx, dinfo); } static int -nfp_me27_print_ld_field (bfd_vma instr, int num_ctx, +nfp_me27_print_ld_field (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_ld_field (instr, 0, 0, 0, 0, num_ctx, dinfo); } static int -nfp_me27_print_ctx_arb (bfd_vma instr, struct disassemble_info *dinfo) +nfp_me27_print_ctx_arb (uint64_t instr, struct disassemble_info *dinfo) { return nfp_me27_28_print_ctx_arb (instr, dinfo); } static int -nfp_me27_print_local_csr (bfd_vma instr, int num_ctx, +nfp_me27_print_local_csr (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_local_csr (instr, 0, num_ctx, dinfo); } static int -nfp_me27_print_branch (bfd_vma instr, struct disassemble_info *dinfo) +nfp_me27_print_branch (uint64_t instr, struct disassemble_info *dinfo) { return nfp_me27_28_print_branch (instr, nfp_me27_br_inpstates, dinfo); } static int -nfp_me27_print_br_byte (bfd_vma instr, int num_ctx, +nfp_me27_print_br_byte (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_br_byte (instr, 0, num_ctx, dinfo); } static int -nfp_me27_print_br_bit (bfd_vma instr, int num_ctx, +nfp_me27_print_br_bit (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_br_bit (instr, 0, num_ctx, dinfo); } static int -nfp_me27_print_br_alu (bfd_vma instr, int num_ctx, +nfp_me27_print_br_alu (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_br_alu (instr, 0, num_ctx, dinfo); } static int -nfp_me27_print_mult (bfd_vma instr, int num_ctx, +nfp_me27_print_mult (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { return nfp_me27_28_print_mult (instr, 0, 0, 0, 0, num_ctx, dinfo); @@ -2235,7 +2230,7 @@ nfp_me27_print_mult (bfd_vma instr, int num_ctx, /*NFP-6xxx/4xxx (ME Version 2.8). */ static int -nfp_me28_print_cmd (bfd_vma instr, int third_party_32bit, +nfp_me28_print_cmd (uint64_t instr, int third_party_32bit, int num_ctx, struct disassemble_info *dinfo) { unsigned int srcA = _BF (instr, 7, 0); @@ -2421,7 +2416,7 @@ nfp_me28_print_cmd (bfd_vma instr, int third_party_32bit, } static int -nfp_me28_print_alu_shf (bfd_vma instr, int num_ctx, +nfp_me28_print_alu_shf (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int gpr_wrboth = _BTST (instr, 41); @@ -2434,7 +2429,7 @@ nfp_me28_print_alu_shf (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_alu (bfd_vma instr, int num_ctx, +nfp_me28_print_alu (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int gpr_wrboth = _BTST (instr, 41); @@ -2447,7 +2442,7 @@ nfp_me28_print_alu (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_immed (bfd_vma instr, int num_ctx, +nfp_me28_print_immed (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int gpr_wrboth = _BTST (instr, 41); @@ -2459,7 +2454,7 @@ nfp_me28_print_immed (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_ld_field (bfd_vma instr, int num_ctx, +nfp_me28_print_ld_field (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int gpr_wrboth = _BTST (instr, 41); @@ -2472,13 +2467,13 @@ nfp_me28_print_ld_field (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_ctx_arb (bfd_vma instr, struct disassemble_info *dinfo) +nfp_me28_print_ctx_arb (uint64_t instr, struct disassemble_info *dinfo) { return nfp_me27_28_print_ctx_arb (instr, dinfo); } static int -nfp_me28_print_local_csr (bfd_vma instr, int num_ctx, +nfp_me28_print_local_csr (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int src_lmext = _BTST (instr, 42); @@ -2487,13 +2482,13 @@ nfp_me28_print_local_csr (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_branch (bfd_vma instr, struct disassemble_info *dinfo) +nfp_me28_print_branch (uint64_t instr, struct disassemble_info *dinfo) { return nfp_me27_28_print_branch (instr, nfp_me28_br_inpstates, dinfo); } static int -nfp_me28_print_br_byte (bfd_vma instr, int num_ctx, +nfp_me28_print_br_byte (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int src_lmext = _BTST (instr, 42); @@ -2501,7 +2496,7 @@ nfp_me28_print_br_byte (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_br_bit (bfd_vma instr, int num_ctx, +nfp_me28_print_br_bit (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int src_lmext = _BTST (instr, 42); @@ -2509,7 +2504,7 @@ nfp_me28_print_br_bit (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_br_alu (bfd_vma instr, int num_ctx, +nfp_me28_print_br_alu (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int src_lmext = _BTST (instr, 42); @@ -2517,7 +2512,7 @@ nfp_me28_print_br_alu (bfd_vma instr, int num_ctx, } static int -nfp_me28_print_mult (bfd_vma instr, int num_ctx, +nfp_me28_print_mult (uint64_t instr, int num_ctx, struct disassemble_info *dinfo) { unsigned int gpr_wrboth = _BTST (instr, 41); @@ -2803,7 +2798,7 @@ _print_instrs (bfd_vma addr, struct disassemble_info *dinfo, nfp_opts * opts) nfp_priv_data *priv = init_nfp_priv (dinfo); bfd_byte buffer[8]; int err; - bfd_vma instr = 0; + uint64_t instr = 0; size_t island, menum; int num_ctx, scs_cnt, addr_3rdparty32, pc, tmpi, tmpj; int is_text = 1; -- cgit v1.1