[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 32/48] target/ppc/mmu-hash32.c: Drop a local variable
From: |
BALATON Zoltan |
Subject: |
[PATCH v6 32/48] target/ppc/mmu-hash32.c: Drop a local variable |
Date: |
Sat, 11 May 2024 03:46:12 +0200 (CEST) |
In ppc_hash32_xlate() the value of need_prop is checked in two places
but precalculating it does not help because when we reach the first
check we always return and not reach the second place so the value
will only be used once. We can drop the local variable and calculate
it when needed, which makes these checks using it similar to other
places with such checks.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
---
target/ppc/mmu-hash32.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c
index 21fc731771..bf5ce129d2 100644
--- a/target/ppc/mmu-hash32.c
+++ b/target/ppc/mmu-hash32.c
@@ -341,7 +341,6 @@ bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr,
MMUAccessType access_type,
hwaddr pte_offset;
ppc_hash_pte32_t pte;
int prot;
- int need_prot;
hwaddr raddr;
/* There are no hash32 large pages. */
@@ -355,13 +354,11 @@ bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr,
MMUAccessType access_type,
return true;
}
- need_prot = prot_for_access_type(access_type);
-
/* 2. Check Block Address Translation entries (BATs) */
if (env->nb_BATs != 0) {
raddr = ppc_hash32_bat_lookup(cpu, eaddr, access_type, protp, mmu_idx);
if (raddr != -1) {
- if (need_prot & ~*protp) {
+ if (prot_for_access_type(access_type) & ~*protp) {
if (guest_visible) {
if (access_type == MMU_INST_FETCH) {
cs->exception_index = POWERPC_EXCP_ISI;
@@ -429,7 +426,7 @@ bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr,
MMUAccessType access_type,
prot = ppc_hash32_pte_prot(mmu_idx, sr, pte);
- if (need_prot & ~prot) {
+ if (prot_for_access_type(access_type) & ~prot) {
/* Access right violation */
qemu_log_mask(CPU_LOG_MMU, "PTE access rejected\n");
if (guest_visible) {
--
2.30.9
- [PATCH v6 02/48] target/ppc: Remove unused helper, (continued)
- [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
- [PATCH v6 32/48] target/ppc/mmu-hash32.c: Drop a local variable,
BALATON Zoltan <=
- [PATCH v6 18/48] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke_get_physical_address(), BALATON Zoltan, 2024/05/10
- [PATCH v6 22/48] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/10
- [PATCH v6 15/48] target/ppc/mmu_common.c: Deindent ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/10
- [PATCH v6 27/48] target/ppc/mmu_common.c: Transform ppc_jumbo_xlate() into ppc_6xx_xlate(), BALATON Zoltan, 2024/05/10
- [PATCH v6 21/48] target/ppc/mmu_common.c: Remove BookE from direct store handling, BALATON Zoltan, 2024/05/10
- [PATCH v6 16/48] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/10
- [PATCH v6 07/48] target/ppc/mmu_common.c: Introduce mmu6xx_get_physical_address(), BALATON Zoltan, 2024/05/10
- [PATCH v6 26/48] target/ppc/mmu_common.c: Split off 40x cases from ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/10
- [PATCH v6 17/48] target/ppc/mmu_common.c: Don't use mmu_ctx_t for mmu40x_get_physical_address(), BALATON Zoltan, 2024/05/10
- [PATCH v6 09/48] target/ppc/mmu_common.c: Move some debug logging, BALATON Zoltan, 2024/05/10