[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 31/61] target/ppc/mmu-hash32.c: Drop a local variable
From: |
BALATON Zoltan |
Subject: |
[PATCH v7 31/61] target/ppc/mmu-hash32.c: Drop a local variable |
Date: |
Mon, 13 May 2024 01:28:05 +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 da6e8b293c..3abaf16e78 100644
--- a/target/ppc/mmu-hash32.c
+++ b/target/ppc/mmu-hash32.c
@@ -386,7 +386,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. */
@@ -400,13 +399,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;
@@ -474,7 +471,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 v7 20/61] target/ppc/mmu_common.c: Remove BookE from direct store handling, (continued)
- [PATCH v7 20/61] target/ppc/mmu_common.c: Remove BookE from direct store handling, BALATON Zoltan, 2024/05/12
- [PATCH v7 22/61] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 1, BALATON Zoltan, 2024/05/12
- [PATCH v7 25/61] target/ppc/mmu_common.c: Split off 40x cases from ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/12
- [PATCH v7 26/61] target/ppc/mmu_common.c: Transform ppc_jumbo_xlate() into ppc_6xx_xlate(), BALATON Zoltan, 2024/05/12
- [PATCH v7 27/61] target/ppc/mmu_common.c: Move mmu_ctx_t type to mmu_common.c, BALATON Zoltan, 2024/05/12
- [PATCH v7 28/61] target/ppc/mmu_common.c: Remove pte_update_flags(), BALATON Zoltan, 2024/05/12
- [PATCH v7 29/61] target/ppc: Remove id_tlbs flag from CPU env, BALATON Zoltan, 2024/05/12
- [PATCH v7 31/61] target/ppc/mmu-hash32.c: Drop a local variable,
BALATON Zoltan <=
- [PATCH v7 32/61] target/ppc/mmu-radix64.c: Drop a local variable, BALATON Zoltan, 2024/05/12
- [PATCH v7 35/61] target/ppc: Remove pp_check() and reuse ppc_hash32_pp_prot(), BALATON Zoltan, 2024/05/12
- [PATCH v7 37/61] target/ppc/mmu_common.c: Remove single use local variable, BALATON Zoltan, 2024/05/12
- [PATCH v7 39/61] target/ppc/mmu_common.c: Remove another single use local, BALATON Zoltan, 2024/05/12
- [PATCH v7 33/61] target/ppc: Add a function to check for page protection bit, BALATON Zoltan, 2024/05/12
- [PATCH v7 41/61] target/ppc/mmu_common.c: Return directly in ppc6xx_tlb_pte_check(), BALATON Zoltan, 2024/05/12
- [PATCH v7 36/61] target/ppc/mmu_common.c: Remove local name for a constant, BALATON Zoltan, 2024/05/12