Re: [PATCH kvm-unit-tests 2/4] Introduce a C++ wrapper for the kvm APIs

Anthony Liguori
2010-11-24T18:53:32Z

On 11/24/2010 12:34 PM, Gleb Natapov wrote:
>>>> Right, and real HW does composition in the PIIX3 device. So let's
>>>> not regret making everything an ISA device later.
>>>>
>>>>
>>> You design by packaging not functionality?
>>>
>> No, if you want the ability to remove devices from the PIIX3, fine,
>> but don't call them ISA devices just for the sake of it.
>>
> PIIX3 may be totally implemented in FPGA code. I do not care. This is
> implementation detail. What important is that it provide the same
> functionality as ISA devices in the first IBM PC. That is why they are
> ISA devices and should be modeled as such. Otherwise you will have to
> redesign everything when you'll want to move to another chipset
> emulation that uses new and improved SuperIO-2XT technology inside.
>

The ISA slots (technically XT) were basically daughter board
connectors. They routed pins from a bunch of devices on the motherboard
to external daughterboards.

This included the *unused* IRQ pins, the left over DMA channels, etc.
Everything else was hard wired.

The XT connector only exposes pins 3, 4, 5, 6, and 7. The ISA connector
then added IRQs 10, 11, 12, 14, and 15.

So if a device uses IRQ 0, 1, 2, 8, 9, or 13, it's by definition not an
ISA device. It was hard wired on the motherboard.

>> I'm using C++ to understand how to make a correct design model. The
>> C++ part is only 10% of what I care about.
>>
>> I agree that Avi's example is not a strong justification for C++ and
>> I also agree that it's uglier than the same implementation in C.
>>
>>
> I am glad we agree on that :)
>

Regards,

Anthony Liguori

>>>> very few memory allocations. This is largely due to the fact that I
>>>> don't overly abstract busses and rely on simple composition where
>>>> appropriate.
>>>>
>>> I am not sure you can write useful program with few memory allocations.
>>>
>> Ultimately, you're allocating the same amount of memory, but in
>> fewer steps (because of static composition).
>>
>> Regards,
>>
>> Anthony Liguori
>>
>>
>>>> Plus, with tr1::smart_pointers, you can be leak free without every
>>>> worrying about explicit freeing. There are, of course,
>>>> possibilities of having circular references but it's not too hard to
>>>> avoid that in practice.
>>>>
>>>>
>>> --
>>> Gleb.
>>>
> --
> Gleb.
>