Jens Nerche <[EMAIL PROTECTED]> wrote:
> is the nexus thought to store _all_ information about the state
> of the vm? With other words: may I extend it with PIC state
> information? If so, I hope we can store the complete machine
> state in only one page.
Actually, all hardware devices should really be implemented in
user space IMO. What is missing is a way to report access to
I/O and/or reserved memory ranges back to user mode, and have
them distributed to a plug-in hardware model that emulates that
device. Similarly, a hardware model might raise an interrupt,
which is then signalled to the kernel module via ioctl.
Once this infrastructure is in place, I think that the PIC/PIT
should be implemented like the VGA/console model as a plugin to
the user mode app. In fact, I'd thought we'd simply take the
hardware models from Bochs; there's not much sense in duplicating
work that has already been done for Bochs ...
Maybe I should clarify this 'infrastructure' I'm talking about:
I imagine a set of routines provided by user to its plugins that
allow the plugin to register a callback handler to be called
whenever a specific hardware access is triggered by the guest
(i.e. access to an I/O port or memory within a certain range).
The flow of control would then run about like this:
- guest performs (say) an 'in' instruction
- processor faults to monitor
- emulation code decodes the 'in' instruction
- control switches to the host environment and back to user mode
- user is told the reason for the trap (I/O access; 'in'; port number)
- user searches its list of registered I/O handlers for a range that
covers the port in question
- user calls the callback in question
- plugin consults its internal device state representation and
chooses a value to return
- user modifies the context structure to reflect the result of
the 'in' instruction.
- user restarts the 'run-guest' execution at the next instruction
At a future stage we might also think about moving -for efficiency
reaons- certain frequently used device models to execute inside the
guest context. But for now we should IMO concentrate on the default
case.
Bye,
Ulrich