From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH-for-10.1 6/8] target/mips: Introduce mips_cpu_is_64bit() helper
Date: Thu, 27 Mar 2025 18:05:12 +0100 [thread overview]
Message-ID: <8b6ac33d-429c-4ef2-a964-7b44249b2790@linaro.org> (raw)
In-Reply-To: <1ba52ba5-6d68-483b-88ef-727fd369e4c0@linaro.org>
On 26/3/25 19:22, Richard Henderson wrote:
> On 3/25/25 10:40, Philippe Mathieu-Daudé wrote:
>> mips_cpu_is_64bit() returns whether the CPU is a
>> 32-bit or a 64-bit one.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/mips/cpu-qom.h | 2 ++
>> target/mips/cpu.c | 6 ++++++
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/target/mips/cpu-qom.h b/target/mips/cpu-qom.h
>> index 9acf647420c..52996e7c354 100644
>> --- a/target/mips/cpu-qom.h
>> +++ b/target/mips/cpu-qom.h
>> @@ -33,4 +33,6 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass,
>> MIPS_CPU)
>> #define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU
>> #define MIPS_CPU_TYPE_NAME(model) model MIPS_CPU_TYPE_SUFFIX
>> +bool mips_cpu_is_64bit(MIPSCPU *cpu);
>> +
>> #endif
>> diff --git a/target/mips/cpu.c b/target/mips/cpu.c
>> index d8930468b7d..05b3ce42af5 100644
>> --- a/target/mips/cpu.c
>> +++ b/target/mips/cpu.c
>> @@ -516,6 +516,12 @@ static void mips_cpu_initfn(Object *obj)
>> #endif
>> }
>> +bool mips_cpu_is_64bit(MIPSCPU *cpu)
>> +{
>> + return !!object_class_dynamic_cast(OBJECT_CLASS(CPU(cpu)->cc),
>> + TYPE_MIPS64_CPU);
>> +}
>
> This is very nearly object_dynamic_cast. So why not just
>
> return object_dynamic_cast(OBJECT(cpu), TYPE_MIPS64_CPU);
>
> ?
Good point!
next prev parent reply other threads:[~2025-03-27 17:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 15:40 [PATCH-for-10.1 0/8] target/mips: Make 'cpu-qom.h' target agnostic Philippe Mathieu-Daudé
2025-03-25 15:40 ` [PATCH-for-10.1 1/8] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE() Philippe Mathieu-Daudé
2025-03-25 15:40 ` [PATCH-for-10.1 2/8] target/mips: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2025-03-26 15:21 ` Pierrick Bouvier
2025-03-25 15:40 ` [PATCH-for-10.1 3/8] target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types Philippe Mathieu-Daudé
2025-03-26 15:24 ` Pierrick Bouvier
2025-03-25 15:40 ` [PATCH-for-10.1 4/8] target/mips: Prefix MMU API with 'mips_' Philippe Mathieu-Daudé
2025-03-26 15:24 ` Pierrick Bouvier
2025-03-25 15:40 ` [PATCH-for-10.1 5/8] target/mips: Replace ldtul_p() -> ldn_p(sizeof(target_ulong)) Philippe Mathieu-Daudé
2025-03-26 15:24 ` Pierrick Bouvier
2025-03-25 15:40 ` [PATCH-for-10.1 6/8] target/mips: Introduce mips_cpu_is_64bit() helper Philippe Mathieu-Daudé
2025-03-26 15:26 ` Pierrick Bouvier
2025-03-26 18:22 ` Richard Henderson
2025-03-27 17:05 ` Philippe Mathieu-Daudé [this message]
2025-03-25 15:40 ` [PATCH-for-10.1 7/8] target/mips: Get CPU register size using mips_cpu_is_64bit() Philippe Mathieu-Daudé
2025-03-26 15:28 ` Pierrick Bouvier
2025-03-25 15:40 ` [PATCH-for-10.1 8/8] target/mips: Introduce mips_env_64bit_enabled() helper Philippe Mathieu-Daudé
2025-03-26 15:29 ` Pierrick Bouvier
2025-03-26 18:26 ` Richard Henderson
2025-03-26 16:50 ` [PATCH-for-10.1 0/8] target/mips: Make 'cpu-qom.h' target agnostic Anton Johansson via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b6ac33d-429c-4ef2-a964-7b44249b2790@linaro.org \
--to=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).