qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCHv2 2/3] target/arm: actually enable PAuth in user mod


From: Rémi Denis-Courmont
Subject: [Qemu-devel] [PATCHv2 2/3] target/arm: actually enable PAuth in user mode
Date: Sat, 26 Jan 2019 08:52:11 +0200

From: Remi Denis-Courmont <address@hidden>

This always enables IA, IB, DA and DB keys in user mode on the maximum
CPU, in a manner that is consistent with the other CPUs. That is to say
redefining the reset value of SCTLR_ELx registers.

Without this patch, the PAC* and AUT* instructions have no effects
(except PACGA of course).

Signed-off-by: Remi Denis-Courmont <address@hidden>
---
 target/arm/cpu64.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index e9bc461c36..c8ed943c65 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -287,7 +287,7 @@ static void cpu_max_get_packey(Object *obj, Visitor *v, 
const char *name,
 {
     ARMCPU *cpu = ARM_CPU(obj);
     const uint64_t *bit = opaque;
-    bool enabled = (cpu->env.cp15.sctlr_el[1] & *bit) != 0;
+    bool enabled = (cpu->reset_sctlr & *bit) != 0;
 
     visit_type_bool(v, name, &enabled, errp);
 }
@@ -304,9 +304,9 @@ static void cpu_max_set_packey(Object *obj, Visitor *v, 
const char *name,
 
     if (!err) {
         if (enabled) {
-            cpu->env.cp15.sctlr_el[1] |= *bit;
+            cpu->reset_sctlr |= *bit;
         } else {
-            cpu->env.cp15.sctlr_el[1] &= ~*bit;
+            cpu->reset_sctlr &= ~*bit;
         }
     }
     error_propagate(errp, err);
@@ -413,8 +413,8 @@ static void aarch64_max_initfn(Object *obj)
                                 (void *)&apdb_bit, &error_fatal);
 
             /* Enable all PAC keys by default.  */
-            cpu->env.cp15.sctlr_el[1] |= SCTLR_EnIA | SCTLR_EnIB;
-            cpu->env.cp15.sctlr_el[1] |= SCTLR_EnDA | SCTLR_EnDB;
+            cpu->reset_sctlr |= SCTLR_EnIA | SCTLR_EnIB;
+            cpu->reset_sctlr |= SCTLR_EnDA | SCTLR_EnDB;
         }
 #endif
 
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]