[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V2 4/6] monitor: use cc->get_arch_id as the cpu inde
From: |
Gu Zheng |
Subject: |
[Qemu-devel] [PATCH V2 4/6] monitor: use cc->get_arch_id as the cpu index |
Date: |
Fri, 12 Dec 2014 15:43:56 +0800 |
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 0c33458..849d1bf 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1411,6 +1411,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;
@@ -1428,11 +1429,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 f1031a1..d672743 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.7.7
- [Qemu-devel] [PATCH V2 0/6] cpu: add device_add foo-x86_64-cpu support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH V2 1/6] cpu: introduce CpuTopoInfo structure for argument simplification, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH V2 2/6] qom/cpu: move register_vmstate to common CPUClass.realizefn, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH V2 3/6] qom/cpu: move apic vmstate register into x86_cpu_apic_realize, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH V2 4/6] monitor: use cc->get_arch_id as the cpu index,
Gu Zheng <=
- [Qemu-devel] [PATCH V2 5/6] acpi:cpu hotplug: set pcmachine as icc bus' hotplug handler, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH V2 6/6] cpu: add device_add foo-x86_64-cpu support, Gu Zheng, 2014/12/12
- Re: [Qemu-devel] [PATCH V2 0/6] cpu: add device_add foo-x86_64-cpu support, Gu Zheng, 2014/12/19