|
@@ -125,13 +125,12 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
|
|
|
|
|
|
monitor_data_init(&hmp.common, false, true, false);
|
|
monitor_data_init(&hmp.common, false, true, false);
|
|
|
|
|
|
- old_mon = cur_mon;
|
|
|
|
- cur_mon = &hmp.common;
|
|
|
|
|
|
+ old_mon = monitor_set_cur(&hmp.common);
|
|
|
|
|
|
if (has_cpu_index) {
|
|
if (has_cpu_index) {
|
|
int ret = monitor_set_cpu(&hmp.common, cpu_index);
|
|
int ret = monitor_set_cpu(&hmp.common, cpu_index);
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
- cur_mon = old_mon;
|
|
|
|
|
|
+ monitor_set_cur(old_mon);
|
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
|
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
|
"a CPU number");
|
|
"a CPU number");
|
|
goto out;
|
|
goto out;
|
|
@@ -139,7 +138,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
|
|
}
|
|
}
|
|
|
|
|
|
handle_hmp_command(&hmp, command_line);
|
|
handle_hmp_command(&hmp, command_line);
|
|
- cur_mon = old_mon;
|
|
|
|
|
|
+ monitor_set_cur(old_mon);
|
|
|
|
|
|
WITH_QEMU_LOCK_GUARD(&hmp.common.mon_lock) {
|
|
WITH_QEMU_LOCK_GUARD(&hmp.common.mon_lock) {
|
|
if (qstring_get_length(hmp.common.outbuf) > 0) {
|
|
if (qstring_get_length(hmp.common.outbuf) > 0) {
|
|
@@ -297,7 +296,7 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize)
|
|
|
|
|
|
CPUState *mon_get_cpu(void)
|
|
CPUState *mon_get_cpu(void)
|
|
{
|
|
{
|
|
- return mon_get_cpu_sync(cur_mon, true);
|
|
|
|
|
|
+ return mon_get_cpu_sync(monitor_cur(), true);
|
|
}
|
|
}
|
|
|
|
|
|
CPUArchState *mon_get_cpu_env(void)
|
|
CPUArchState *mon_get_cpu_env(void)
|
|
@@ -1232,6 +1231,7 @@ static void hmp_acl_remove(Monitor *mon, const QDict *qdict)
|
|
|
|
|
|
void qmp_getfd(const char *fdname, Error **errp)
|
|
void qmp_getfd(const char *fdname, Error **errp)
|
|
{
|
|
{
|
|
|
|
+ Monitor *cur_mon = monitor_cur();
|
|
mon_fd_t *monfd;
|
|
mon_fd_t *monfd;
|
|
int fd, tmp_fd;
|
|
int fd, tmp_fd;
|
|
|
|
|
|
@@ -1270,6 +1270,7 @@ void qmp_getfd(const char *fdname, Error **errp)
|
|
|
|
|
|
void qmp_closefd(const char *fdname, Error **errp)
|
|
void qmp_closefd(const char *fdname, Error **errp)
|
|
{
|
|
{
|
|
|
|
+ Monitor *cur_mon = monitor_cur();
|
|
mon_fd_t *monfd;
|
|
mon_fd_t *monfd;
|
|
int tmp_fd;
|
|
int tmp_fd;
|
|
|
|
|
|
@@ -1356,7 +1357,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
|
|
const char *opaque, Error **errp)
|
|
const char *opaque, Error **errp)
|
|
{
|
|
{
|
|
int fd;
|
|
int fd;
|
|
- Monitor *mon = cur_mon;
|
|
|
|
|
|
+ Monitor *mon = monitor_cur();
|
|
AddfdInfo *fdinfo;
|
|
AddfdInfo *fdinfo;
|
|
|
|
|
|
fd = qemu_chr_fe_get_msgfd(&mon->chr);
|
|
fd = qemu_chr_fe_get_msgfd(&mon->chr);
|