[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 68/72] target/ppc/mmu-hash32.c: Drop a local variable
From: |
Nicholas Piggin |
Subject: |
[PULL 68/72] target/ppc/mmu-hash32.c: Drop a local variable |
Date: |
Fri, 24 May 2024 09:07:41 +1000 |
From: BALATON Zoltan <balaton@eik.bme.hu>
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.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-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.43.0
- [PULL 59/72] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate(), (continued)
- [PULL 59/72] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate(), Nicholas Piggin, 2024/05/23
- [PULL 57/72] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke206_get_physical_address(), Nicholas Piggin, 2024/05/23
- [PULL 58/72] target/ppc/mmu_common.c: Remove BookE from direct store handling, Nicholas Piggin, 2024/05/23
- [PULL 64/72] target/ppc/mmu_common.c: Transform ppc_jumbo_xlate() into ppc_6xx_xlate(), Nicholas Piggin, 2024/05/23
- [PULL 60/72] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 1, Nicholas Piggin, 2024/05/23
- [PULL 61/72] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 2, Nicholas Piggin, 2024/05/23
- [PULL 63/72] target/ppc/mmu_common.c: Split off 40x cases from ppc_jumbo_xlate(), Nicholas Piggin, 2024/05/23
- [PULL 62/72] target/ppc/mmu_common.c: Split off real mode handling from get_physical_address_wtlb(), Nicholas Piggin, 2024/05/23
- [PULL 66/72] target/ppc: Remove id_tlbs flag from CPU env, Nicholas Piggin, 2024/05/23
- [PULL 65/72] target/ppc/mmu_common.c: Move mmu_ctx_t type to mmu_common.c, Nicholas Piggin, 2024/05/23
- [PULL 68/72] target/ppc/mmu-hash32.c: Drop a local variable,
Nicholas Piggin <=
- [PULL 67/72] target/ppc: Split off common embedded TLB init, Nicholas Piggin, 2024/05/23
- [PULL 70/72] target/ppc: Add a function to check for page protection bit, Nicholas Piggin, 2024/05/23
- [PULL 69/72] target/ppc/mmu-radix64.c: Drop a local variable, Nicholas Piggin, 2024/05/23
- [PULL 72/72] target/ppc: Remove pp_check() and reuse ppc_hash32_pp_prot(), Nicholas Piggin, 2024/05/23
- [PULL 71/72] target/ppc: Move out BookE and related MMU functions from mmu_common.c, Nicholas Piggin, 2024/05/23
- Re: [PULL 00/72] ppc-for-9.1-1 queue, Nicholas Piggin, 2024/05/23
- [PULL 00/72] ppc-for-9.1-1 queue, Nicholas Piggin, 2024/05/23