qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/6 v4] target-tilegx: Firstly add to qemu with


From: Chen Gang S
Subject: Re: [Qemu-devel] [PATCH 1/6 v4] target-tilegx: Firstly add to qemu with minimized features
Date: Sun, 01 Mar 2015 03:19:36 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 2/28/15 01:36, Andreas Färber wrote:
>> +static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
>> > +{
>> > +    DeviceClass *dc = DEVICE_CLASS(oc);
>> > +    CPUClass *cc = CPU_CLASS(oc);
>> > +    TilegxCPUClass *mcc = TILEGX_CPU_CLASS(oc);
>> > +
>> > +    mcc->parent_realize = dc->realize;
>> > +    dc->realize = tilegx_cpu_realizefn;
>> > +
>> > +    mcc->parent_reset = cc->reset;
>> > +    cc->reset = tilegx_cpu_reset;
>> > +
>> > +    cc->has_work = tilegx_cpu_has_work;
>> > +    cc->do_interrupt = tilegx_cpu_do_interrupt;
>> > +    cc->cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
>> > +    cc->dump_state = NULL;
>> > +    cc->set_pc = tilegx_cpu_set_pc;
>> > +    cc->gdb_read_register = NULL;
>> > +    cc->gdb_write_register = NULL;
> Is this really safe to do? If so, all fields are zero-initialized at
> this point already, so no need to assign NULL or 0.
> 
>> > +    cc->handle_mmu_fault = tilegx_cpu_handle_mmu_fault;
>> > +    dc->vmsd = &vmstate_tilegx_cpu;
>> > +    dc->props = tilegx_properties;
>> > +    cc->gdb_num_core_regs = 0;
>> > +}
>> > +

When we set gdb_num_core_regs be 0, gdb_read/write_register should not
be called, and they assume the callers always pass valid parameters.

 - For alpha, s390 have considered about the invalid parameter.

 - arm, i386 and microblaze do not consider about the invalid parameter.

For dump_state, the caller will check whether it is NULL, before use it.

Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed



reply via email to

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