mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 05:20:50 +00:00
qapi: add 'query-target' command to return target arch
Add a 'query-target' QAPI command to allow management applications to determine what target architecture a QEMU binary is emulating without having to parse the binary name or -help output $ qmp-shell -p /tmp/qemu (QEMU) query-target { u'return': { u'arch': u'x86_64' }} Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
67c332fd12
commit
99afc91d6c
11
arch_init.c
11
arch_init.c
@ -44,6 +44,7 @@
|
||||
#include "exec-memory.h"
|
||||
#include "hw/pcspk.h"
|
||||
#include "qemu/page_cache.h"
|
||||
#include "qmp-commands.h"
|
||||
|
||||
#ifdef DEBUG_ARCH_INIT
|
||||
#define DPRINTF(fmt, ...) \
|
||||
@ -1080,3 +1081,13 @@ int xen_available(void)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TargetInfo *qmp_query_target(Error **errp)
|
||||
{
|
||||
TargetInfo *info = g_malloc0(sizeof(*info));
|
||||
|
||||
info->arch = TARGET_TYPE;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
7
configure
vendored
7
configure
vendored
@ -3834,14 +3834,19 @@ case "$target_arch2" in
|
||||
;;
|
||||
esac
|
||||
|
||||
upper() {
|
||||
echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
|
||||
}
|
||||
|
||||
echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
|
||||
echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
|
||||
echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
|
||||
echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
|
||||
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
|
||||
target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
|
||||
target_arch_name="`upper $TARGET_ARCH`"
|
||||
echo "TARGET_$target_arch_name=y" >> $config_target_mak
|
||||
echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
|
||||
echo "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak
|
||||
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
|
||||
if [ "$TARGET_ABI_DIR" = "" ]; then
|
||||
TARGET_ABI_DIR=$TARGET_ARCH
|
||||
|
@ -2454,3 +2454,42 @@
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
|
||||
|
||||
##
|
||||
# @TargetType
|
||||
#
|
||||
# Target CPU emulation type
|
||||
#
|
||||
# These parameters correspond to the softmmu binary CPU name that is currently
|
||||
# running.
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'enum': 'TargetType',
|
||||
'data': [ 'alpha', 'arm', 'cris', 'i386', 'lm32', 'm68k', 'microblazeel',
|
||||
'microblaze', 'mips64el', 'mips64', 'mipsel', 'mips', 'or32',
|
||||
'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb', 'sh4', 'sparc64',
|
||||
'sparc', 'unicore32', 'x86_64', 'xtensaeb', 'xtensa' ] }
|
||||
|
||||
##
|
||||
# @TargetInfo:
|
||||
#
|
||||
# Information describing the QEMU target.
|
||||
#
|
||||
# @arch: the target architecture (eg "x86_64", "i386", etc)
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'type': 'TargetInfo',
|
||||
'data': { 'arch': 'TargetType' } }
|
||||
|
||||
##
|
||||
# @query-target:
|
||||
#
|
||||
# Return information about the target for this QEMU
|
||||
#
|
||||
# Returns: TargetInfo
|
||||
#
|
||||
# Since: 1.2.0
|
||||
##
|
||||
{ 'command': 'query-target', 'returns': 'TargetInfo' }
|
||||
|
@ -2509,3 +2509,8 @@ EQMP
|
||||
.mhandler.cmd_new = qmp_marshal_input_query_cpu_definitions,
|
||||
},
|
||||
|
||||
{
|
||||
.name = "query-target",
|
||||
.args_type = "",
|
||||
.mhandler.cmd_new = qmp_marshal_input_query_target,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user