Am 30.01.2012 03:22, schrieb Anthony Liguori:
> On 01/29/2012 07:25 AM, Andreas Färber wrote:
>> +static void arm_cpu_realize(Object *obj)
>> +{
>> +ARMCPU *cpu = ARM_CPU(obj);
>> +ARMCPUClass *cpu_class = ARM_CPU_GET_CLASS(obj);
>> +
>> +memset(&cpu->env, 0, sizeof(CPUARMState));
>> +
Am 30.01.2012 03:22, schrieb Anthony Liguori:
> On 01/29/2012 07:25 AM, Andreas Färber wrote:
>> +#define ENV_GET_OBJECT(e) \
>> +(Object *)((void *)(e) - offsetof(ARMCPU, env))
>
> sizeof(CPU) should be sizeof(void *).
Not following... CPU is a struct, so:
sizeof(ARMCPU) > sizeof(CPU) >= siz
On 01/29/2012 07:25 AM, Andreas Färber wrote:
We g_malloc0()'ed CPUARMState ourself, and exec.c's cpu_copy() runs
through cpu_init() as well, so we are at liberty to supply the CPUState
any way we see fit. Having CPUARMState as field in the QOM CPU allows
both to access env from an ARMCPU object
We g_malloc0()'ed CPUARMState ourself, and exec.c's cpu_copy() runs
through cpu_init() as well, so we are at liberty to supply the CPUState
any way we see fit. Having CPUARMState as field in the QOM CPU allows
both to access env from an ARMCPU object and to access the QOM Object
and its ObjectClass