diff options
author | Nick Clifton <nickc@redhat.com> | 2016-04-28 09:11:03 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-04-28 09:11:03 +0100 |
commit | 4bd13cde17a27c342b79b72bde9ef8e1b5373344 (patch) | |
tree | b8216b559ad09261cc8a82c332e6c8ac90b3959a /opcodes/aarch64-opc.c | |
parent | a3a65e6e1d8b31bf2c8b0abca1903106ae48e092 (diff) | |
download | fsf-binutils-gdb-4bd13cde17a27c342b79b72bde9ef8e1b5373344.zip fsf-binutils-gdb-4bd13cde17a27c342b79b72bde9ef8e1b5373344.tar.gz fsf-binutils-gdb-4bd13cde17a27c342b79b72bde9ef8e1b5373344.tar.bz2 |
Add support to AArch64 disassembler for verifying instructions. Add verifier for LDPSW.
PR target/19722
opcodes * aarch64-dis.c (aarch64_opcode_decode): Run verifier if present.
* aarch64-opc.c (verify_ldpsw): New function.
* aarch64-opc.h (verify_ldpsw): New prototype.
* aarch64-tbl.h: Add initialiser for verifier field.
(LDPSW): Set verifier to verify_ldpsw.
binutils* testsuite/binutils-all/aarch64/illegal.s: New test.
* testsuite/binutils-all/aarch64/illegal.d: New test driver.
include * opcode/aarch64.h (struct aarch64_opcode): Add verifier field.
Diffstat (limited to 'opcodes/aarch64-opc.c')
-rw-r--r-- | opcodes/aarch64-opc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index 76992df..8fbea46 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -3417,6 +3417,34 @@ aarch64_sys_ins_reg_supported_p (const aarch64_feature_set features, #undef C14 #undef C15 +#define BIT(INSN,BT) (((INSN) >> (BT)) & 1) +#define BITS(INSN,HI,LO) (((INSN) >> (LO)) & ((1 << (((HI) - (LO)) + 1)) - 1)) + +bfd_boolean +verify_ldpsw (const struct aarch64_opcode * opcode ATTRIBUTE_UNUSED, + const aarch64_insn insn) +{ + int t = BITS (insn, 4, 0); + int n = BITS (insn, 9, 5); + int t2 = BITS (insn, 14, 10); + + if (BIT (insn, 23)) + { + /* Write back enabled. */ + if ((t == n || t2 == n) && n != 31) + return FALSE; + } + + if (BIT (insn, 22)) + { + /* Load */ + if (t == t2) + return FALSE; + } + + return TRUE; +} + /* Include the opcode description table as well as the operand description table. */ #include "aarch64-tbl.h" |