aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorMatthew Wahab <matthew.wahab@arm.com>2015-11-19 14:13:45 +0000
committerMatthew Wahab <matthew.wahab@arm.com>2015-11-19 14:13:45 +0000
commitc2825638b6784179f191c6ee8ebbda1c49ae5271 (patch)
tree12ac512724b5ac2095d1a125a9fcd4f5b7c37897 /opcodes
parent231c0592639d6f5c1796feb4a6375eab202a4acb (diff)
downloadgdb-c2825638b6784179f191c6ee8ebbda1c49ae5271.zip
gdb-c2825638b6784179f191c6ee8ebbda1c49ae5271.tar.gz
gdb-c2825638b6784179f191c6ee8ebbda1c49ae5271.tar.bz2
[AArch64] Reject invalid immediate operands to MSR PAN
The support for accessing the ARMv8.1 PSTATE field PAN allows instructions of the form MSR PAN, #<imm> with <imm> any unsigned 4-bit integer. However, the architecture specification requires that the immediate is either 0 or 1. This patch implements the constraint on the immediate, generating an error if the immediate operand is invalid, and adds tests for the illegal forms. opcodes/ 2015-11-19 Matthew Wahab <matthew.wahab@arm.com> * aarch64-opc.c (operand_general_constraint_met_p): Check validity of MSR PAN immediate operand. gas/testsuite/ 2015-11-19 Matthew Wahab <matthew.wahab@arm.com> * gas/aarch64/pan-illegal.d: New. * gas/aarch64/pan-illegal.l: New. * gas/aarch64/pan.s: Add tests for invalid immediates. Change-Id: Ibb3056c975eb792104da138d94594224f56a993e
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/aarch64-opc.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index edec363..5333c48 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-19 Matthew Wahab <matthew.wahab@arm.com>
+
+ * aarch64-opc.c (operand_general_constraint_met_p): Check validity
+ of MSR PAN immediate operand.
+
2015-11-16 Nick Clifton <nickc@redhat.com>
* rx-dis.c (condition_names): Replace always and never with
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index c6ab4b2..50dbd36 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -1862,6 +1862,14 @@ operand_general_constraint_met_p (const aarch64_opnd_info *opnds, int idx,
{
case AARCH64_OPND_PSTATEFIELD:
assert (idx == 0 && opnds[1].type == AARCH64_OPND_UIMM4);
+ /* MSR PAN, #uimm4
+ The immediate must be #0 or #1. */
+ if (opnd->pstatefield == 0x04 /* PAN. */
+ && opnds[1].imm.value > 1)
+ {
+ set_imm_out_of_range_error (mismatch_detail, idx, 0, 1);
+ return 0;
+ }
/* MSR SPSel, #uimm4
Uses uimm4 as a control value to select the stack pointer: if
bit 0 is set it selects the current exception level's stack