From b009f915c9e744b1671f72806c5714af00a8ee89 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 30 Nov 2021 17:50:24 +0000 Subject: [PATCH] aarch64: Allow writes to MFAR_EL3 MFAR_EL3 is a read/write register, but was incorrectly marked as read-only [https://developer.arm.com/documentation/ddi0601/2021-09/AArch64-Registers/MFAR-EL3--PA-Fault-Address-Register?lang=en] opcodes/ * aarch64-opc.c (aarch64_sys_regs): Mark mfar_el3 as read-write. gas/ * testsuite/gas/aarch64/rme.s: Test writing to mfar_el3. * testsuite/gas/aarch64/rme.d: Update accordingly. * testsuite/gas/aarch64/rme-invalid.s: Delete. * testsuite/gas/aarch64/rme-invalid.l: Likewise. * testsuite/gas/aarch64/rme-invalid.d: Likewise. --- gas/testsuite/gas/aarch64/rme-invalid.d | 3 --- gas/testsuite/gas/aarch64/rme-invalid.l | 2 -- gas/testsuite/gas/aarch64/rme-invalid.s | 4 ---- gas/testsuite/gas/aarch64/rme.d | 23 ++++++++++++----------- gas/testsuite/gas/aarch64/rme.s | 1 + opcodes/aarch64-opc.c | 2 +- 6 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 gas/testsuite/gas/aarch64/rme-invalid.d delete mode 100644 gas/testsuite/gas/aarch64/rme-invalid.l delete mode 100644 gas/testsuite/gas/aarch64/rme-invalid.s diff --git a/gas/testsuite/gas/aarch64/rme-invalid.d b/gas/testsuite/gas/aarch64/rme-invalid.d deleted file mode 100644 index 091f40c6980..00000000000 --- a/gas/testsuite/gas/aarch64/rme-invalid.d +++ /dev/null @@ -1,3 +0,0 @@ -#name: Invalid RME System registers usage -#source: rme-invalid.s -#warning_output: rme-invalid.l diff --git a/gas/testsuite/gas/aarch64/rme-invalid.l b/gas/testsuite/gas/aarch64/rme-invalid.l deleted file mode 100644 index 7a9e3b22a3a..00000000000 --- a/gas/testsuite/gas/aarch64/rme-invalid.l +++ /dev/null @@ -1,2 +0,0 @@ -.*: Assembler messages: -.*: Warning: specified register cannot be written to at operand 1 -- `msr mfar_el3,x0' diff --git a/gas/testsuite/gas/aarch64/rme-invalid.s b/gas/testsuite/gas/aarch64/rme-invalid.s deleted file mode 100644 index d19ac9ca57a..00000000000 --- a/gas/testsuite/gas/aarch64/rme-invalid.s +++ /dev/null @@ -1,4 +0,0 @@ -/* Realm Management Extension. */ - -/* Illegal write to RME system registers. */ -msr mfar_el3, x0 diff --git a/gas/testsuite/gas/aarch64/rme.d b/gas/testsuite/gas/aarch64/rme.d index a714b78c346..e46339ff901 100644 --- a/gas/testsuite/gas/aarch64/rme.d +++ b/gas/testsuite/gas/aarch64/rme.d @@ -7,14 +7,15 @@ Disassembly of section \.text: 0+ <.*>: - 0: d53e60a0 mrs x0, mfar_el3 - 4: d53e21c0 mrs x0, gpccr_el3 - 8: d53e2180 mrs x0, gptbr_el3 - c: d51e21c0 msr gpccr_el3, x0 - 10: d51e2180 msr gptbr_el3, x0 - 14: d50e7e20 dc cipapa, x0 - 18: d50e7ea0 dc cigdpapa, x0 - 1c: d50e8460 tlbi rpaos, x0 - 20: d50e84e0 tlbi rpalos, x0 - 24: d50e819f tlbi paallos - 28: d50e879f tlbi paall +[^:]*: d53e60a0 mrs x0, mfar_el3 +[^:]*: d53e21c0 mrs x0, gpccr_el3 +[^:]*: d53e2180 mrs x0, gptbr_el3 +[^:]*: d51e60a0 msr mfar_el3, x0 +[^:]*: d51e21c0 msr gpccr_el3, x0 +[^:]*: d51e2180 msr gptbr_el3, x0 +[^:]*: d50e7e20 dc cipapa, x0 +[^:]*: d50e7ea0 dc cigdpapa, x0 +[^:]*: d50e8460 tlbi rpaos, x0 +[^:]*: d50e84e0 tlbi rpalos, x0 +[^:]*: d50e819f tlbi paallos +[^:]*: d50e879f tlbi paall diff --git a/gas/testsuite/gas/aarch64/rme.s b/gas/testsuite/gas/aarch64/rme.s index 21d9bd2deeb..d35687be992 100644 --- a/gas/testsuite/gas/aarch64/rme.s +++ b/gas/testsuite/gas/aarch64/rme.s @@ -6,6 +6,7 @@ mrs x0, gpccr_el3 mrs x0, gptbr_el3 /* Write to RME system registers. */ +msr mfar_el3, x0 msr gpccr_el3, x0 msr gptbr_el3, x0 diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index 372101a86a7..34b141eaed0 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -4833,7 +4833,7 @@ const aarch64_sys_reg aarch64_sys_regs [] = SR_CORE ("accdata_el1", CPENC (3,0,C13,C0,5), 0), - SR_CORE ("mfar_el3", CPENC (3,6,C6,C0,5), F_REG_READ), + SR_CORE ("mfar_el3", CPENC (3,6,C6,C0,5), 0), SR_CORE ("gpccr_el3", CPENC (3,6,C2,C1,6), 0), SR_CORE ("gptbr_el3", CPENC (3,6,C2,C1,4), 0), -- 2.30.2