@@ -4696,12 +4696,11 @@ static inline bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx)
* R/W protection flags
*/
static inline int get_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx,
- int ap, int domain_prot)
+ bool is_user, int ap, int domain_prot)
{
bool simple_ap = regime_using_lpae_format(env, mmu_idx)
|| (regime_sctlr(env, mmu_idx) & SCTLR_AFE);
bool domain_prot_valid = !regime_using_lpae_format(env, mmu_idx);
- bool is_user = regime_is_user(env, mmu_idx);
if (domain_prot_valid && domain_prot == 3) {
return PAGE_READ | PAGE_WRITE;
@@ -4881,7 +4880,8 @@ static int get_phys_addr_v5(CPUARMState *env, uint32_t address, int access_type,
}
code = 15;
}
- *prot = get_rw_prot(env, mmu_idx, ap, domain_prot);
+ *prot = get_rw_prot(env, mmu_idx, regime_is_user(env, mmu_idx),
+ ap, domain_prot);
*prot |= *prot ? PAGE_EXEC : 0;
if (!(*prot & (1 << access_type))) {
/* Access permission fault. */
@@ -4989,7 +4989,9 @@ static int get_phys_addr_v6(CPUARMState *env, uint32_t address, int access_type,
if (domain_prot == 3) {
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
} else {
- if (pxn && !regime_is_user(env, mmu_idx)) {
+ bool is_user = regime_is_user(env, mmu_idx);
+
+ if (pxn && !is_user) {
xn = 1;
}
if (xn && access_type == 2)
@@ -5002,7 +5004,7 @@ static int get_phys_addr_v6(CPUARMState *env, uint32_t address, int access_type,
code = (code == 15) ? 6 : 3;
goto do_fault;
}
- *prot = get_rw_prot(env, mmu_idx, ap, domain_prot);
+ *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. */
Give callers the ability to get page protection flags for PL0, even if not currently operating in PL0. This puts the burden of determining 'is_user' on the caller (again - it was this way before regime_is_user was introduced), but will be useful in a following patch. Signed-off-by: Andrew Jones <drjones@redhat.com> --- target-arm/helper.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)