[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/28] target/ppc/mmu_common.c: Move calculation of a value cl
From: |
BALATON Zoltan |
Subject: |
[PATCH v2 05/28] target/ppc/mmu_common.c: Move calculation of a value closer to its usage |
Date: |
Thu, 02 May 2024 01:43:10 +0200 (CEST) |
In mmubooke_check_tlb() prot2 is calculated first but only used after
an unrelated check that can return before tha value is used. Move the
calculation after the check, closer to where it is used, to keep them
together and avoid computing it when not needed.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
target/ppc/mmu_common.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
index 751403f1c8..168ff842a5 100644
--- a/target/ppc/mmu_common.c
+++ b/target/ppc/mmu_common.c
@@ -634,12 +634,6 @@ static int mmubooke_check_tlb(CPUPPCState *env,
ppcemb_tlb_t *tlb,
return -1;
}
- if (FIELD_EX64(env->msr, MSR, PR)) {
- prot2 = tlb->prot & 0xF;
- } else {
- prot2 = (tlb->prot >> 4) & 0xF;
- }
-
/* Check the address space */
if ((access_type == MMU_INST_FETCH ?
FIELD_EX64(env->msr, MSR, IR) :
@@ -648,6 +642,11 @@ static int mmubooke_check_tlb(CPUPPCState *env,
ppcemb_tlb_t *tlb,
return -1;
}
+ if (FIELD_EX64(env->msr, MSR, PR)) {
+ prot2 = tlb->prot & 0xF;
+ } else {
+ prot2 = (tlb->prot >> 4) & 0xF;
+ }
*prot = prot2;
if (prot2 & prot_for_access_type(access_type)) {
qemu_log_mask(CPU_LOG_MMU, "%s: good TLB!\n", __func__);
--
2.30.9
- [PATCH v2 00/28] Misc PPC exception and BookE MMU clean ups, BALATON Zoltan, 2024/05/01
- [PATCH v2 03/28] target/ppc: Simplify syscall exception handlers, BALATON Zoltan, 2024/05/01
- [PATCH v2 02/28] target/ppc: Move patching nip from exception handler to helper_scv, BALATON Zoltan, 2024/05/01
- [PATCH v2 04/28] target/ppc: Remove unused helper, BALATON Zoltan, 2024/05/01
- [PATCH v2 01/28] target/ppc: Fix gen_sc to use correct nip, BALATON Zoltan, 2024/05/01
- [PATCH v2 05/28] target/ppc/mmu_common.c: Move calculation of a value closer to its usage,
BALATON Zoltan <=
- [PATCH v2 09/28] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU, BALATON Zoltan, 2024/05/01
- [PATCH v2 11/28] target/ppc/mmu_common.c: Rename get_bat_6xx_tlb(), BALATON Zoltan, 2024/05/01
- [PATCH v2 06/28] target/ppc/mmu_common.c: Move calculation of a value closer to its usage, BALATON Zoltan, 2024/05/01
- [PATCH v2 12/28] target/ppc/mmu_common.c: Split out BookE cases before checking real mode, BALATON Zoltan, 2024/05/01
- [PATCH v2 07/28] target/ppc/mmu_common.c: Remove unneeded local variable, BALATON Zoltan, 2024/05/01