[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 07/10] monitor: use cc->get_arch_id as the cpu in
From: |
Zhu Guihua |
Subject: |
[Qemu-devel] [PATCH v4 07/10] monitor: use cc->get_arch_id as the cpu index |
Date: |
Fri, 13 Feb 2015 18:25:30 +0800 |
From: Gu Zheng <address@hidden>
Use cc->get_arch_id as the cpu index to avoid the cpu index duplicated
issue in the QMP/HMP command output.
Signed-off-by: Gu Zheng <address@hidden>
Signed-off-by: Zhu Guihua <address@hidden>
---
cpus.c | 4 +++-
monitor.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cpus.c b/cpus.c
index 0cdd1d7..67d10a7 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1403,6 +1403,7 @@ CpuInfoList *qmp_query_cpus(Error **errp)
CPU_FOREACH(cpu) {
CpuInfoList *info;
+ CPUClass *cc;
#if defined(TARGET_I386)
X86CPU *x86_cpu = X86_CPU(cpu);
CPUX86State *env = &x86_cpu->env;
@@ -1420,11 +1421,12 @@ CpuInfoList *qmp_query_cpus(Error **errp)
CPUTriCoreState *env = &tricore_cpu->env;
#endif
+ cc = CPU_GET_CLASS(cpu);
cpu_synchronize_state(cpu);
info = g_malloc0(sizeof(*info));
info->value = g_malloc0(sizeof(*info->value));
- info->value->CPU = cpu->cpu_index;
+ info->value->CPU = cc->get_arch_id(cpu);
info->value->current = (cpu == first_cpu);
info->value->halted = cpu->halted;
info->value->thread_id = cpu->thread_id;
diff --git a/monitor.c b/monitor.c
index c3cc060..e57ae27 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1024,7 +1024,9 @@ static CPUArchState *mon_get_cpu(void)
int monitor_get_cpu_index(void)
{
CPUState *cpu = ENV_GET_CPU(mon_get_cpu());
- return cpu->cpu_index;
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ return cc->get_arch_id(cpu);
}
static void do_info_registers(Monitor *mon, const QDict *qdict)
--
1.9.3
- [Qemu-devel] [PATCH v4 00/10] cpu: add device_add foo-x86_64-cpu support, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 01/10] cpu/apic: drop icc bus/bridge/, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 03/10] cpu: introduce CpuTopoInfo structure for argument simplification, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 02/10] icc_bus: remove icc related files, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 06/10] qom/cpu: move apic vmstate register into x86_cpu_apic_realize, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 04/10] cpu: introduce get_compat_arch_id() method and override it for X86CPU, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 05/10] qom/cpu: move register_vmstate to common CPUClass.realizefn, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 07/10] monitor: use cc->get_arch_id as the cpu index,
Zhu Guihua <=
- [Qemu-devel] [PATCH v4 08/10] acpi: introduce acpi_send_gpe_event(), Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 09/10] cpu: add device_add foo-x86_64-cpu support, Zhu Guihua, 2015/02/13
- [Qemu-devel] [PATCH v4 10/10] i386/cpu: add instance finalize callback, Zhu Guihua, 2015/02/13
- Re: [Qemu-devel] [PATCH v4 00/10] cpu: add device_add foo-x86_64-cpu support, Gu Zheng, 2015/02/23
- Re: [Qemu-devel] [PATCH v4 00/10] cpu: add device_add foo-x86_64-cpu support, Bharata B Rao, 2015/02/25
- Re: [Qemu-devel] [PATCH v4 00/10] cpu: add device_add foo-x86_64-cpu support, Andreas Färber, 2015/02/26