From 4bd13cde17a27c342b79b72bde9ef8e1b5373344 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 28 Apr 2016 09:11:03 +0100 Subject: 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. --- opcodes/aarch64-dis.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'opcodes/aarch64-dis.c') diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c index 05e4768..9ffc713 100644 --- a/opcodes/aarch64-dis.c +++ b/opcodes/aarch64-dis.c @@ -2047,6 +2047,7 @@ aarch64_opcode_decode (const aarch64_opcode *opcode, const aarch64_insn code, { const aarch64_operand *opnd; enum aarch64_opnd type; + type = opcode->operands[i]; if (type == AARCH64_OPND_NIL) break; @@ -2059,6 +2060,13 @@ aarch64_opcode_decode (const aarch64_opcode *opcode, const aarch64_insn code, } } + /* If the opcode has a verifier, then check it now. */ + if (opcode->verifier && ! opcode->verifier (opcode, code)) + { + DEBUG_TRACE ("operand verifier FAIL"); + goto decode_fail; + } + /* Match the qualifiers. */ if (aarch64_match_operands_constraint (inst, NULL) == 1) { -- cgit v1.1