mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-15 08:59:30 -07:00
target/ppc: Move calculation of a value closer to its usage in booke tlb checks
In mmubooke_check_tlb() and mmubooke206_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. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
2b92822acc
commit
3f520078de
1 changed files with 17 additions and 19 deletions
|
|
@ -635,12 +635,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) :
|
||||
|
|
@ -649,6 +643,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__);
|
||||
|
|
@ -830,6 +829,18 @@ static int mmubooke206_check_tlb(CPUPPCState *env, ppcmas_tlb_t *tlb,
|
|||
|
||||
found_tlb:
|
||||
|
||||
/* Check the address space and permissions */
|
||||
if (access_type == MMU_INST_FETCH) {
|
||||
/* There is no way to fetch code using epid load */
|
||||
assert(!use_epid);
|
||||
as = FIELD_EX64(env->msr, MSR, IR);
|
||||
}
|
||||
|
||||
if (as != ((tlb->mas1 & MAS1_TS) >> MAS1_TS_SHIFT)) {
|
||||
qemu_log_mask(CPU_LOG_MMU, "%s: AS doesn't match\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pr) {
|
||||
if (tlb->mas7_3 & MAS3_UR) {
|
||||
prot2 |= PAGE_READ;
|
||||
|
|
@ -851,19 +862,6 @@ found_tlb:
|
|||
prot2 |= PAGE_EXEC;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the address space and permissions */
|
||||
if (access_type == MMU_INST_FETCH) {
|
||||
/* There is no way to fetch code using epid load */
|
||||
assert(!use_epid);
|
||||
as = FIELD_EX64(env->msr, MSR, IR);
|
||||
}
|
||||
|
||||
if (as != ((tlb->mas1 & MAS1_TS) >> MAS1_TS_SHIFT)) {
|
||||
qemu_log_mask(CPU_LOG_MMU, "%s: AS doesn't match\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*prot = prot2;
|
||||
if (prot2 & prot_for_access_type(access_type)) {
|
||||
qemu_log_mask(CPU_LOG_MMU, "%s: good TLB!\n", __func__);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue