aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authordiaxu01 <dianhong.xu@arm.com>2019-08-21 09:31:35 +0000
committerCherry Zhang <cherryyz@google.com>2019-10-08 16:20:53 +0000
commit9ce5cad0aaf5eceda6927acec2db96ba5fd7ef07 (patch)
treee1e31e9e237ea1e156e9b93390f5bd73d2764f11 /src/cmd/asm
parentd458b868360c0e223979951dd4b6ce3ce92cfd68 (diff)
downloadgo-9ce5cad0aaf5eceda6927acec2db96ba5fd7ef07.tar.xz
cmd/internal/obj/arm64: add error checking for system registers.
This CL adds system register error checking test cases. There're two kinds of error test cases: 1. illegal combination. MRS should be used in this way: MRS <system register>, <general register>. MSR should be used in this way: MSR <general register>, <system register>. Error usage examples: MRS R8, VTCR_EL2 // ERROR "illegal combination" MSR VTCR_EL2, R8 // ERROR "illegal combination" 2. illegal read or write access. Error usage examples: MSR R7, MIDR_EL1 // ERROR "expected writable system register or pstate" MRS OSLAR_EL1, R3 // ERROR "expected readable system register" This CL reads system registers readable and writeable property to check whether they're used with legal read or write access. This property is named AccessFlags in sysRegEnc.go, and it is automatically generated by modifing the system register generator. Change-Id: Ic83d5f372de38d1ecd0df1ca56b354ee157f16b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/194917 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/testdata/arm64.s2
-rw-r--r--src/cmd/asm/internal/asm/testdata/arm64error.s104
2 files changed, 105 insertions, 1 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/arm64.s b/src/cmd/asm/internal/asm/testdata/arm64.s
index 93f70045b7..4af47fc626 100644
--- a/src/cmd/asm/internal/asm/testdata/arm64.s
+++ b/src/cmd/asm/internal/asm/testdata/arm64.s
@@ -1221,7 +1221,7 @@ again:
MRS DBGCLAIMSET_EL1, R7 // c77830d5
MSR R13, DBGCLAIMSET_EL1 // cd7810d5
MRS DBGDTRRX_EL0, R0 // 000533d5
- MSR R29, DBGDTRRX_EL0 // 1d0513d5
+ MSR R29, DBGDTRTX_EL0 // 1d0513d5
MRS DBGDTR_EL0, R27 // 1b0433d5
MSR R30, DBGDTR_EL0 // 1e0413d5
MRS DBGPRCR_EL1, R4 // 841430d5
diff --git a/src/cmd/asm/internal/asm/testdata/arm64error.s b/src/cmd/asm/internal/asm/testdata/arm64error.s
index 387836dcbe..7dfca1a1fe 100644
--- a/src/cmd/asm/internal/asm/testdata/arm64error.s
+++ b/src/cmd/asm/internal/asm/testdata/arm64error.s
@@ -232,4 +232,108 @@ TEXT errors(SB),$0
STXPW (R5, R7), (R6), RSP // ERROR "illegal destination register"
STLXP (R5, R7), (R6), RSP // ERROR "illegal destination register"
STLXP (R5, R7), (R6), RSP // ERROR "illegal destination register"
+ MSR OSLAR_EL1, R5 // ERROR "illegal combination"
+ MRS R11, AIDR_EL1 // ERROR "illegal combination"
+ MSR R6, AIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, AMCFGR_EL0 // ERROR "system register is not writable"
+ MSR R6, AMCGCR_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER00_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER01_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER02_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER03_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER04_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER05_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER06_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER07_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER08_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER09_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER010_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER011_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER012_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER013_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER014_EL0 // ERROR "system register is not writable"
+ MSR R6, AMEVTYPER015_EL0 // ERROR "system register is not writable"
+ MSR R6, CCSIDR2_EL1 // ERROR "system register is not writable"
+ MSR R6, CCSIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, CLIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, CNTPCT_EL0 // ERROR "system register is not writable"
+ MSR R6, CNTVCT_EL0 // ERROR "system register is not writable"
+ MSR R6, CTR_EL0 // ERROR "system register is not writable"
+ MSR R6, CurrentEL // ERROR "system register is not writable"
+ MSR R6, DBGAUTHSTATUS_EL1 // ERROR "system register is not writable"
+ MSR R6, DBGDTRRX_EL0 // ERROR "system register is not writable"
+ MSR R6, DCZID_EL0 // ERROR "system register is not writable"
+ MSR R6, ERRIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, ERXFR_EL1 // ERROR "system register is not writable"
+ MSR R6, ERXPFGF_EL1 // ERROR "system register is not writable"
+ MSR R6, GMID_EL1 // ERROR "system register is not writable"
+ MSR R6, ICC_HPPIR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ICC_HPPIR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ICC_IAR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ICC_IAR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ICC_RPR_EL1 // ERROR "system register is not writable"
+ MSR R6, ICV_HPPIR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ICV_HPPIR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ICV_IAR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ICV_IAR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ICV_RPR_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64AFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64AFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64DFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64DFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64ISAR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64ISAR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64MMFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64MMFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64MMFR2_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64PFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64PFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AA64ZFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_AFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_DFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR2_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR3_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR4_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR5_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_ISAR6_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_MMFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_MMFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_MMFR2_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_MMFR3_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_MMFR4_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_PFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_PFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, ID_PFR2_EL1 // ERROR "system register is not writable"
+ MSR R6, ISR_EL1 // ERROR "system register is not writable"
+ MSR R6, LORID_EL1 // ERROR "system register is not writable"
+ MSR R6, MDCCSR_EL0 // ERROR "system register is not writable"
+ MSR R6, MDRAR_EL1 // ERROR "system register is not writable"
+ MSR R6, MIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, MPAMIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, MPIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, MVFR0_EL1 // ERROR "system register is not writable"
+ MSR R6, MVFR1_EL1 // ERROR "system register is not writable"
+ MSR R6, MVFR2_EL1 // ERROR "system register is not writable"
+ MSR R6, OSLSR_EL1 // ERROR "system register is not writable"
+ MSR R6, PMBIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, PMCEID0_EL0 // ERROR "system register is not writable"
+ MSR R6, PMCEID1_EL0 // ERROR "system register is not writable"
+ MSR R6, PMMIR_EL1 // ERROR "system register is not writable"
+ MSR R6, PMSIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, REVIDR_EL1 // ERROR "system register is not writable"
+ MSR R6, RNDR // ERROR "system register is not writable"
+ MRS DBGDTRTX_EL0, R5 // ERROR "system register is not readable"
+ MRS ICV_DIR_EL1, R5 // ERROR "system register is not readable"
+ MRS ICC_SGI1R_EL1, R5 // ERROR "system register is not readable"
+ MRS ICC_SGI0R_EL1, R5 // ERROR "system register is not readable"
+ MRS ICC_EOIR1_EL1, R5 // ERROR "system register is not readable"
+ MRS ICC_EOIR0_EL1, R5 // ERROR "system register is not readable"
+ MRS ICC_DIR_EL1, R5 // ERROR "system register is not readable"
+ MRS ICC_ASGI1R_EL1, R5 // ERROR "system register is not readable"
+ MRS ICV_EOIR0_EL1, R3 // ERROR "system register is not readable"
+ MRS ICV_EOIR1_EL1, R3 // ERROR "system register is not readable"
+ MRS PMSWINC_EL0, R3 // ERROR "system register is not readable"
+ MRS OSLAR_EL1, R3 // ERROR "system register is not readable"
RET