aboutsummaryrefslogtreecommitdiff
path: root/include/opcode/aarch64.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-06-28 09:21:04 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2016-06-28 09:21:04 +0100
commitdab26bf4e7c8b48e0c5ffbef1c5400807b78072c (patch)
tree31f50ffc2bc35617ba70fe0f12d13b6332390e50 /include/opcode/aarch64.h
parentc9775dde32773c57d4eb5dfb4265eda9cb8adbe8 (diff)
downloadfsf-binutils-gdb-dab26bf4e7c8b48e0c5ffbef1c5400807b78072c.zip
fsf-binutils-gdb-dab26bf4e7c8b48e0c5ffbef1c5400807b78072c.tar.gz
fsf-binutils-gdb-dab26bf4e7c8b48e0c5ffbef1c5400807b78072c.tar.bz2
[AArch64] Make register indices be full 64-bit values
aarch64_opnd_info used bitfields to hold vector element indices, but values were stored into those bitfields before their ranges had been checked. This meant large invalid indices could be silently truncated to smaller valid indices. The two obvious fixes were to do the range checking earlier or use a full 64-bit field for the index. I went for the latter for two reasons: - Doing the range checking in operand_general_constraint_met_p seems structurally cleaner than doing it while parsing. - The bitfields didn't really buy us anything. The imm field of the union is already 128 bits, so we can use a full int64_t index without growing the structure. The patch also adds missing range checks for the elements in a register list index. include/ * opcode/aarch64.h (aarch64_opnd_info): Change index fields to int64_t. opcodes/ * aarch64-opc.c (operand_general_constraint_met_p): Check the range of ldst_elemlist operands. (print_register_list): Use PRIi64 to print the index. (aarch64_print_operand): Likewise. gas/ * testsuite/gas/aarch64/diagnostic.s, testsuite/gas/aarch64/diagnostic.l: Add tests for out-of-range indices.
Diffstat (limited to 'include/opcode/aarch64.h')
-rw-r--r--include/opcode/aarch64.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h
index e6f080c..b35a818 100644
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -748,8 +748,8 @@ struct aarch64_opnd_info
} reg;
struct
{
- unsigned regno : 5;
- unsigned index : 4;
+ unsigned int regno;
+ int64_t index;
} reglane;
/* e.g. LVn. */
struct
@@ -759,7 +759,7 @@ struct aarch64_opnd_info
/* 1 if it is a list of reg element. */
unsigned has_index : 1;
/* Lane index; valid only when has_index is 1. */
- unsigned index : 4;
+ int64_t index;
} reglist;
/* e.g. immediate or pc relative address offset. */
struct