aboutsummaryrefslogtreecommitdiff
path: root/opcodes/bfin-dis.c
AgeCommit message (Collapse)AuthorFilesLines
2021-03-31Use bool in opcodesAlan Modra1-21/+21
cpu/ * frv.opc: Replace bfd_boolean with bool, FALSE with false, and TRUE with true throughout. opcodes/ * sysdep.h (POISON_BFD_BOOLEAN): Define. * aarch64-asm-2.c, * aarch64-asm.c, * aarch64-asm.h, * aarch64-dis-2.c, * aarch64-dis.c, * aarch64-dis.h, * aarch64-gen.c, * aarch64-opc.c, * aarch64-opc.h, * arc-dis.c, * arc-dis.h, * arc-fxi.h, * arc-opc.c, * arm-dis.c, * bfin-dis.c, * cris-dis.c, * csky-dis.c, * csky-opc.h, * dis-buf.c, * disassemble.c, * frv-opc.c, * frv-opc.h, * h8300-dis.c, * i386-dis.c, * m68k-dis.c, * metag-dis.c, * microblaze-dis.c, * microblaze-dis.h, * micromips-opc.c, * mips-dis.c, * mips-formats.h, * mips-opc.c, * mips16-opc.c, * mmix-dis.c, * msp430-dis.c, * nds32-dis.c, * nfp-dis.c, * nios2-dis.c, * ppc-dis.c, * riscv-dis.c, * score-dis.c, * score7-dis.c, * tic6x-dis.c, * v850-dis.c, * vax-dis.c, * wasm32-dis.c, * xtensa-dis.c: Replace bfd_boolean with bool, FALSE with false, and TRUE with true throughout.
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-09-02ubsan: bfin-dis.c:160 shift exponent 32 is too largeAlan Modra1-1/+1
* bfin-dis.c (MASKBITS): Use SIGNBIT.
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-12-16ubsan: bfin: left shift of negative valueAlan Modra1-9/+8
* bfin-dis.c (fmtconst, fmtconst_val): Avoid signed overflow.
2019-12-11ubsan: bfin: shift exponent is too largeAlan Modra1-13/+16
This was the following in fmtconst_val, x is unsigned int. x = SIGNEXTEND (x, constant_formats[cf].nbits); Problem is, the SIGNEXTEND macro assumed its arg was a long and sign extended by shifting left then shifting right, and didn't cast the arg. So don't do the silly shift thing. It's not guaranteed to work anyway according to the C standard. ">>" might do a logical shift even if its args are signed. * bfin-dis.c (HOST_LONG_WORD_SIZE, XFIELD): Delete. (SIGNBIT): New. (MASKBITS, SIGNEXTEND): Rewrite. (fmtconst): Don't use ? expression now that SIGNEXTEND uses unsigned arithmetic, instead assign result of SIGNEXTEND back to x. (fmtconst_val): Use 1u in shift expression.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-06-15Prevent invalid array accesses when disassembling a corrupt bfin binary.Nick Clifton1-4/+4
PR binutils/21586 * bfin-dis.c (gregs): Clip index to prevent overflow. (regs): Likewise. (regs_lo): Likewise. (regs_hi): Likewise.
2017-05-24Move print_insn_XXX to an opcodes internal headerYao Qi1-1/+1
With the changes done in previous patches, print_insn_XXX functions don't have to be external visible out of opcodes, because both gdb and objdump select disassemblers through a single interface. This patch moves these print_insn_XXX declarations from include/dis-asm.h to opcodes/disassemble.h, which is a new header added by this patch. include: 2017-05-24 Yao Qi <yao.qi@linaro.org> * dis-asm.h: Move some function declarations to opcodes/disassemble.h. opcodes: 2017-05-24 Yao Qi <yao.qi@linaro.org> * alpha-dis.c: Include disassemble.h, don't include dis-asm.h. * avr-dis.c, bfin-dis.c, cr16-dis.c: Likewise. * crx-dis.c, d10v-dis.c, d30v-dis.c: Likewise. * disassemble.c, dlx-dis.c, epiphany-dis.c: Likewise. * fr30-dis.c, ft32-dis.c, h8300-dis.c, h8500-dis.c: Likewise. * hppa-dis.c, i370-dis.c, i386-dis.c: Likewise. * i860-dis.c, i960-dis.c, ip2k-dis.c: Likewise. * iq2000-dis.c, lm32-dis.c, m10200-dis.c: Likewise. * m10300-dis.c, m32r-dis.c, m68hc11-dis.c: Likewise. * m68k-dis.c, m88k-dis.c, mcore-dis.c: Likewise. * metag-dis.c, microblaze-dis.c, mmix-dis.c: Likewise. * moxie-dis.c, msp430-dis.c, mt-dis.c: * nds32-dis.c, nios2-dis.c, ns32k-dis.c: Likewise. * or1k-dis.c, pdp11-dis.c, pj-dis.c: Likewise. * ppc-dis.c, pru-dis.c, riscv-dis.c: Likewise. * rl78-dis.c, s390-dis.c, score-dis.c: Likewise. * sh-dis.c, sh64-dis.c, tic30-dis.c: Likewise. * tic4x-dis.c, tic54x-dis.c, tic6x-dis.c: Likewise. * tic80-dis.c, tilegx-dis.c, tilepro-dis.c: Likewise. * v850-dis.c, vax-dis.c, visium-dis.c: Likewise. * w65-dis.c, wasm32-dis.c, xc16x-dis.c: Likewise. * xgate-dis.c, xstormy16-dis.c, xtensa-dis.c: Likewise. * z80-dis.c, z8k-dis.c: Likewise. * disassemble.h: New file.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-09-23Fix compile time warnings generated when compiling with clang.Nick Clifton1-1/+1
bfd * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in order to avoid problems with left shifting negative values. (abs32code): Likewise. * mach-o.c (FILE_ALIGN): Likewise. * coff-rs6000.c (xcoff_debug_sections): Delete unused static array. * elf32-visium.c (visium_reloc_map): Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Remove useless calls to abs function. * elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise. * elf32-score.c (score_elf_final_link_relocate): Likewise. * elf32-score7.c (score_elf_final_link_relocate): Likewise. * elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead of shifting to create a negative mask. * elf32-msp430.c (elf_backend_special_sections): Define. * elfxx-mips.c (got_ofst_reloc_p): Delete unused function. (got_hi16_reloc_p): Delete unused function. * ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of partition name. gas * config/tc-ppc.c (insn_validate): Cast PPC_OPSHIFT_INV to an int. opcode * ppc.h (PPC_OPSHIFT_INV): Use an unsigned constant when left shifting. ld * emultempl/elf32.em (ehdr_start_empty): New static variable. (before_allocation): Use it to initialise ehdr_start_save. * emultempl/pe.em (write_build_id): Remove useless double parenthesis. * emultempl/pep.em (write_build_id): Likewise. opcodes * bfin-dis.c (fmtconst): Remove unnecessary call to the abs function. * tic30-dis.c (print_branch): Likewise. * cgen-asm.c (cgen_parse_signed_integer): Cast integer to signed value before left shifting. * fr30-ibld.c (fr30_cgen_extract_operand): Likewise. * hppa-dis.c (print_insn_hppa): Likewise. * mips-dis.c (mips_cp0sel_names_mipsr5900): Delete unused static array. * msp430-dis.c (msp430_singleoperand): Likewise. (msp430_doubleoperand): Likewise. (print_insn_msp430): Likewise. * nds32-asm.c (parse_operand): Likewise. * sh-opc.h (MASK): Likewise. * v850-dis.c (get_operand_value): Likewise.
2015-06-22Stop "objdump -d" from disassembling past a symbolic address.Nick Clifton1-1/+1
include * dis-asm.h (struct disassemble_info): Add stop_vma field. binuti * objdump.c (disassemble_bytes): Set the stop_vma field in the disassemble_info structure when disassembling code sections with -d. * doc/binutils.texi (objdump): Document the discrepancy between -d and -D. opcodes * dis-buf.c (buffer_read_memory): Fail is stop_vma is set and the requested region lies beyond it. * bfin-dis.c (print_insn_bfin): Ignore sysop instructions when looking for 32-bit insns. * mcore-dis.c (print_insn_mcore): Disable stop_vma when reading data. * sh-dis.c (print_insn_sh): Likewise. * tic6x-dis.c (print_insn_tic6x): Disable stop_vma when reading blocks of instructions. * vax-dis.c (print_insn_vax): Check that the requested address does not clash with the stop_vma. tests * gas/arm/backslash-at.s: Add extra .byte directives so that the foo symbol does not appear to point half way through an instruction. * gas/arm/backslash-at.d: Update expected disassembly. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/x86-64-opcode-inval.d: Likewise.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-08-14opcodes: blackfin: convert ad-hoc ints to bfd_booleanMike Frysinger1-21/+21
These various int fields are being used as booleans, so change to the existing bfd_boolean style. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-14opcodes: blackfin: simplify decode_CC2stat_0 logicMike Frysinger1-41/+5
These multiple if statements can be condensed down into a single if statement and an array of strings. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-14opcodes: blackfin: avoid duplicate memory readsMike Frysinger1-6/+4
Rather than reading the same memory twice, pass the value back up. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-13opcodes: blackfin: push down global stateMike Frysinger1-43/+69
The variables used to track insn state should be pushed down into the private_data structure to avoid pollution across calls. This also happens to fix the output when hitting comments/invalid insns which needs to tweak a gas test. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-13opcodes: blackfin: do not force align the PCMike Frysinger1-1/+9
If the user gives us an unaligned PC, then dump an error as such. Otherwise if you try to disassemble at an odd address, the output will look weird (it'll read one byte earlier). This can be seen in one of the gas tests where data is in the middle of .text, so move the data to .data like it should be in the first place. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-13opcodes: blackfin: handle memory read errorsMike Frysinger1-19/+39
The current code ignores memory read errors which isn't a great idea. So add a helper function which takes care of error checking and update the code to use that. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-03-05Update copyright yearsAlan Modra1-2/+1
2012-05-18 * arc-dis.c: Include sysdep.h first, remove some redundant includes.Alan Modra1-3/+2
* bfin-dis.c: Likewise. * i860-dis.c: Likewise. * ia64-dis.c: Likewise. * ia64-gen.c: Likewise. * m68hc11-dis.c: Likewise. * mmix-dis.c: Likewise. * msp430-dis.c: Likewise. * or32-dis.c: Likewise. * rl78-dis.c: Likewise. * rx-dis.c: Likewise. * tic4x-dis.c: Likewise. * tilegx-opc.c: Likewise. * tilepro-opc.c: Likewise. * rx-decode.c: Regenerate.
2012-04-01opcodes: bfin: simplify field width processing and fix build warningsMike Frysinger1-10/+1
This fix the build time warning: warning: format not a string literal, argument types not checked [-Wformat-nonliteral] Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-24opcodes: blackfin: ignore (M) on MAC0-only dsp mac funcsMike Frysinger1-1/+4
If the MAC1 part of the insn is disabled, then the (M) flag is ignored. Rather than include it in the decode, move the MM clearing to the MAC0 portion of the code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-22opcodes: blackfin: drop null/nul checks in OUTSMike Frysinger1-1/+1
Parts of the disassembler rely on the disasm info never being NULL (such as being able to read memory to disassemble in the first place). So drop useless null checks in the OUTS helper. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-22opcodes: blackfin: use OUTS helperMike Frysinger1-4/+4
We have an OUTS helper to handle outf fprintf_func logic, so conver the few places not using it over. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-20opcodes: blackfin: clean up saved_stateMike Frysinger1-48/+26
Mark the state static, punt unused members, unify indexable register lookups, and abort when there is a register lookup failure. Otherwise we return NULL and the calling code assumes a valid pointer is returned. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-14opcodes: blackfin: fix styleMike Frysinger1-43/+42
Non-functional thrashing to the GNU style. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-14opcodes: blackfin: catch invalid loopsetup insnsMike Frysinger1-0/+3
The LoopSetup insn is only valid when the reg field is 0-7, so don't go decoding it incorrectly when reg is 8-15. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-13opcodes: blackfin: fix decoding of ABSMike Frysinger1-1/+1
The single cycle dual mac ABS insn was incorrectly decoding the mac1 part of the insn. Once we fix the decode, update the gas tests to have the correct output. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-13opcodes: blackfin: fix decoding of dsp mult insnsMike Frysinger1-2/+2
When assigning to a register half, the mac0 part of the mult insn was not decoding properly. It would always show a full dreg instead of the dreg low half. Once we fix the disassembler, we have to update a few of the gas tests as their previous expected output was incorrect. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-13gas/opcodes: blackfin: punt BYTEOP2M insn supportMike Frysinger1-68/+0
The BYTEOP2M insn was part of the initial Blackfin designs, but never made it into any actual silicon. So punt support for it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-12opcodes: blackfin: add missing space after PRNT insnMike Frysinger1-1/+1
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-12opcodes: blackfin: drop "GP" registerMike Frysinger1-3/+3
There never was a "GP" register, so punt it from the decode map. It's a hold over from a very old processor definition and never made it into actual silicon. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-12gas/opcodes: blackfin: move dsp mac func defines to common headerMike Frysinger1-10/+0
The mmod field is decoded in a few places (gas/opcodes/sim), so move it to a common place to avoid duplication. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-02-11opcodes: blackfin: constify register namesMike Frysinger1-17/+18
Constify the array itself since it need not be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-15gas: blackfin: fix encoding of BYTEOP2M insnMike Frysinger1-8/+8
The BYTEOP2M parser incorrectly calls BYTEOP2P to generate the opcode. Once we've fixed that, it's easy to see that the disassembler also likes to decode this insn incorrectly. So fix that and then add some tests. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: fix decoding of 32bit addresses on 64bit systemsMike Frysinger1-0/+3
The Blackfin ISA is very exact with regards to address truncation when under/over flowing its 32bit range. On a 32bit system, things work the same and so addresses are decoded properly. On a 64bit system though, the decoded addresses may include the bits that are supposed to have been truncated. So force a 32bit truncation after the address has been calculated. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: fix decoding of all register move insnsMike Frysinger1-12/+30
Many register move insns were not being decoded properly, so rewrite the whole function to be a bit more manageable in terms of valid combinations. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: fix decoding of many invalid insnsMike Frysinger1-21/+105
The Blackfin disassembler was originally based on the premise of parsing valid opcodes all the time, so some of the opcode checking can be a bit fuzzy. This is exemplified in decoding of parallel insns where many times things are decoded as invalid when in reality, they may not be used in parallel combinations. So add parallel checking to most insn decoding routines so we see ILLEGAL and not just whatever insn happens to be close to a valid mnemonic, as well as some additional sub-opcode checks. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: mark push/pop insns with a P6/P7 range as illegalMike Frysinger1-0/+3
The push/pop multiple insn has a 3 bit field for the P register range, but only values of 0...5 are valid (P0 - P5). There is no such P6 or P7 register, so mark these insns as illegal. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: fix decoding of vector shift insn w/saturationMike Frysinger1-1/+1
The saturation bit was missed when decoding a vector shift insn leading to the output looking the same as the non-saturating insn. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: decode all ASTAT bitsMike Frysinger1-8/+21
All ASTAT bits work in the hardware even though they aren't part of the official Blackfin ISA. So decode every ASTAT field to make the output a bit nicer when working with hand generated opcodes. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: decode insns with invalid register as illegalMike Frysinger1-14/+19
Sometimes the encoding in the opcode is a 4 bit field which defines a register number. However, register numbers are only 0-7, so make sure we call illegal for when the opcode register number is greater than 8. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22gas: blackfin: fix DBG/DBGCMPLX insn encodingMike Frysinger1-1/+1
Some extended registers when given to the DBG/DBGCMPLX pseudo insns are not encoded properly. So fix them, fix the display of them when being disassembled, and add testcases. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes/gas: blackfin: handle more ASTAT flagsMike Frysinger1-4/+10
Support a few more ASTAT bits with the standard insns that operate on ASTAT bits directly. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes/gas: blackfin: support OUTC debug insnMike Frysinger1-4/+17
The disassembler has partial (but incomplete/broken) support already for the pseudo debug insn OUTC, so let's fix it up and finish it. And now that the disassembler can handle it, make sure our assembler can output it too. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: fix decoding of LSHIFT insnsMike Frysinger1-2/+2
The Blackfin ISA does not have a "SHIFT" insn, it has either LSHIFT, ASHIFT, or BXORSHIFT. So be specific when disassembling. As fall out of this change, we need to update some assembler tests. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-22opcodes: blackfin: constify formatting related structuresMike Frysinger1-22/+22
No need for these local structures related to formatting of output to be writable, so constify the whole shebang. Signed-off-by: Mike Frysinger <vapier@gentoo.org>