Message ID | 6ff205449ce39d0aa76eef96cd8d758f568f4b50.1714606359.git.balaton@eik.bme.hu |
---|---|
State | New |
Headers | show |
Series | Misc PPC exception and BookE MMU clean ups | expand |
On Thu May 2, 2024 at 9:43 AM AEST, BALATON Zoltan wrote: > In get_physical_address_wtlb() the real_mode flag depends on either > the MSR[IR] or MSR[DR] bit depending on access_type. Extract just the > needed bit in a more straight forward way instead of doing unnecessary > computation. Hopefully the compiler should be able to work it out, but IMO it reads better with your change. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> > --- > target/ppc/mmu_common.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c > index 74c3b814c9..45b6501ecb 100644 > --- a/target/ppc/mmu_common.c > +++ b/target/ppc/mmu_common.c > @@ -1183,8 +1183,10 @@ int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx, > int mmu_idx) > { > int ret = -1; > - bool real_mode = (type == ACCESS_CODE && !FIELD_EX64(env->msr, MSR, IR)) || > - (type != ACCESS_CODE && !FIELD_EX64(env->msr, MSR, DR)); > + bool real_mode; > + > + real_mode = (type == ACCESS_CODE) ? !FIELD_EX64(env->msr, MSR, IR) > + : !FIELD_EX64(env->msr, MSR, DR); > > switch (env->mmu_model) { > case POWERPC_MMU_SOFT_6xx:
diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 74c3b814c9..45b6501ecb 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc/mmu_common.c @@ -1183,8 +1183,10 @@ int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx, int mmu_idx) { int ret = -1; - bool real_mode = (type == ACCESS_CODE && !FIELD_EX64(env->msr, MSR, IR)) || - (type != ACCESS_CODE && !FIELD_EX64(env->msr, MSR, DR)); + bool real_mode; + + real_mode = (type == ACCESS_CODE) ? !FIELD_EX64(env->msr, MSR, IR) + : !FIELD_EX64(env->msr, MSR, DR); switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx:
In get_physical_address_wtlb() the real_mode flag depends on either the MSR[IR] or MSR[DR] bit depending on access_type. Extract just the needed bit in a more straight forward way instead of doing unnecessary computation. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> --- target/ppc/mmu_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)