- Add tl_is_64() using TARGET_LONG_BITS per-target and target_long_bits() in common builds. - Add target_is_tl32() and target_is_tl64() for a TargetInfo.
Signed-off-by: Yonggang Luo <[email protected]> --- include/qemu/target-info.h | 28 ++++++++++++++++++++++++++++ target-info.c | 10 ++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 3bbe1d9b607..a5dcf60dd9e 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -34,6 +34,34 @@ const char *target_name(void); */ unsigned target_long_bits(void); +#ifdef COMPILING_PER_TARGET +static inline bool tl_is_64(void) +{ + return TARGET_LONG_BITS == 64; +} +#else +static inline bool tl_is_64(void) +{ + return target_long_bits() == 64; +} +#endif + +/** + * target_is_tl32: + * @ti: TargetInfo to inspect + * + * Returns whether @ti uses a 32-bit target long. + */ +bool target_is_tl32(const TargetInfo *ti); + +/** + * target_is_tl64: + * @ti: TargetInfo to inspect + * + * Returns whether @ti uses a 64-bit target long. + */ +bool target_is_tl64(const TargetInfo *ti); + /** * target_cpu_type: * diff --git a/target-info.c b/target-info.c index ad93a4b125e..1bdf3869605 100644 --- a/target-info.c +++ b/target-info.c @@ -76,6 +76,16 @@ unsigned target_long_bits(void) return target_info()->long_bits; } +bool target_is_tl32(const TargetInfo *ti) +{ + return ti->long_bits == 32; +} + +bool target_is_tl64(const TargetInfo *ti) +{ + return ti->long_bits == 64; +} + SysEmuTarget target_arch(void) { return target_info()->target_arch; -- 2.52.0.windows.1
