From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLvKc-0002k3-R1 for qemu-devel@nongnu.org; Thu, 12 Feb 2015 10:05:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLvKV-0006cl-Pc for qemu-devel@nongnu.org; Thu, 12 Feb 2015 10:05:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLvKV-0006cb-Gp for qemu-devel@nongnu.org; Thu, 12 Feb 2015 10:05:23 -0500 From: Andrew Jones Date: Thu, 12 Feb 2015 16:05:07 +0100 Message-Id: <1423753507-30542-6-git-send-email-drjones@redhat.com> In-Reply-To: <1423753507-30542-1-git-send-email-drjones@redhat.com> References: <1423753507-30542-1-git-send-email-drjones@redhat.com> Subject: [Qemu-devel] [PATCH 5/5] target-arm: apply get_S1prot to get_phys_addr_v6 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org 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 --- 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