[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 04/48] target/ppc/mmu_common.c: Remove unneeded local variable
|
From: |
BALATON Zoltan |
|
Subject: |
[PATCH v6 04/48] target/ppc/mmu_common.c: Remove unneeded local variable |
|
Date: |
Sat, 11 May 2024 03:45:42 +0200 (CEST) |
In mmubooke_check_tlb() and mmubooke206_check_tlb() we can assign the
value of prot2 directly to the destination, no need to have a separate
local variable for it.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
---
target/ppc/mmu_common.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
index f79e390306..09cbeb0052 100644
--- a/target/ppc/mmu_common.c
+++ b/target/ppc/mmu_common.c
@@ -628,8 +628,6 @@ static int mmubooke_check_tlb(CPUPPCState *env,
ppcemb_tlb_t *tlb,
hwaddr *raddr, int *prot, target_ulong address,
MMUAccessType access_type, int i)
{
- int prot2;
-
if (!mmubooke_check_pid(env, tlb, raddr, address, i)) {
qemu_log_mask(CPU_LOG_MMU, "%s: TLB entry not found\n", __func__);
return -1;
@@ -644,17 +642,16 @@ static int mmubooke_check_tlb(CPUPPCState *env,
ppcemb_tlb_t *tlb,
}
if (FIELD_EX64(env->msr, MSR, PR)) {
- prot2 = tlb->prot & 0xF;
+ *prot = tlb->prot & 0xF;
} else {
- prot2 = (tlb->prot >> 4) & 0xF;
+ *prot = (tlb->prot >> 4) & 0xF;
}
- *prot = prot2;
- if (prot2 & prot_for_access_type(access_type)) {
+ if (*prot & prot_for_access_type(access_type)) {
qemu_log_mask(CPU_LOG_MMU, "%s: good TLB!\n", __func__);
return 0;
}
- qemu_log_mask(CPU_LOG_MMU, "%s: no prot match: %x\n", __func__, prot2);
+ qemu_log_mask(CPU_LOG_MMU, "%s: no prot match: %x\n", __func__, *prot);
return access_type == MMU_INST_FETCH ? -3 : -2;
}
@@ -795,7 +792,6 @@ static int mmubooke206_check_tlb(CPUPPCState *env,
ppcmas_tlb_t *tlb,
target_ulong address,
MMUAccessType access_type, int mmu_idx)
{
- int prot2 = 0;
uint32_t epid;
bool as, pr;
bool use_epid = mmubooke206_get_as(env, mmu_idx, &epid, &as, &pr);
@@ -841,34 +837,34 @@ found_tlb:
return -1;
}
+ *prot = 0;
if (pr) {
if (tlb->mas7_3 & MAS3_UR) {
- prot2 |= PAGE_READ;
+ *prot |= PAGE_READ;
}
if (tlb->mas7_3 & MAS3_UW) {
- prot2 |= PAGE_WRITE;
+ *prot |= PAGE_WRITE;
}
if (tlb->mas7_3 & MAS3_UX) {
- prot2 |= PAGE_EXEC;
+ *prot |= PAGE_EXEC;
}
} else {
if (tlb->mas7_3 & MAS3_SR) {
- prot2 |= PAGE_READ;
+ *prot |= PAGE_READ;
}
if (tlb->mas7_3 & MAS3_SW) {
- prot2 |= PAGE_WRITE;
+ *prot |= PAGE_WRITE;
}
if (tlb->mas7_3 & MAS3_SX) {
- prot2 |= PAGE_EXEC;
+ *prot |= PAGE_EXEC;
}
}
- *prot = prot2;
- if (prot2 & prot_for_access_type(access_type)) {
+ if (*prot & prot_for_access_type(access_type)) {
qemu_log_mask(CPU_LOG_MMU, "%s: good TLB!\n", __func__);
return 0;
}
- qemu_log_mask(CPU_LOG_MMU, "%s: no prot match: %x\n", __func__, prot2);
+ qemu_log_mask(CPU_LOG_MMU, "%s: no prot match: %x\n", __func__, *prot);
return access_type == MMU_INST_FETCH ? -3 : -2;
}
--
2.30.9
- [PATCH v6 00/48] Misc PPC exception and BookE MMU clean ups, BALATON Zoltan, 2024/05/10
- [PATCH v6 03/48] target/ppc/mmu_common.c: Move calculation of a value closer to its usage, BALATON Zoltan, 2024/05/10
- [PATCH v6 04/48] target/ppc/mmu_common.c: Remove unneeded local variable,
BALATON Zoltan <=
- [PATCH v6 02/48] target/ppc: Remove unused helper, BALATON Zoltan, 2024/05/10
- [PATCH v6 01/48] target/ppc: Remove unused struct 'mmu_ctx_hash32', BALATON Zoltan, 2024/05/10
- [PATCH v6 05/48] target/ppc/mmu_common.c: Simplify checking for real mode, BALATON Zoltan, 2024/05/10
- [PATCH v6 06/48] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU, BALATON Zoltan, 2024/05/10
- [PATCH v6 12/48] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb(), BALATON Zoltan, 2024/05/10
- [PATCH v6 11/48] target/ppc/mmu_common.c: Split out BookE cases before checking real mode, BALATON Zoltan, 2024/05/10
- [PATCH v6 10/48] target/ppc/mmu_common.c: Eliminate ret from mmu6xx_get_physical_address(), BALATON Zoltan, 2024/05/10
- [PATCH v6 29/48] target/ppc/mmu_common.c: Remove pte_update_flags(), BALATON Zoltan, 2024/05/10
- [PATCH v6 14/48] target/ppc/mmu_common.c: Fix misindented qemu_log_mask() calls, BALATON Zoltan, 2024/05/10
- [PATCH v6 13/48] target/ppc/mmu_common.c: Inline and remove check_physical(), BALATON Zoltan, 2024/05/10