[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/23] target-ppc: Use cpu_exec_enter qom hook
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 05/23] target-ppc: Use cpu_exec_enter qom hook |
Date: |
Sun, 14 Sep 2014 18:16:33 -0700 |
On 14 September 2014 12:43, Alex Bennée <address@hidden> wrote:
>
> Richard Henderson writes:
>
>> Cc: address@hidden
>> Signed-off-by: Richard Henderson <address@hidden>
> <snip>
>> +static void ppc_cpu_exec_enter(CPUState *cs)
>> +{
>> + PowerPCCPU *cpu = POWERPC_CPU(cs);
>> + CPUPPCState *env = &cpu->env;
>> +
>
> Ok the naming of those structures and the order to traverse them gets
> confusing - is it really CPUState -> ${ARCH}CPU -> ${ARCH}CPUState?
CPUState is the QOM base class name. The
subclass names are ${ARCH}CPU. CPU${ARCH}State
is the name of the "env struct" which is embedded
within the ${ARCH}CPU struct (but not at the start of it).
The available conversions are:
${ARCH}CPU to CPUState : CPU(x)
CPUState to ${ARCH}CPU : ${ARCH}_CPU(cs)
(these are just the stock QOM casting macros)
${ARCH}CPU to env: &cpu->env
env to ${ARCH}CPU: ${arch}_env_get_cpu(env)
(the latter is just a container_of operation)
env to CPUState: ENV_GET_CPU(env)
CPUState to env: convert via ${ARCH}_CPU
(and actually ENV_GET_CPU is just sugar for
a conversion via ${ARCH}_CPU)
As a method on the base QOM CPU class, this
family of functions is correctly taking CPUState*
as the argument.
-- PMM
- [Qemu-devel] [PATCH 01/23] qom: Add cpu_exec_enter and cpu_exec_exit hooks, (continued)
- [Qemu-devel] [PATCH 01/23] qom: Add cpu_exec_enter and cpu_exec_exit hooks, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 02/23] cpu-exec: Remove do-nothing ifdef chains, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 03/23] target-i386: Use cpu_exec_enter/exit qom hooks, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 04/23] target-m68k: Use cpu_exec_enter/exit qom hooks, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 05/23] target-ppc: Use cpu_exec_enter qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 06/23] qom: Add cpu_exec_interrupt hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 08/23] target-s390x: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 09/23] target-m68k: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 07/23] target-xtensa: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13