#include "json-streamer.h"
#include "json-parser.h"
#include "osdep.h"
-#include "exec-all.h"
-#ifdef CONFIG_SIMPLE_TRACE
+#include "cpu.h"
#include "trace.h"
+#include "trace/control.h"
+#ifdef CONFIG_TRACE_SIMPLE
+#include "trace/simple.h"
#endif
#include "ui/qemu-spice.h"
+#include "memory.h"
+#include "qmp-commands.h"
+#include "hmp.h"
+
+/* for pic/irq_info */
+#if defined(TARGET_SPARC)
+#include "hw/sun4m.h"
+#endif
+#include "hw/lm32_pic.h"
//#define DEBUG
//#define DEBUG_COMPLETION
int (*cmd_async)(Monitor *mon, const QDict *params,
MonitorCompletion *cb, void *opaque);
} mhandler;
+ bool qapi;
int flags;
} mon_cmd_t;
void monitor_flush(Monitor *mon)
{
if (mon && mon->outbuf_index != 0 && !mon->mux_out) {
- qemu_chr_write(mon->chr, mon->outbuf, mon->outbuf_index);
+ qemu_chr_fe_write(mon->chr, mon->outbuf, mon->outbuf_index);
mon->outbuf_index = 0;
}
}
{
QDict *qmp;
+ trace_monitor_protocol_emitter(mon);
+
qmp = qdict_new();
if (!monitor_has_error(mon)) {
help_cmd(mon, qdict_get_try_str(qdict, "name"));
}
-#ifdef CONFIG_SIMPLE_TRACE
-static void do_change_trace_event_state(Monitor *mon, const QDict *qdict)
+static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
{
const char *tp_name = qdict_get_str(qdict, "name");
bool new_state = qdict_get_bool(qdict, "option");
- int ret = st_change_trace_event_state(tp_name, new_state);
+ int ret = trace_event_set_state(tp_name, new_state);
if (!ret) {
monitor_printf(mon, "unknown event name \"%s\"\n", tp_name);
}
}
+#ifdef CONFIG_TRACE_SIMPLE
static void do_trace_file(Monitor *mon, const QDict *qdict)
{
const char *op = qdict_get_try_str(qdict, "op");
data->user_print(data->mon, ret_data);
}
monitor_resume(data->mon);
- qemu_free(data);
+ g_free(data);
}
static void qmp_monitor_complete(void *opaque, QObject *ret_data)
{
int ret;
- MonitorCompletionData *cb_data = qemu_malloc(sizeof(*cb_data));
+ MonitorCompletionData *cb_data = g_malloc(sizeof(*cb_data));
cb_data->mon = mon;
cb_data->user_print = cmd->user_print;
monitor_suspend(mon);
user_monitor_complete, cb_data);
if (ret < 0) {
monitor_resume(mon);
- qemu_free(cb_data);
+ g_free(cb_data);
}
}
{
int ret;
- MonitorCompletionData *cb_data = qemu_malloc(sizeof(*cb_data));
+ MonitorCompletionData *cb_data = g_malloc(sizeof(*cb_data));
cb_data->mon = mon;
cb_data->user_print = cmd->user_print;
monitor_suspend(mon);
ret = cmd->mhandler.info_async(mon, user_monitor_complete, cb_data);
if (ret < 0) {
monitor_resume(mon);
- qemu_free(cb_data);
+ g_free(cb_data);
}
}
help_cmd(mon, "info");
}
-static void do_info_version_print(Monitor *mon, const QObject *data)
-{
- QDict *qdict;
- QDict *qemu;
-
- qdict = qobject_to_qdict(data);
- qemu = qdict_get_qdict(qdict, "qemu");
-
- monitor_printf(mon, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n",
- qdict_get_int(qemu, "major"),
- qdict_get_int(qemu, "minor"),
- qdict_get_int(qemu, "micro"),
- qdict_get_str(qdict, "package"));
-}
-
-static void do_info_version(Monitor *mon, QObject **ret_data)
+static CommandInfoList *alloc_cmd_entry(const char *cmd_name)
{
- const char *version = QEMU_VERSION;
- int major = 0, minor = 0, micro = 0;
- char *tmp;
+ CommandInfoList *info;
- major = strtol(version, &tmp, 10);
- tmp++;
- minor = strtol(tmp, &tmp, 10);
- tmp++;
- micro = strtol(tmp, &tmp, 10);
+ info = g_malloc0(sizeof(*info));
+ info->value = g_malloc0(sizeof(*info->value));
+ info->value->name = g_strdup(cmd_name);
- *ret_data = qobject_from_jsonf("{ 'qemu': { 'major': %d, 'minor': %d, \
- 'micro': %d }, 'package': %s }", major, minor, micro, QEMU_PKGVERSION);
-}
-
-static void do_info_name_print(Monitor *mon, const QObject *data)
-{
- QDict *qdict;
-
- qdict = qobject_to_qdict(data);
- if (qdict_size(qdict) == 0) {
- return;
- }
-
- monitor_printf(mon, "%s\n", qdict_get_str(qdict, "name"));
-}
-
-static void do_info_name(Monitor *mon, QObject **ret_data)
-{
- *ret_data = qemu_name ? qobject_from_jsonf("{'name': %s }", qemu_name) :
- qobject_from_jsonf("{}");
+ return info;
}
-static QObject *get_cmd_dict(const char *name)
+CommandInfoList *qmp_query_commands(Error **errp)
{
- const char *p;
-
- /* Remove '|' from some commands */
- p = strchr(name, '|');
- if (p) {
- p++;
- } else {
- p = name;
- }
-
- return qobject_from_jsonf("{ 'name': %s }", p);
-}
-
-static void do_info_commands(Monitor *mon, QObject **ret_data)
-{
- QList *cmd_list;
+ CommandInfoList *info, *cmd_list = NULL;
const mon_cmd_t *cmd;
- cmd_list = qlist_new();
-
for (cmd = qmp_cmds; cmd->name != NULL; cmd++) {
- qlist_append_obj(cmd_list, get_cmd_dict(cmd->name));
+ info = alloc_cmd_entry(cmd->name);
+ info->next = cmd_list;
+ cmd_list = info;
}
for (cmd = qmp_query_cmds; cmd->name != NULL; cmd++) {
char buf[128];
snprintf(buf, sizeof(buf), "query-%s", cmd->name);
- qlist_append_obj(cmd_list, get_cmd_dict(buf));
+ info = alloc_cmd_entry(buf);
+ info->next = cmd_list;
+ cmd_list = info;
}
- *ret_data = QOBJECT(cmd_list);
-}
-
-static void do_info_uuid_print(Monitor *mon, const QObject *data)
-{
- monitor_printf(mon, "%s\n", qdict_get_str(qobject_to_qdict(data), "UUID"));
-}
-
-static void do_info_uuid(Monitor *mon, QObject **ret_data)
-{
- char uuid[64];
-
- snprintf(uuid, sizeof(uuid), UUID_FMT, qemu_uuid[0], qemu_uuid[1],
- qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5],
- qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9],
- qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13],
- qemu_uuid[14], qemu_uuid[15]);
- *ret_data = qobject_from_jsonf("{ 'UUID': %s }", uuid);
+ return cmd_list;
}
/* get the current CPU defined by the user */
monitor_printf(mon, "nip=0x" TARGET_FMT_lx,
(target_long) qdict_get_int(cpu, "nip"));
#elif defined(TARGET_SPARC)
- monitor_printf(mon, "pc=0x " TARGET_FMT_lx,
+ monitor_printf(mon, "pc=0x" TARGET_FMT_lx,
(target_long) qdict_get_int(cpu, "pc"));
monitor_printf(mon, "npc=0x" TARGET_FMT_lx,
(target_long) qdict_get_int(cpu, "npc"));
}
#endif
-#if defined(CONFIG_SIMPLE_TRACE)
+#if defined(CONFIG_TRACE_SIMPLE)
static void do_info_trace(Monitor *mon)
{
st_print_trace((FILE *)mon, &monitor_fprintf);
}
-
-static void do_info_trace_events(Monitor *mon)
-{
- st_print_trace_events((FILE *)mon, &monitor_fprintf);
-}
#endif
-/**
- * do_quit(): Quit QEMU execution
- */
-static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static void do_trace_print_events(Monitor *mon)
{
- monitor_suspend(mon);
- no_shutdown = 0;
- qemu_system_shutdown_request();
-
- return 0;
+ trace_print_events((FILE *)mon, &monitor_fprintf);
}
#ifdef CONFIG_VNC
return -1;
}
+static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ const char *protocol = qdict_get_str(qdict, "protocol");
+ const char *fdname = qdict_get_str(qdict, "fdname");
+ CharDriverState *s;
+
+ if (strcmp(protocol, "spice") == 0) {
+ if (!using_spice) {
+ /* correct one? spice isn't a device ,,, */
+ qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
+ return -1;
+ }
+ qerror_report(QERR_ADD_CLIENT_FAILED);
+ return -1;
+#ifdef CONFIG_VNC
+ } else if (strcmp(protocol, "vnc") == 0) {
+ int fd = monitor_get_fd(mon, fdname);
+ int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);
+ vnc_display_add_client(NULL, fd, skipauth);
+ return 0;
+#endif
+ } else if ((s = qemu_chr_find(protocol)) != NULL) {
+ int fd = monitor_get_fd(mon, fdname);
+ if (qemu_chr_add_client(s, fd) < 0) {
+ qerror_report(QERR_ADD_CLIENT_FAILED);
+ return -1;
+ }
+ return 0;
+ }
+
+ qerror_report(QERR_INVALID_PARAMETER, "protocol");
+ return -1;
+}
+
static int client_migrate_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
const char *protocol = qdict_get_str(qdict, "protocol");
}
}
-/**
- * do_stop(): Stop VM execution
- */
-static int do_stop(Monitor *mon, const QDict *qdict, QObject **ret_data)
-{
- vm_stop(VMSTOP_USER);
- return 0;
-}
-
static void encrypted_bdrv_it(void *opaque, BlockDriverState *bs);
struct bdrv_iterate_context {
int err;
};
+static void iostatus_bdrv_it(void *opaque, BlockDriverState *bs)
+{
+ bdrv_iostatus_reset(bs);
+}
+
/**
* do_cont(): Resume emulation.
*/
{
struct bdrv_iterate_context context = { mon, 0 };
- if (incoming_expected) {
+ if (runstate_check(RUN_STATE_INMIGRATE)) {
qerror_report(QERR_MIGRATION_EXPECTED);
return -1;
+ } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
+ runstate_check(RUN_STATE_SHUTDOWN)) {
+ qerror_report(QERR_RESET_REQUIRED);
+ return -1;
}
+
+ bdrv_iterate(iostatus_bdrv_it, NULL);
bdrv_iterate(encrypted_bdrv_it, &context);
/* only resume the vm if all keys are set and valid */
if (!context.err) {
}
}
-/**
- * do_system_reset(): Issue a machine reset
- */
-static int do_system_reset(Monitor *mon, const QDict *qdict,
- QObject **ret_data)
-{
- qemu_system_reset_request();
- return 0;
-}
-
/**
* do_system_powerdown(): Issue a machine powerdown
*/
static void tlb_info_32(Monitor *mon, CPUState *env)
{
- int l1, l2;
+ unsigned int l1, l2;
uint32_t pgd, pde, pte;
pgd = env->cr[3] & ~0xfff;
static void tlb_info_pae32(Monitor *mon, CPUState *env)
{
- int l1, l2, l3;
+ unsigned int l1, l2, l3;
uint64_t pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
static void mem_info_32(Monitor *mon, CPUState *env)
{
- int l1, l2, prot, last_prot;
+ unsigned int l1, l2;
+ int prot, last_prot;
uint32_t pgd, pde, pte;
target_phys_addr_t start, end;
pte = le32_to_cpu(pte);
end = (l1 << 22) + (l2 << 12);
if (pte & PG_PRESENT_MASK) {
- prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);
+ prot = pte & pde &
+ (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);
} else {
prot = 0;
}
mem_print(mon, &start, &last_prot, end, prot);
}
}
+ /* Flush last range */
+ mem_print(mon, &start, &last_prot, (target_phys_addr_t)1 << 32, 0);
}
static void mem_info_pae32(Monitor *mon, CPUState *env)
{
- int l1, l2, l3, prot, last_prot;
+ unsigned int l1, l2, l3;
+ int prot, last_prot;
uint64_t pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
target_phys_addr_t start, end;
pte = le64_to_cpu(pte);
end = (l1 << 30) + (l2 << 21) + (l3 << 12);
if (pte & PG_PRESENT_MASK) {
- prot = pte & (PG_USER_MASK | PG_RW_MASK |
- PG_PRESENT_MASK);
+ prot = pte & pde & (PG_USER_MASK | PG_RW_MASK |
+ PG_PRESENT_MASK);
} else {
prot = 0;
}
mem_print(mon, &start, &last_prot, end, prot);
}
}
+ /* Flush last range */
+ mem_print(mon, &start, &last_prot, (target_phys_addr_t)1 << 32, 0);
}
if (pdpe & PG_PSE_MASK) {
prot = pdpe & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
+ prot &= pml4e;
mem_print(mon, &start, &last_prot, end, prot);
} else {
pd_addr = pdpe & 0x3fffffffff000ULL;
if (pde & PG_PSE_MASK) {
prot = pde & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
+ prot &= pml4e & pdpe;
mem_print(mon, &start, &last_prot, end, prot);
} else {
pt_addr = pde & 0x3fffffffff000ULL;
if (pte & PG_PRESENT_MASK) {
prot = pte & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
+ prot &= pml4e & pdpe & pde;
} else {
prot = 0;
}
mem_print(mon, &start, &last_prot, end, prot);
}
}
+ /* Flush last range */
+ mem_print(mon, &start, &last_prot, (target_phys_addr_t)1 << 48, 0);
}
#endif
#endif
-#if defined(TARGET_SPARC)
+#if defined(TARGET_SPARC) || defined(TARGET_PPC)
static void tlb_info(Monitor *mon)
{
CPUState *env1 = mon_get_cpu();
}
#endif
-static void do_info_kvm_print(Monitor *mon, const QObject *data)
+static void do_info_mtree(Monitor *mon)
{
- QDict *qdict;
-
- qdict = qobject_to_qdict(data);
-
- monitor_printf(mon, "kvm support: ");
- if (qdict_get_bool(qdict, "present")) {
- monitor_printf(mon, "%s\n", qdict_get_bool(qdict, "enabled") ?
- "enabled" : "disabled");
- } else {
- monitor_printf(mon, "not compiled\n");
- }
-}
-
-static void do_info_kvm(Monitor *mon, QObject **ret_data)
-{
-#ifdef CONFIG_KVM
- *ret_data = qobject_from_jsonf("{ 'enabled': %i, 'present': true }",
- kvm_enabled());
-#else
- *ret_data = qobject_from_jsonf("{ 'enabled': false, 'present': false }");
-#endif
+ mtree_info((fprintf_function)monitor_printf, mon);
}
static void do_info_numa(Monitor *mon)
if (i == n) {
s->ops.destroy (s->opaque);
QLIST_REMOVE (s, entries);
- qemu_free (s);
+ g_free (s);
return;
}
}
int nchannels = qdict_get_try_int(qdict, "nchannels", -1);
CaptureState *s;
- s = qemu_mallocz (sizeof (*s));
+ s = g_malloc0 (sizeof (*s));
freq = has_freq ? freq : 44100;
bits = has_bits ? bits : 16;
if (wav_start_capture (s, path, freq, bits, nchannels)) {
monitor_printf(mon, "Failed to add wave capture\n");
- qemu_free (s);
+ g_free (s);
return;
}
QLIST_INSERT_HEAD (&capture_head, s, entries);
#endif
#if defined(TARGET_I386)
-static void do_inject_nmi(Monitor *mon, const QDict *qdict)
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
CPUState *env;
- int cpu_index = qdict_get_int(qdict, "cpu_index");
-
- for (env = first_cpu; env != NULL; env = env->next_cpu)
- if (env->cpu_index == cpu_index) {
- cpu_interrupt(env, CPU_INTERRUPT_NMI);
- break;
- }
-}
-#endif
-
-static void do_info_status_print(Monitor *mon, const QObject *data)
-{
- QDict *qdict;
-
- qdict = qobject_to_qdict(data);
- monitor_printf(mon, "VM status: ");
- if (qdict_get_bool(qdict, "running")) {
- monitor_printf(mon, "running");
- if (qdict_get_bool(qdict, "singlestep")) {
- monitor_printf(mon, " (single step mode)");
- }
- } else {
- monitor_printf(mon, "paused");
+ for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ cpu_interrupt(env, CPU_INTERRUPT_NMI);
}
- monitor_printf(mon, "\n");
+ return 0;
}
-
-static void do_info_status(Monitor *mon, QObject **ret_data)
+#else
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- *ret_data = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i }",
- vm_running, singlestep);
+ qerror_report(QERR_UNSUPPORTED);
+ return -1;
}
+#endif
static qemu_acl *find_acl(Monitor *mon, const char *name)
{
mon_fd_t *monfd;
int fd;
- fd = qemu_chr_get_msgfd(mon->chr);
+ fd = qemu_chr_fe_get_msgfd(mon->chr);
if (fd == -1) {
qerror_report(QERR_FD_NOT_SUPPLIED);
return -1;
return 0;
}
- monfd = qemu_mallocz(sizeof(mon_fd_t));
- monfd->name = qemu_strdup(fdname);
+ monfd = g_malloc0(sizeof(mon_fd_t));
+ monfd->name = g_strdup(fdname);
monfd->fd = fd;
QLIST_INSERT_HEAD(&mon->fds, monfd, next);
QLIST_REMOVE(monfd, next);
close(monfd->fd);
- qemu_free(monfd->name);
- qemu_free(monfd);
+ g_free(monfd->name);
+ g_free(monfd);
return 0;
}
static void do_loadvm(Monitor *mon, const QDict *qdict)
{
- int saved_vm_running = vm_running;
+ int saved_vm_running = runstate_is_running();
const char *name = qdict_get_str(qdict, "name");
- vm_stop(VMSTOP_LOADVM);
+ vm_stop(RUN_STATE_RESTORE_VM);
if (load_vmstate(name) == 0 && saved_vm_running) {
vm_start();
/* caller takes ownership of fd */
QLIST_REMOVE(monfd, next);
- qemu_free(monfd->name);
- qemu_free(monfd);
+ g_free(monfd->name);
+ g_free(monfd);
return fd;
}
.args_type = "",
.params = "",
.help = "show the version of QEMU",
- .user_print = do_info_version_print,
- .mhandler.info_new = do_info_version,
+ .mhandler.info = hmp_info_version,
},
{
.name = "network",
.args_type = "",
.params = "",
.help = "show the character devices",
- .user_print = qemu_chr_info_print,
- .mhandler.info_new = qemu_chr_info,
+ .mhandler.info = hmp_info_chardev,
},
{
.name = "block",
.help = "show the command line history",
.mhandler.info = do_info_history,
},
+#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_MIPS) || \
+ defined(TARGET_LM32) || (defined(TARGET_SPARC) && !defined(TARGET_SPARC64))
{
.name = "irq",
.args_type = "",
.params = "",
.help = "show the interrupts statistics (if available)",
+#ifdef TARGET_SPARC
+ .mhandler.info = sun4m_irq_info,
+#elif defined(TARGET_LM32)
+ .mhandler.info = lm32_irq_info,
+#else
.mhandler.info = irq_info,
+#endif
},
{
.name = "pic",
.args_type = "",
.params = "",
.help = "show i8259 (PIC) state",
+#ifdef TARGET_SPARC
+ .mhandler.info = sun4m_pic_info,
+#elif defined(TARGET_LM32)
+ .mhandler.info = lm32_do_pic_info,
+#else
.mhandler.info = pic_info,
+#endif
},
+#endif
{
.name = "pci",
.args_type = "",
.user_print = do_pci_info_print,
.mhandler.info_new = do_pci_info,
},
-#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC)
+#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) || \
+ defined(TARGET_PPC)
{
.name = "tlb",
.args_type = "",
.mhandler.info = mem_info,
},
#endif
+ {
+ .name = "mtree",
+ .args_type = "",
+ .params = "",
+ .help = "show memory tree",
+ .mhandler.info = do_info_mtree,
+ },
{
.name = "jit",
.args_type = "",
.args_type = "",
.params = "",
.help = "show KVM information",
- .user_print = do_info_kvm_print,
- .mhandler.info_new = do_info_kvm,
+ .mhandler.info = hmp_info_kvm,
},
{
.name = "numa",
.args_type = "",
.params = "",
.help = "show the current VM status (running|paused)",
- .user_print = do_info_status_print,
- .mhandler.info_new = do_info_status,
+ .mhandler.info = hmp_info_status,
},
{
.name = "pcmcia",
.args_type = "",
.params = "",
.help = "show the current VM name",
- .user_print = do_info_name_print,
- .mhandler.info_new = do_info_name,
+ .mhandler.info = hmp_info_name,
},
{
.name = "uuid",
.args_type = "",
.params = "",
.help = "show the current VM UUID",
- .user_print = do_info_uuid_print,
- .mhandler.info_new = do_info_uuid,
+ .mhandler.info = hmp_info_uuid,
},
#if defined(TARGET_PPC)
{
.help = "show roms",
.mhandler.info = do_info_roms,
},
-#if defined(CONFIG_SIMPLE_TRACE)
+#if defined(CONFIG_TRACE_SIMPLE)
{
.name = "trace",
.args_type = "",
.help = "show current contents of trace buffer",
.mhandler.info = do_info_trace,
},
+#endif
{
.name = "trace-events",
.args_type = "",
.params = "",
.help = "show available trace-events & their state",
- .mhandler.info = do_info_trace_events,
+ .mhandler.info = do_trace_print_events,
},
-#endif
{
.name = NULL,
},
};
static const mon_cmd_t qmp_cmds[] = {
-#include "qmp-commands.h"
+#include "qmp-commands-old.h"
{ /* NULL */ },
};
static const mon_cmd_t qmp_query_cmds[] = {
- {
- .name = "version",
- .args_type = "",
- .params = "",
- .help = "show the version of QEMU",
- .user_print = do_info_version_print,
- .mhandler.info_new = do_info_version,
- },
- {
- .name = "commands",
- .args_type = "",
- .params = "",
- .help = "list QMP available commands",
- .user_print = monitor_user_noop,
- .mhandler.info_new = do_info_commands,
- },
- {
- .name = "chardev",
- .args_type = "",
- .params = "",
- .help = "show the character devices",
- .user_print = qemu_chr_info_print,
- .mhandler.info_new = qemu_chr_info,
- },
{
.name = "block",
.args_type = "",
.user_print = do_pci_info_print,
.mhandler.info_new = do_pci_info,
},
- {
- .name = "kvm",
- .args_type = "",
- .params = "",
- .help = "show KVM information",
- .user_print = do_info_kvm_print,
- .mhandler.info_new = do_info_kvm,
- },
- {
- .name = "status",
- .args_type = "",
- .params = "",
- .help = "show the current VM status (running|paused)",
- .user_print = do_info_status_print,
- .mhandler.info_new = do_info_status,
- },
{
.name = "mice",
.args_type = "",
.mhandler.info_new = do_info_spice,
},
#endif
- {
- .name = "name",
- .args_type = "",
- .params = "",
- .help = "show the current VM name",
- .user_print = do_info_name_print,
- .mhandler.info_new = do_info_name,
- },
- {
- .name = "uuid",
- .args_type = "",
- .params = "",
- .help = "show the current VM UUID",
- .user_print = do_info_uuid_print,
- .mhandler.info_new = do_info_uuid,
- },
{
.name = "migrate",
.args_type = "",
{ "sr13", offsetof(CPUState, sr[13]) },
{ "sr14", offsetof(CPUState, sr[14]) },
{ "sr15", offsetof(CPUState, sr[15]) },
- /* Too lazy to put BATs and SPRs ... */
+ /* Too lazy to put BATs... */
+ { "pvr", offsetof(CPUState, spr[SPR_PVR]) },
+
+ { "srr0", offsetof(CPUState, spr[SPR_SRR0]) },
+ { "srr1", offsetof(CPUState, spr[SPR_SRR1]) },
+ { "sprg0", offsetof(CPUState, spr[SPR_SPRG0]) },
+ { "sprg1", offsetof(CPUState, spr[SPR_SPRG1]) },
+ { "sprg2", offsetof(CPUState, spr[SPR_SPRG2]) },
+ { "sprg3", offsetof(CPUState, spr[SPR_SPRG3]) },
+ { "sprg4", offsetof(CPUState, spr[SPR_SPRG4]) },
+ { "sprg5", offsetof(CPUState, spr[SPR_SPRG5]) },
+ { "sprg6", offsetof(CPUState, spr[SPR_SPRG6]) },
+ { "sprg7", offsetof(CPUState, spr[SPR_SPRG7]) },
+ { "pid", offsetof(CPUState, spr[SPR_BOOKE_PID]) },
+ { "csrr0", offsetof(CPUState, spr[SPR_BOOKE_CSRR0]) },
+ { "csrr1", offsetof(CPUState, spr[SPR_BOOKE_CSRR1]) },
+ { "esr", offsetof(CPUState, spr[SPR_BOOKE_ESR]) },
+ { "dear", offsetof(CPUState, spr[SPR_BOOKE_DEAR]) },
+ { "mcsr", offsetof(CPUState, spr[SPR_BOOKE_MCSR]) },
+ { "tsr", offsetof(CPUState, spr[SPR_BOOKE_TSR]) },
+ { "tcr", offsetof(CPUState, spr[SPR_BOOKE_TCR]) },
+ { "vrsave", offsetof(CPUState, spr[SPR_VRSAVE]) },
+ { "pir", offsetof(CPUState, spr[SPR_BOOKE_PIR]) },
+ { "mcsrr0", offsetof(CPUState, spr[SPR_BOOKE_MCSRR0]) },
+ { "mcsrr1", offsetof(CPUState, spr[SPR_BOOKE_MCSRR1]) },
+ { "decar", offsetof(CPUState, spr[SPR_BOOKE_DECAR]) },
+ { "ivpr", offsetof(CPUState, spr[SPR_BOOKE_IVPR]) },
+ { "epcr", offsetof(CPUState, spr[SPR_BOOKE_EPCR]) },
+ { "sprg8", offsetof(CPUState, spr[SPR_BOOKE_SPRG8]) },
+ { "ivor0", offsetof(CPUState, spr[SPR_BOOKE_IVOR0]) },
+ { "ivor1", offsetof(CPUState, spr[SPR_BOOKE_IVOR1]) },
+ { "ivor2", offsetof(CPUState, spr[SPR_BOOKE_IVOR2]) },
+ { "ivor3", offsetof(CPUState, spr[SPR_BOOKE_IVOR3]) },
+ { "ivor4", offsetof(CPUState, spr[SPR_BOOKE_IVOR4]) },
+ { "ivor5", offsetof(CPUState, spr[SPR_BOOKE_IVOR5]) },
+ { "ivor6", offsetof(CPUState, spr[SPR_BOOKE_IVOR6]) },
+ { "ivor7", offsetof(CPUState, spr[SPR_BOOKE_IVOR7]) },
+ { "ivor8", offsetof(CPUState, spr[SPR_BOOKE_IVOR8]) },
+ { "ivor9", offsetof(CPUState, spr[SPR_BOOKE_IVOR9]) },
+ { "ivor10", offsetof(CPUState, spr[SPR_BOOKE_IVOR10]) },
+ { "ivor11", offsetof(CPUState, spr[SPR_BOOKE_IVOR11]) },
+ { "ivor12", offsetof(CPUState, spr[SPR_BOOKE_IVOR12]) },
+ { "ivor13", offsetof(CPUState, spr[SPR_BOOKE_IVOR13]) },
+ { "ivor14", offsetof(CPUState, spr[SPR_BOOKE_IVOR14]) },
+ { "ivor15", offsetof(CPUState, spr[SPR_BOOKE_IVOR15]) },
+ { "ivor32", offsetof(CPUState, spr[SPR_BOOKE_IVOR32]) },
+ { "ivor33", offsetof(CPUState, spr[SPR_BOOKE_IVOR33]) },
+ { "ivor34", offsetof(CPUState, spr[SPR_BOOKE_IVOR34]) },
+ { "ivor35", offsetof(CPUState, spr[SPR_BOOKE_IVOR35]) },
+ { "ivor36", offsetof(CPUState, spr[SPR_BOOKE_IVOR36]) },
+ { "ivor37", offsetof(CPUState, spr[SPR_BOOKE_IVOR37]) },
+ { "mas0", offsetof(CPUState, spr[SPR_BOOKE_MAS0]) },
+ { "mas1", offsetof(CPUState, spr[SPR_BOOKE_MAS1]) },
+ { "mas2", offsetof(CPUState, spr[SPR_BOOKE_MAS2]) },
+ { "mas3", offsetof(CPUState, spr[SPR_BOOKE_MAS3]) },
+ { "mas4", offsetof(CPUState, spr[SPR_BOOKE_MAS4]) },
+ { "mas6", offsetof(CPUState, spr[SPR_BOOKE_MAS6]) },
+ { "mas7", offsetof(CPUState, spr[SPR_BOOKE_MAS7]) },
+ { "mmucfg", offsetof(CPUState, spr[SPR_MMUCFG]) },
+ { "tlb0cfg", offsetof(CPUState, spr[SPR_BOOKE_TLB0CFG]) },
+ { "tlb1cfg", offsetof(CPUState, spr[SPR_BOOKE_TLB1CFG]) },
+ { "epr", offsetof(CPUState, spr[SPR_BOOKE_EPR]) },
+ { "eplc", offsetof(CPUState, spr[SPR_BOOKE_EPLC]) },
+ { "epsc", offsetof(CPUState, spr[SPR_BOOKE_EPSC]) },
+ { "svr", offsetof(CPUState, spr[SPR_E500_SVR]) },
+ { "mcar", offsetof(CPUState, spr[SPR_Exxx_MCAR]) },
+ { "pid1", offsetof(CPUState, spr[SPR_BOOKE_PID1]) },
+ { "pid2", offsetof(CPUState, spr[SPR_BOOKE_PID2]) },
+ { "hid0", offsetof(CPUState, spr[SPR_HID0]) },
+
#elif defined(TARGET_SPARC)
{ "g0", offsetof(CPUState, gregs[0]) },
{ "g1", offsetof(CPUState, gregs[1]) },
}
len = p - type;
- str = qemu_malloc(len + 1);
+ str = g_malloc(len + 1);
memcpy(str, type, len);
str[len] = '\0';
monitor_printf(mon, "%s: unknown type '%c'\n", cmdname, c);
goto fail;
}
- qemu_free(key);
+ g_free(key);
key = NULL;
}
/* check that all arguments were parsed */
return cmd;
fail:
- qemu_free(key);
+ g_free(key);
return NULL;
}
if (nb_args >= MAX_ARGS)
break;
ret = get_str(buf, sizeof(buf), &p);
- args[nb_args] = qemu_strdup(buf);
+ args[nb_args] = g_strdup(buf);
nb_args++;
if (ret < 0)
break;
if (nb_args >= MAX_ARGS) {
goto cleanup;
}
- args[nb_args++] = qemu_strdup("");
+ args[nb_args++] = g_strdup("");
}
if (nb_args <= 1) {
/* command completion */
cleanup:
for (i = 0; i < nb_args; i++) {
- qemu_free(args[i]);
+ g_free(args[i]);
}
}
qobject_incref(mon->mc->id);
cmd_name = qdict_get_str(input, "execute");
+ trace_handle_qmp_command(mon, cmd_name);
if (invalid_qmp_mode(mon, cmd_name)) {
qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
goto err_out;
}
- if (strstart(cmd_name, "query-", &query_cmd)) {
+ cmd = qmp_find_cmd(cmd_name);
+ if (!cmd && strstart(cmd_name, "query-", &query_cmd)) {
cmd = qmp_find_query_cmd(query_cmd);
- } else {
- cmd = qmp_find_cmd(cmd_name);
}
-
if (!cmd) {
qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
goto err_out;
static QObject *get_qmp_greeting(void)
{
- QObject *ver;
+ QObject *ver = NULL;
- do_info_version(NULL, &ver);
+ qmp_marshal_input_query_version(NULL, NULL, &ver);
return qobject_from_jsonf("{'QMP':{'version': %p,'capabilities': []}}",ver);
}
is_first_init = 0;
}
- mon = qemu_mallocz(sizeof(*mon));
+ mon = g_malloc0(sizeof(*mon));
mon->chr = chr;
mon->flags = flags;
}
if (monitor_ctrl_mode(mon)) {
- mon->mc = qemu_mallocz(sizeof(MonitorControl));
+ mon->mc = g_malloc0(sizeof(MonitorControl));
/* Control mode requires special handlers */
qemu_chr_add_handlers(chr, monitor_can_read, monitor_control_read,
monitor_control_event, mon);
- qemu_chr_set_echo(chr, true);
+ qemu_chr_fe_set_echo(chr, true);
} else {
qemu_chr_add_handlers(chr, monitor_can_read, monitor_read,
monitor_event, mon);