[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/29] target/ppc: Eliminate goto in mmubooke_check_tlb()
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 19/29] target/ppc: Eliminate goto in mmubooke_check_tlb() |
Date: |
Sat, 10 Jun 2023 10:31:22 -0300 |
From: BALATON Zoltan <balaton@eik.bme.hu>
Move out checking PID registers into a separate function which makes
mmubooke_check_tlb() simpler and avoids using goto.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id:
<bd84d5f38af0ba2983ccd5c07635db49267c828f.1685448535.git.balaton@eik.bme.hu>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/mmu_common.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
index bd7d7d5257..ae1db6e348 100644
--- a/target/ppc/mmu_common.c
+++ b/target/ppc/mmu_common.c
@@ -601,37 +601,39 @@ static int mmu40x_get_physical_address(CPUPPCState *env,
mmu_ctx_t *ctx,
return ret;
}
-static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb,
- hwaddr *raddr, int *prot, target_ulong address,
- MMUAccessType access_type, int i)
+static bool mmubooke_check_pid(CPUPPCState *env, ppcemb_tlb_t *tlb,
+ hwaddr *raddr, target_ulong addr, int i)
{
- int prot2;
-
- if (ppcemb_tlb_check(env, tlb, raddr, address,
- env->spr[SPR_BOOKE_PID], i)) {
+ if (ppcemb_tlb_check(env, tlb, raddr, addr, env->spr[SPR_BOOKE_PID], i)) {
if (!env->nb_pids) {
/* Extend the physical address to 36 bits */
*raddr |= (uint64_t)(tlb->RPN & 0xF) << 32;
}
- goto found_tlb;
+ return true;
+ } else if (!env->nb_pids) {
+ return false;
}
-
if (env->spr[SPR_BOOKE_PID1] &&
- ppcemb_tlb_check(env, tlb, raddr, address,
- env->spr[SPR_BOOKE_PID1], i)) {
- goto found_tlb;
+ ppcemb_tlb_check(env, tlb, raddr, addr, env->spr[SPR_BOOKE_PID1], i)) {
+ return true;
}
-
if (env->spr[SPR_BOOKE_PID2] &&
- ppcemb_tlb_check(env, tlb, raddr, address,
- env->spr[SPR_BOOKE_PID2], i)) {
- goto found_tlb;
+ ppcemb_tlb_check(env, tlb, raddr, addr, env->spr[SPR_BOOKE_PID2], i)) {
+ return true;
}
+ return false;
+}
- qemu_log_mask(CPU_LOG_MMU, "%s: TLB entry not found\n", __func__);
- return -1;
+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;
-found_tlb:
+ if (!mmubooke_check_pid(env, tlb, raddr, address, i)) {
+ qemu_log_mask(CPU_LOG_MMU, "%s: TLB entry not found\n", __func__);
+ return -1;
+ }
if (FIELD_EX64(env->msr, MSR, PR)) {
prot2 = tlb->prot & 0xF;
--
2.40.1
- [PULL 09/29] target/ppc: PMU do not clear MMCR0[FCECE] on performance monitor alert, (continued)
- [PULL 09/29] target/ppc: PMU do not clear MMCR0[FCECE] on performance monitor alert, Daniel Henrique Barboza, 2023/06/10
- [PULL 10/29] target/ppc: Fix msgclrp interrupt type, Daniel Henrique Barboza, 2023/06/10
- [PULL 11/29] target/ppc: Support directed privileged doorbell interrupt (SDOOR), Daniel Henrique Barboza, 2023/06/10
- [PULL 12/29] target/ppc: PMU implement PERFM interrupts, Daniel Henrique Barboza, 2023/06/10
- [PULL 14/29] target/ppc: Remove "ext" parameter of ppcemb_tlb_check(), Daniel Henrique Barboza, 2023/06/10
- [PULL 13/29] target/ppc: Remove single use function, Daniel Henrique Barboza, 2023/06/10
- [PULL 15/29] target/ppc: Move ppcemb_tlb_search() to mmu_common.c, Daniel Henrique Barboza, 2023/06/10
- [PULL 16/29] target/ppc: Remove some unneded line breaks, Daniel Henrique Barboza, 2023/06/10
- [PULL 17/29] target/ppc: Simplify ppcemb_tlb_search(), Daniel Henrique Barboza, 2023/06/10
- [PULL 18/29] target/ppc: Change ppcemb_tlb_check() to return bool, Daniel Henrique Barboza, 2023/06/10
- [PULL 19/29] target/ppc: Eliminate goto in mmubooke_check_tlb(),
Daniel Henrique Barboza <=
- [PULL 20/29] target/ppc: Fix lqarx to set cpu_reserve, Daniel Henrique Barboza, 2023/06/10
- [PULL 22/29] target/ppc: Remove larx/stcx. memory barrier semantics, Daniel Henrique Barboza, 2023/06/10
- [PULL 23/29] target/ppc: Rework store conditional to avoid branch, Daniel Henrique Barboza, 2023/06/10
- [PULL 21/29] target/ppc: Ensure stcx size matches larx, Daniel Henrique Barboza, 2023/06/10
- [PULL 24/29] target/ppc: Fix decrementer time underflow and infinite timer loop, Daniel Henrique Barboza, 2023/06/10
- [PULL 25/29] target/ppc: Decrementer fix BookE semantics, Daniel Henrique Barboza, 2023/06/10
- [PULL 26/29] hw/ppc/openpic: Do not open-code ROUND_UP() macro, Daniel Henrique Barboza, 2023/06/10
- [PULL 27/29] tests/avocado/tuxrun_baselines: Fix ppc64 tests for binaries without slirp, Daniel Henrique Barboza, 2023/06/10
- [PULL 28/29] target/ppc: Implement gathering irq statistics, Daniel Henrique Barboza, 2023/06/10
- [PULL 29/29] hw/ppc/Kconfig: MAC_NEWWORLD should always select USB_OHCI_PCI, Daniel Henrique Barboza, 2023/06/10