At 03/01/2012 01:01 PM, HATAYAMA Daisuke Wrote:
> From: Wen Congyang <we...@cn.fujitsu.com>
> Subject: [RFC][PATCH 06/14 v7] target-i386: Add API to write cpu status to 
> core file
> Date: Thu, 01 Mar 2012 10:48:17 +0800
> 
>> +struct QEMUCPUState {
>> +    uint32_t version;
>> +    uint32_t size;
>> +    uint64_t rax, rbx, rcx, rdx, rsi, rdi, rsp, rbp;
>> +    uint64_t r8, r9, r10, r11, r12, r13, r14, r15;
>> +    uint64_t rip, rflags;
>> +    QEMUCPUSegment cs, ds, es, fs, gs, ss;
>> +    QEMUCPUSegment ldt, tr, gdt, idt;
>> +    uint64_t cr[5];
>> +};
>> +
>> +typedef struct QEMUCPUState QEMUCPUState;
> <cut>
>> +static void qemu_get_cpustate(QEMUCPUState *s, CPUState *env)
>> +{
>> +    memset(s, 0, sizeof(QEMUCPUState));
>> +
>> +    s->version = 1;
> 
> It seems to me better to prepare a macro:
> 
>   #define QEMUCPUSTATE_VERSION (1)
> 
> and use it as:
> 
>   s->version = QEMUCPUSTATE_VERSION;
> 
> and add comment above the macro definition indicating: please count up
> QEMUCPUSTATE_VERSION if you have changed definition of QEMUCPUState,
> and modify the tools using this information accordingly.

Yes, I will fix it.

PS: Do you have any comment about QEMUCPUState? I think the content is enough
to calculate phys_base now.

Thanks
Wen Congyang

> 
> Thanks.
> HATAYAMA, Daisuke
> 
> 


Reply via email to