[vbox-dev] how does i/o routed from host kernel to user space?

Klaus Espenlaub klaus.espenlaub at oracle.com
Thu Jul 14 17:12:53 GMT 2011


On 14.07.2011 17:45, Huihong Luo wrote:
> As I understand, when vm performs i/o, the i/o requests traps to the
> host kernel (assuming VT-x/AMD-V). This i/o must be sent to user mode
> VirtualBox.exe for processing. Throgh what mechanism the user mode
> callback functions are invoked? The user mode performs pooling? Address
> space switching? Interprocess communications? ...

The VM machinery is in src/VBox/VMM. If you want to look at it from the 
device emulation side, look at src/VBox/Devices (as this is about 
storage, the Storage subdir is probably most interesting).

> I really wanted to find this out. I am exploring doing a user mode
> virtual disk driver for vbox. so the same vbox code can be used to mount
> virtual disks, and vbox can have an integrated interface on Windows for
> virtual disk mounting.

I don't understand what you're exactly trying to achieve - the 
IDE/SATA/SCSI/SAS device emulations generally use DrvVD (which is 100% 
userland) for all image accesses (host floppy/DVD uses a different 
driver), so that already is a single implementation, which uses the VD 
support (see include/VBox/vd.h) for a uniform interface to all disk 
image formats. The VD framework is very flexible and powerful. It 
handles complete stacks of base and diff images and so on. Sample code 
how to use the VD framework directly is e.g. in the vbox-img tool.

Klaus




More information about the vbox-dev mailing list