[vbox-dev] Question regarding channel callbacks between guest and host

Jaeyong Yoo jaeyong.yoo at samsung.com
Fri Apr 25 00:30:40 GMT 2014


> Sender : Michael Thayer<michael.thayer at oracle.com>
> Date : 2014-04-24 23:00 (GMT+09:00)
> Title : Re: [vbox-dev] Question regarding channel callbacks between guest and host
> 
> Hello Jaeyong,
> 
> On 24/04/14 15:18, Jaeyong Yoo wrote:
> > While I'm reading the source, I found the following sequence of
> > function call:
> >
> > [In xpdm directory] VBoxMPHGSMIDpc () -->
> >                               VBoxHGSMIProcessHostQueue ()  -->
> >                               hgsmiHostCommandQueryProcess() -->
> >                               hgsmiHostCmdProcess () -->
> >                               HGSMIBufferProcess () -->
> >                               hgsmiBufferProcess () -->
> >                               HGSMIChannelHandlerCall ()  -->
> >                               pfnHandler()   ==
> > [Host side]             vbvaChannelHandler
> >
> > It looks like a guest-side function (in VGA driver) VBoxMPHGSMIDpc
> > calls the host-side function (in VGA emulator) vbvaChannelHandler.
> > How is this possible since host and guest are in different address
> > space (if we are using nested paging table)? Or, I'm feeling like I
> > miss something.
> 
> I'm not too familiar with that code, but what makes you think that 
> pfnHandler points to vbvaChannelHandler() inside the guest driver?  See 
> line 626 of 
> src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPInternal.cpp:
> 
>    rc = HGSMIChannelRegister(&pCommon->hostCtx.channels, u8Channel,
>                              "VGA Miniport HGSMI channel",
>                              VBoxVbvaChannelGenericHandlerCB,
>                              pContexts, &s_OldHandler);
> 
> So I would guess that VBoxVbvaChannelGenericHandlerCB() is what is being 
> called.  In any case there should be no direct calls from the guest to 
> the host address space.

Oh, I must got confused with the line 2411
src/VBox/Devices/Graphics/DevVGA_VBVA.cpp:

         rc = HGSMIHostChannelRegister (pVGAState->pHGSMI,
                                    HGSMI_CH_VBVA,
                                    vbvaChannelHandler,
                                    pVGAState,
                                    &sOldChannelHandler);

where HGSMIHostChannelRegister is finally calling
        rc = HGSMIChannelRegister (&pIns->channelInfo, u8Channel, NULL, pfnChannelHandler, pvChannelHandler, pOldHandler);

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


More information about the vbox-dev mailing list