[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qom-cpu for-1.4 04/14] target-arm: Detect attemp
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH qom-cpu for-1.4 04/14] target-arm: Detect attempt to instantiate non-CPU type in cpu_init() |
Date: |
Wed, 23 Jan 2013 16:25:52 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 |
Am 23.01.2013 14:41, schrieb Peter Maydell:
> On 23 January 2013 13:38, Andreas Färber <address@hidden> wrote:
>> Am 23.01.2013 14:03, schrieb Peter Maydell:
>>> On 23 January 2013 12:07, Andreas Färber <address@hidden> wrote:
>>>> + if (cpu_model == NULL) {
>>>> + return NULL;
>>>> + }
>>>
>>> explicit "== NULL" is kind of ugly; established style in
>>> target-arm/ is "if (!cpu_model)..."
>>
>> I consistently use !foo only if foo is bool. Any decent compiler will
>> optimize this appropriately.
>
> Yes -- I prefer (!ptr) not because I think the code will be different
> but because I think it is better style (and consistent with the
> current code -- there are no instances of "== NULL" in target-arm
> today).
Please see style-changed version here:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-types
https://github.com/afaerber/qemu-cpu/commit/726554290fa69425d0e94e2e4fd2fdfeeb54e00c
>>> Is this a class method because the plan is that eventually
>>> the code that instantiates the CPU object will become
>>> generic rather than target specific?
>>
>> Yes, the plan as indicated in the CPUState realizefn series is to
>> generalize cpu_init() so that it only needs to know which base type to
>> operate on. I'm not yet sure how to handle CPU properties in a generic
>> way, but said series got three or four targets into a generic QOM'ish
>> form already.
https://lists.nongnu.org/archive/html/qemu-devel/2013-01/msg03606.html
> Cool.
Preview of rebased CPU realizefn here:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-realize
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- [Qemu-devel] [PATCH qom-cpu for-1.4 00/14] QOM CPU fixes for 1.4, Andreas Färber, 2013/01/23
- [Qemu-devel] [PATCH qom-cpu for-1.4 02/14] target-unicore32: Don't use type_register_static(), Andreas Färber, 2013/01/23
- [Qemu-devel] [PATCH qom-cpu for-1.4 03/14] cpu: Add model resolution support to CPUClass, Andreas Färber, 2013/01/23
- [Qemu-devel] [PATCH qom-cpu for-1.4 09/14] qom: Introduce object_class_is_abstract(), Andreas Färber, 2013/01/23
- [Qemu-devel] [PATCH qom-cpu for-1.4 06/14] target-m68k: Detect attempt to instantiate non-CPU type in cpu_init(), Andreas Färber, 2013/01/23
- [Qemu-devel] [PATCH qom-cpu for-1.4 04/14] target-arm: Detect attempt to instantiate non-CPU type in cpu_init(), Andreas Färber, 2013/01/23
[Qemu-devel] [PATCH qom-cpu for-1.4 07/14] target-openrisc: Detect attempt to instantiate non-CPU type in cpu_init(), Andreas Färber, 2013/01/23
[Qemu-devel] [PATCH qom-cpu for-1.4 01/14] target-openrisc: Don't use type_register_static(), Andreas Färber, 2013/01/23
[Qemu-devel] [PATCH qom-cpu for-1.4 13/14] target-openrisc: Catch attempt to instantiate abstract type in cpu_init(), Andreas Färber, 2013/01/23
[Qemu-devel] [PATCH qom-cpu for-1.4 08/14] target-unicore32: Detect attempt to instantiate non-CPU type in cpu_init(), Andreas Färber, 2013/01/23
[Qemu-devel] [PATCH qom-cpu for-1.4 12/14] target-m68k: Catch attempt to instantiate abstract type in cpu_init(), Andreas Färber, 2013/01/23
[Qemu-devel] [PATCH qom-cpu for-1.4 05/14] target-alpha: Detect attempt to instantiate non-CPU type in cpu_init(), Andreas Färber, 2013/01/23