mirror of
https://github.com/qemu/qemu.git
synced 2025-08-13 18:46:38 +00:00
qemu/target-info: Add target_endian_mode()
target_endian_mode() returns the default endianness (QAPI type) of a target. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250708215320.70426-5-philmd@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
536613be40
commit
a37aec2e7d
@ -22,6 +22,8 @@ typedef struct TargetInfo {
|
|||||||
const char *cpu_type;
|
const char *cpu_type;
|
||||||
/* QOM typename machines for this binary must implement */
|
/* QOM typename machines for this binary must implement */
|
||||||
const char *machine_typename;
|
const char *machine_typename;
|
||||||
|
/* related to TARGET_BIG_ENDIAN definition */
|
||||||
|
EndianMode endianness;
|
||||||
} TargetInfo;
|
} TargetInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#ifndef QEMU_TARGET_INFO_EXTRA_H
|
#ifndef QEMU_TARGET_INFO_EXTRA_H
|
||||||
#define QEMU_TARGET_INFO_EXTRA_H
|
#define QEMU_TARGET_INFO_EXTRA_H
|
||||||
|
|
||||||
|
#include "qapi/qapi-types-common.h"
|
||||||
#include "qapi/qapi-types-machine.h"
|
#include "qapi/qapi-types-machine.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,4 +19,11 @@
|
|||||||
*/
|
*/
|
||||||
SysEmuTarget target_arch(void);
|
SysEmuTarget target_arch(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* target_endian_mode:
|
||||||
|
*
|
||||||
|
* Returns: QAPI EndianMode enum (e.g. ENDIAN_MODE_LITTLE).
|
||||||
|
*/
|
||||||
|
EndianMode target_endian_mode(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,6 +18,7 @@ static const TargetInfo target_info_stub = {
|
|||||||
.long_bits = TARGET_LONG_BITS,
|
.long_bits = TARGET_LONG_BITS,
|
||||||
.cpu_type = CPU_RESOLVING_TYPE,
|
.cpu_type = CPU_RESOLVING_TYPE,
|
||||||
.machine_typename = TYPE_MACHINE,
|
.machine_typename = TYPE_MACHINE,
|
||||||
|
.endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const TargetInfo *target_info(void)
|
const TargetInfo *target_info(void)
|
||||||
|
@ -42,3 +42,8 @@ const char *target_machine_typename(void)
|
|||||||
{
|
{
|
||||||
return target_info()->machine_typename;
|
return target_info()->machine_typename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EndianMode target_endian_mode(void)
|
||||||
|
{
|
||||||
|
return target_info()->endianness;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user