Reviewed-by: Glenn Miles <[email protected]>

Thanks,

Glenn

On Thu, 2026-10-08 at 01:23 +0200, Philippe Mathieu-Daudé wrote:
> Replace the open-coded PPC_64B test in register_BookE206_sprs()
> by a ppc_env_is_64bit() helper for re-use in the next commit.
> 
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  target/ppc/internal.h | 11 +++++++++++
>  target/ppc/cpu_init.c |  2 +-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/target/ppc/internal.h b/target/ppc/internal.h
> index a20a0f9f7e0..11476692616 100644
> --- a/target/ppc/internal.h
> +++ b/target/ppc/internal.h
> @@ -23,6 +23,17 @@
>  #include "hw/core/registerfields.h"
>  #include "exec/page-protection.h"
>  
> +/**
> + * ppc_env_is_64bit:
> + * @env: the cpu context
> + *
> + * Return whether the CPU is a 64-bit implementation.
> + */
> +static inline bool ppc_env_is_64bit(const CPUPPCState *env)
> +{
> +    return env->insns_flags & PPC_64B;
> +}
> +
>  static inline bool ppc_env_is_little_endian(const CPUPPCState *env)
>  {
>      return FIELD_EX64(env->msr, MSR, LE);
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index b711f9c0a85..a43ef47acd2 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -869,7 +869,7 @@ static void register_BookE206_sprs(CPUPPCState *env, 
> uint32_t mas_mask,
>              spr_register(env, mas_sprn[i], mas_names[i],
>                           SPR_NOACCESS, SPR_NOACCESS,
>                           &spr_read_generic,
> -                         (i == 2 && (env->insns_flags & PPC_64B))
> +                         (i == 2 && ppc_env_is_64bit(env))
>                           ? &spr_write_generic : &spr_write_generic32,
>                           0x00000000);
>          }


Reply via email to