[vbox-dev] Question regarding channel callbacks between guest and host
Ramshankar
ramshankar.venkataraman at oracle.com
Fri Apr 25 13:57:32 UTC 2014
On 04/25/14 02:30 AM, Jaeyong Yoo wrote:
> They must have the same function name but reside in different address
> space (guest and host). Currently, I'm trying to figure out how guest
> and host interact with events (such as guest notifying host or host
> injecting interrupt to guest). I'm suspecting that VBox is also using
> VT-x techniques (such as IO port/MMIO emulation or virtual APIC
> interrupt injection). But, it is quite hard to point the source that
> actually do that. Could you give me a little heads up? Thanks, Jaeyong
The way we do IO and MMIO access is a bit complicated to trace because
of a lot of indirection but the structure of the overall design is quite
logical.
When executing guest-code under hardware virtualization, we'll get
VM-Exits/#VMEXIT (for VT-x, see VMMR0/HMVMXR0.cpp hmR0VmxExitIoInstr(),
hmR0VmxExitXcptPF() etc., for AMD-V see VMMR0/HMSVMR0.cpp:
hmR0SvmExitIOInstr(), hmR0SvmExitXcptPF() etc.) that end up calling into
the PDM/PGM/IOM subsystem. That then based on the port and access will
choose the access handler which was registered for the port/MMIO region.
Different devices register access handlers for IO ports using
PDMDevHlpIOPortRegister() and MMIO using PDMDevHlpMMIORegister().
Finding which access handler gets called can be a bit tricky. One of the
easier ways is, to see what has been registered using the VM debugger
("info phys" and "info handlers").
Depending on whether the device can handle the access request in ring-0
or not, we may reschedule the work to be done in ring-3.
Hope that helps.
Regards,
Ram.
More information about the vbox-dev
mailing list