• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionc2825638b6784179f191c6ee8ebbda1c49ae5271 (tree)
Time2015-11-19 23:13:45
AuthorMatthew Wahab <matthew.wahab@arm....>
CommiterMatthew Wahab

Log Message

[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

Change Summary

Incremental Difference

--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
1+2015-11-19 Matthew Wahab <matthew.wahab@arm.com>
2+
3+ * gas/aarch64/pan-illegal.d: New.
4+ * gas/aarch64/pan-illegal.l: New.
5+ * gas/aarch64/pan.s: Add tests for invalid immediates.
6+
17 2015-11-19 Alan Modra <amodra@gmail.com>
28
39 * gas/ppc/altivec3.d: Allow for padding at end of section.
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/pan-illegal.d
@@ -0,0 +1,3 @@
1+#as: -march=armv8.1-a --defsym ERROR=1
2+#source: pan.s
3+#error-output: pan-illegal.l
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/pan-illegal.l
@@ -0,0 +1,15 @@
1+[^:]*: Assembler messages:
2+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#2'
3+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#3'
4+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#4'
5+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#5'
6+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#6'
7+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#7'
8+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#8'
9+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#9'
10+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#10'
11+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#11'
12+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#12'
13+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#13'
14+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#14'
15+[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#15'
--- a/gas/testsuite/gas/aarch64/pan.s
+++ b/gas/testsuite/gas/aarch64/pan.s
@@ -31,4 +31,10 @@
3131 msr pan, x0
3232 mrs x1, pan
3333
34+ .ifdef ERROR
35+ .irp N,2,3,4,5,6,7,8,9,10,11,12,13,14,15
36+ msr pan, #\N
37+ .endr
38+ .endif
39+
3440 .arch_extension nopan
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
1+2015-11-19 Matthew Wahab <matthew.wahab@arm.com>
2+
3+ * aarch64-opc.c (operand_general_constraint_met_p): Check validity
4+ of MSR PAN immediate operand.
5+
16 2015-11-16 Nick Clifton <nickc@redhat.com>
27
38 * rx-dis.c (condition_names): Replace always and never with
--- 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,
18621862 {
18631863 case AARCH64_OPND_PSTATEFIELD:
18641864 assert (idx == 0 && opnds[1].type == AARCH64_OPND_UIMM4);
1865+ /* MSR PAN, #uimm4
1866+ The immediate must be #0 or #1. */
1867+ if (opnd->pstatefield == 0x04 /* PAN. */
1868+ && opnds[1].imm.value > 1)
1869+ {
1870+ set_imm_out_of_range_error (mismatch_detail, idx, 0, 1);
1871+ return 0;
1872+ }
18651873 /* MSR SPSel, #uimm4
18661874 Uses uimm4 as a control value to select the stack pointer: if
18671875 bit 0 is set it selects the current exception level's stack