[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] memory: could we add extra input param for memory_regio
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()? |
Date: |
Sun, 19 Aug 2012 13:10:15 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 |
On 08/17/2012 05:52 AM, liu ping fan wrote:
>>
>> Why? Usually there's a 1:1 mapping between object and opaque. Can you
>> show cases where there isn't?
>>
> As mentioned ahead, setup_cmd646_bar(PCIIDEState *d, int bus_num),
> address@hidden, but opaque are
> d->cmd646_bar[bus_num], so that is 1:n mapping. And when I browsing
> the code, this is the main issue prevent us to transfer from void* to
> Object* for memory_region_init_io()
In this case there is a 1:1 relationship between CMD646BAR and IDEBus.
IDEBus is a BusState which is an Object. So this case can be solved easily.
>>> Above methods, the process of derive the Object will be hard, we can
>>> not tell opaque is Object or not without something like try&catch
>>
>> Take for example e1000. It passes E1000State as the opaque, which is a
>> PCIDevice, which is a DeviceState, which is an Object. So for that
>> device, nothing needs to be done.
>>
> The same example, in setup_cmd646_bar(PCIIDEState *d, int bus_num), I
> think we can not decide which is the type for @bar. If using
> object_dynamic_cast(@bar, TYPE_OBJECT) to tell whether it is Object or
> not, it will raise exception.
No, dynamic cast cannot work on an arbitrary void *.
There is only one legitimate case IMO where we don't naturally have an
object to work on - device assignment, where all the BARs are
equivalent. In that case we can just make the BARs also Objects.
Everything else should work naturally with perhaps a little refactoring.
--
error compiling committee.c: too many arguments to function
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, (continued)
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Peter Maydell, 2012/08/19
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Avi Kivity, 2012/08/19
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, liu ping fan, 2012/08/21
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Avi Kivity, 2012/08/21
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, liu ping fan, 2012/08/21
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Avi Kivity, 2012/08/21
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, liu ping fan, 2012/08/21
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Avi Kivity, 2012/08/21
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Peter Maydell, 2012/08/19
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?, Blue Swirl, 2012/08/19
- Re: [Qemu-devel] memory: could we add extra input param for memory_region_init_io()?,
Avi Kivity <=