[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:
- [PATCH v2 20/28] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static, (continued)
- [PATCH v2 08/28] target/ppc/mmu_common.c: Simplify checking for real mode, BALATON Zoltan, 2024/05/01
- Re: [PATCH v2 08/28] target/ppc/mmu_common.c: Simplify checking for real mode,
Nicholas Piggin <=
- [PATCH v2 19/28] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/01
- [PATCH v2 21/28] target/ppc: Move mmu_ctx_t definition to mmu_common.c, BALATON Zoltan, 2024/05/01
- [PATCH v2 23/28] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate(), BALATON Zoltan, 2024/05/01
- [PATCH v2 25/28] target/ppc/mmu_common.c: Simplify ppc_booke_xlate(), BALATON Zoltan, 2024/05/01
- [PATCH v2 26/28] target/ppc/mmu_common.c: Move BookE MMU functions together, BALATON Zoltan, 2024/05/01