>> Good system. I'd like to expand this to other events (physical memory,
>> interrupts).
>
>Interesting. Could you elaborate a little. If I can get an idea
>where you want to go with this, maybe can make some better choices
>regarding initial implementation. Wouldn't want to rewrite all
>20 lines of callback redirect code. :^)
Well, I mean this:
- I/O-based drivers allocate I/O ports
- Memory-based drivers (i.e., VGA card) allocate physical memory
I guess you could even make physical memory itself a driver, dynamically
allocating host memory at need (just a wild idea).
- A real x86 has an INTR pin. In stead of simulating this, it would be easier
just to be able to generate an interrupt by ioctl()ing the driver, that's
logical.
However, there may be drivers that want to *catch* generated interrupts
(software or hardware). This is especially useful for simulating an ICE,
for me that would be one of the most useful aspects of such a system (vICE).
Another idea would be that you could potentially speed up emulation of an OS
by implementing parts of it outside the VM; an idea would be having WINE
collaborate with the VM (solves the VxD problem ?) You could do this
by giving drivers the ability to "hook" interrupts.
In general, I think every resource that might trigger some driver action should
be hookable. However, if such a resource is not hooked you should notice no
performance decrease from if hooking were not implemented in the first place.
(for instance, memory-based hooking may be done at page level; I/O hooking
has fine-grained control through I/O permission bitmaps; interrupts are
also simple
to implement).
Right now, I can think of these kinds of devices:
- I/O based. Traditional.
- DMA based. Need a DMA driver, and some way to access memory
(but not hook it).
- Memory based I/O. VGA cards, APIC, etc. Need memory hooking.
- Bus snooping. Intel Paragon NIC, etc. Memory hooking would be okay I guess.
However, it doesn't sound very *efficient*.
Have I missed any ?
I think memory hooking should have an "urgent" flag.
- "urgent" memory hooks get invoked as soon as there's a write (or perhaps
also read) to/from the memory
- non-"urgent" hooks check the memory every X amount of time to see whether
it's dirty, and if so invoke the driver.
Tell me what you think.
>Damn, almost 4am again. I must virtualize myself and run a
>few copies.
>
> #define MAX_KEVINS 256
> class kevin;
>
> vkevin = new kevin[MAX_KEVINS];
>
> for (unsigned i=0; i<MAX_KEVINS]; i++) {
> vkevin[i].hack();
> }
>
>much better...
You know it when you're talking to *real* geeks ;)
-- Ramon