target/ppc/mmu-hash32.c: Drop a local variable
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>
This commit is contained in:
parent
581eea5d65
commit
e89b0629b9
@ -386,7 +386,6 @@ bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
|
|||||||
hwaddr pte_offset;
|
hwaddr pte_offset;
|
||||||
ppc_hash_pte32_t pte;
|
ppc_hash_pte32_t pte;
|
||||||
int prot;
|
int prot;
|
||||||
int need_prot;
|
|
||||||
hwaddr raddr;
|
hwaddr raddr;
|
||||||
|
|
||||||
/* There are no hash32 large pages. */
|
/* There are no hash32 large pages. */
|
||||||
@ -400,13 +399,11 @@ bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
need_prot = prot_for_access_type(access_type);
|
|
||||||
|
|
||||||
/* 2. Check Block Address Translation entries (BATs) */
|
/* 2. Check Block Address Translation entries (BATs) */
|
||||||
if (env->nb_BATs != 0) {
|
if (env->nb_BATs != 0) {
|
||||||
raddr = ppc_hash32_bat_lookup(cpu, eaddr, access_type, protp, mmu_idx);
|
raddr = ppc_hash32_bat_lookup(cpu, eaddr, access_type, protp, mmu_idx);
|
||||||
if (raddr != -1) {
|
if (raddr != -1) {
|
||||||
if (need_prot & ~*protp) {
|
if (prot_for_access_type(access_type) & ~*protp) {
|
||||||
if (guest_visible) {
|
if (guest_visible) {
|
||||||
if (access_type == MMU_INST_FETCH) {
|
if (access_type == MMU_INST_FETCH) {
|
||||||
cs->exception_index = POWERPC_EXCP_ISI;
|
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);
|
prot = ppc_hash32_pte_prot(mmu_idx, sr, pte);
|
||||||
|
|
||||||
if (need_prot & ~prot) {
|
if (prot_for_access_type(access_type) & ~prot) {
|
||||||
/* Access right violation */
|
/* Access right violation */
|
||||||
qemu_log_mask(CPU_LOG_MMU, "PTE access rejected\n");
|
qemu_log_mask(CPU_LOG_MMU, "PTE access rejected\n");
|
||||||
if (guest_visible) {
|
if (guest_visible) {
|
||||||
|
Loading…
Reference in New Issue
Block a user