mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
target/ppc: Eliminate goto in mmubooke_check_tlb()
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>
This commit is contained in:
parent
2b23daa8eb
commit
a5436bc6ed
1 changed files with 26 additions and 24 deletions
|
@ -601,37 +601,39 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool mmubooke_check_pid(CPUPPCState *env, ppcemb_tlb_t *tlb,
|
||||||
|
hwaddr *raddr, target_ulong addr, int 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;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else if (!env->nb_pids) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (env->spr[SPR_BOOKE_PID1] &&
|
||||||
|
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, addr, env->spr[SPR_BOOKE_PID2], i)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb,
|
static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb,
|
||||||
hwaddr *raddr, int *prot, target_ulong address,
|
hwaddr *raddr, int *prot, target_ulong address,
|
||||||
MMUAccessType access_type, int i)
|
MMUAccessType access_type, int i)
|
||||||
{
|
{
|
||||||
int prot2;
|
int prot2;
|
||||||
|
|
||||||
if (ppcemb_tlb_check(env, tlb, raddr, address,
|
if (!mmubooke_check_pid(env, tlb, raddr, address, i)) {
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (env->spr[SPR_BOOKE_PID1] &&
|
|
||||||
ppcemb_tlb_check(env, tlb, raddr, address,
|
|
||||||
env->spr[SPR_BOOKE_PID1], i)) {
|
|
||||||
goto found_tlb;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (env->spr[SPR_BOOKE_PID2] &&
|
|
||||||
ppcemb_tlb_check(env, tlb, raddr, address,
|
|
||||||
env->spr[SPR_BOOKE_PID2], i)) {
|
|
||||||
goto found_tlb;
|
|
||||||
}
|
|
||||||
|
|
||||||
qemu_log_mask(CPU_LOG_MMU, "%s: TLB entry not found\n", __func__);
|
qemu_log_mask(CPU_LOG_MMU, "%s: TLB entry not found\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
found_tlb:
|
|
||||||
|
|
||||||
if (FIELD_EX64(env->msr, MSR, PR)) {
|
if (FIELD_EX64(env->msr, MSR, PR)) {
|
||||||
prot2 = tlb->prot & 0xF;
|
prot2 = tlb->prot & 0xF;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue