[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/24] target/ppc: Remove type argument from check_prot
From: |
Richard Henderson |
Subject: |
[PATCH 07/24] target/ppc: Remove type argument from check_prot |
Date: |
Tue, 18 May 2021 15:11:29 -0500 |
We can now use MMU_INST_FETCH from access_type for this.
Use prot_for_access_type to simplify everything.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/mmu_helper.c | 35 +++++++----------------------------
1 file changed, 7 insertions(+), 28 deletions(-)
diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 2aa1b777de..e3912e4094 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -32,6 +32,7 @@
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "qemu/qemu-print.h"
+#include "internal.h"
#include "mmu-book3s-v3.h"
#include "mmu-radix64.h"
@@ -126,33 +127,11 @@ static int pp_check(int key, int pp, int nx)
return access;
}
-static int check_prot(int prot, MMUAccessType access_type, int type)
+static int check_prot(int prot, MMUAccessType access_type)
{
- int ret;
-
- if (type == ACCESS_CODE) {
- if (prot & PAGE_EXEC) {
- ret = 0;
- } else {
- ret = -2;
- }
- } else if (access_type == MMU_DATA_STORE) {
- if (prot & PAGE_WRITE) {
- ret = 0;
- } else {
- ret = -2;
- }
- } else {
- if (prot & PAGE_READ) {
- ret = 0;
- } else {
- ret = -2;
- }
- }
-
- return ret;
+ return prot & prot_for_access_type(access_type) ? 0 : -2;
}
-
+
static int ppc6xx_tlb_pte_check(mmu_ctx_t *ctx, target_ulong pte0,
target_ulong pte1, int h,
MMUAccessType access_type, int type)
@@ -182,7 +161,7 @@ static int ppc6xx_tlb_pte_check(mmu_ctx_t *ctx,
target_ulong pte0,
/* Keep the matching PTE information */
ctx->raddr = pte1;
ctx->prot = access;
- ret = check_prot(ctx->prot, access_type, type);
+ ret = check_prot(ctx->prot, access_type);
if (ret == 0) {
/* Access granted */
qemu_log_mask(CPU_LOG_MMU, "PTE access granted !\n");
@@ -441,7 +420,7 @@ static int get_bat_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx,
(virtual & 0x0001F000);
/* Compute access rights */
ctx->prot = prot;
- ret = check_prot(ctx->prot, access_type, type);
+ ret = check_prot(ctx->prot, access_type);
if (ret == 0) {
LOG_BATS("BAT %d match: r " TARGET_FMT_plx " prot=%c%c\n",
i, ctx->raddr, ctx->prot & PAGE_READ ? 'R' : '-',
@@ -733,7 +712,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env,
mmu_ctx_t *ctx,
check_perms:
/* Check from TLB entry */
ctx->prot = tlb->prot;
- ret = check_prot(ctx->prot, access_type, type);
+ ret = check_prot(ctx->prot, access_type);
if (ret == -2) {
env->spr[SPR_40x_ESR] = 0;
}
--
2.25.1
- [PATCH 00/24] target/ppc: Clean up mmu translation, Richard Henderson, 2021/05/18
- [PATCH 01/24] target/ppc: Introduce prot_for_access_type, Richard Henderson, 2021/05/18
- [PATCH 02/24] target/ppc: Use MMUAccessType in mmu-radix64.c, Richard Henderson, 2021/05/18
- [PATCH 03/24] target/ppc: Use MMUAccessType in mmu-hash64.c, Richard Henderson, 2021/05/18
- [PATCH 04/24] target/ppc: Use MMUAccessType in mmu-hash32.c, Richard Henderson, 2021/05/18
- [PATCH 05/24] target/ppc: Rename access_type to type in mmu_helper.c, Richard Henderson, 2021/05/18
- [PATCH 08/24] target/ppc: Remove type argument from ppc6xx_tlb_pte_check, Richard Henderson, 2021/05/18
- [PATCH 07/24] target/ppc: Remove type argument from check_prot,
Richard Henderson <=
- [PATCH 06/24] target/ppc: Use MMUAccessType in mmu_helper.c, Richard Henderson, 2021/05/18
- [PATCH 09/24] target/ppc: Remove type argument from ppc6xx_tlb_check, Richard Henderson, 2021/05/18
- [PATCH 11/24] target/ppc: Remove type argument from mmu40x_get_physical_address, Richard Henderson, 2021/05/18
- [PATCH 12/24] target/ppc: Remove type argument from mmubooke_check_tlb, Richard Henderson, 2021/05/18
- [PATCH 13/24] target/ppc: Remove type argument from mmubooke_get_physical_address, Richard Henderson, 2021/05/18
- [PATCH 10/24] target/ppc: Remove type argument from get_bat_6xx_tlb, Richard Henderson, 2021/05/18
- [PATCH 15/24] target/ppc: Remove type argument for mmubooke206_get_physical_address, Richard Henderson, 2021/05/18
- [PATCH 14/24] target/ppc: Remove type argument from mmubooke206_check_tlb, Richard Henderson, 2021/05/18
- [PATCH 16/24] target/ppc: Remove PowerPCCPUClass.handle_mmu_fault, Richard Henderson, 2021/05/18