qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Virtualising qmp_query_cpus() arch specifics


From: Peter Crosthwaite
Subject: [Qemu-devel] Virtualising qmp_query_cpus() arch specifics
Date: Wed, 8 Jul 2015 23:36:11 -0700

Hi All,

So for my multi-arch work, one of the eventual requirements is to
remove all #define TARGET_FOO from core code. I came across this in
cpus.c/qmp_query_cpus():

#if defined(TARGET_I386)
        X86CPU *x86_cpu = X86_CPU(cpu);
        CPUX86State *env = &x86_cpu->env;
#elif defined(TARGET_PPC)
        PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu);
        CPUPPCState *env = &ppc_cpu->env;
...

#if defined(TARGET_I386)
        info->value->has_pc = true;
        info->value->pc = env->eip + env->segs[R_CS].base;
#elif defined(TARGET_PPC)
        info->value->has_nip = true;
        info->value->nip = env->nip;
...

This should probably be a QOM CPU virtual function. What makes me
uneasy about it however, is a direct implementation means the QAPI
autogenerated CPUInfoList struct would need to be exposed to
target-foo/cpu.c. Is this ok or an abstraction fail? Do we need some
other other minimal struct to communicate between target-foo and QMP
with these particulars? Any third options?

Regards,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]