qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 08/28] target/ppc/mmu_common.c: Simplify checking for real


From: Nicholas Piggin
Subject: Re: [PATCH v2 08/28] target/ppc/mmu_common.c: Simplify checking for real mode
Date: Tue, 07 May 2024 19:34:16 +1000

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:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]