qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 5/5] target-arm: apply get_S1prot to get_phys_addr_v


From: Andrew Jones
Subject: [Qemu-devel] [PATCH 5/5] target-arm: apply get_S1prot to get_phys_addr_v6
Date: Thu, 12 Feb 2015 16:05:07 +0100

Now that we have get_S1prot, we can apply it to get_phys_addr_v6
for a minor code cleanup.

Signed-off-by: Andrew Jones <address@hidden>
---
 target-arm/helper.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 20e5753bd216d..c41305e7e2bdf 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -5064,30 +5064,19 @@ static int get_phys_addr_v6(CPUARMState *env, uint32_t 
address, int access_type,
         }
         code = 15;
     }
-    if (domain_prot == 3) {
-        *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
-    } else {
-        bool is_user = regime_is_user(env, mmu_idx);
-
-        if (pxn && !is_user) {
-            xn = 1;
-        }
-        if (xn && access_type == 2)
-            goto do_fault;
-
+    if (regime_sctlr(env, mmu_idx) & SCTLR_AFE) {
         /* The simplified model uses AP[0] as an access control bit.  */
-        if ((regime_sctlr(env, mmu_idx) & SCTLR_AFE)
-                && (ap & 1) == 0) {
+        if ((ap & 1) == 0) {
             /* Access flag fault.  */
             code = (code == 15) ? 6 : 3;
             goto do_fault;
         }
-        *prot = get_rw_prot(env, mmu_idx, is_user, ap, domain_prot);
-        *prot |= *prot && !xn ? PAGE_EXEC : 0;
-        if (!(*prot & (1 << access_type))) {
-            /* Access permission fault.  */
-            goto do_fault;
-        }
+        ap >>= 1;
+    }
+    *prot = get_S1prot(env, mmu_idx, false, ap, domain_prot, 0, xn, pxn);
+    if (!(*prot & (1 << access_type))) {
+        /* Access permission fault.  */
+        goto do_fault;
     }
     *phys_ptr = phys_addr;
     return 0;
-- 
1.9.3




reply via email to

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