<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Perhaps, I should ask this way:</DIV>
<DIV> </DIV>
<DIV>Is VirtualBox.exe looping around and continuously polling (send ioctl to kernel) for i/o requests? or whether the kernel notifies the user mode when there are i/o exits?<BR><BR>--- On <B>Thu, 7/14/11, Huihong Luo <I><huisinro@yahoo.com></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From: Huihong Luo <huisinro@yahoo.com><BR>Subject: Re: [vbox-dev] how does i/o routed from host kernel to user space?<BR>To: vbox-dev@virtualbox.org, "Klaus Espenlaub" <klaus.espenlaub@oracle.com><BR>Date: Thursday, July 14, 2011, 10:25 AM<BR><BR>
<DIV id=yiv1331197184>
<TABLE border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>Klaus,</DIV>
<DIV> </DIV>
<DIV>Thanks for the info. I am aware of those, I'd appreciate if you can dig into more detains on Host kernel => VMM ==> disk emulation layer.</DIV>
<DIV> </DIV>
<DIV>Disk emulation code is executed in a user process, how does the i/o traverse this path? In general, it is not easy for kernel to call a function inside another process.</DIV>
<DIV> </DIV>
<DIV>What I meant to implement is a Windows disk driver for offline disk access, for example, one can mount a vdi file as disk C:\. Usually this kind of driver is implemented as kernel, but I want to move the core storage code to user space, so I need to find out if vbox uses some undocumented way of forwarding kernel calls to use space.</DIV>
<DIV><BR><BR>--- On <B>Thu, 7/14/11, Klaus Espenlaub <I><klaus.espenlaub@oracle.com></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From: Klaus Espenlaub <klaus.espenlaub@oracle.com><BR>Subject: Re: [vbox-dev] how does i/o routed from host kernel to user space?<BR>To: vbox-dev@virtualbox.org<BR>Date: Thursday, July 14, 2011, 10:12 AM<BR><BR>
<DIV class=yiv1331197184plainMail>On 14.07.2011 17:45, Huihong Luo wrote:<BR>> As I understand, when vm performs i/o, the i/o requests traps to the<BR>> host kernel (assuming VT-x/AMD-V). This i/o must be sent to user mode<BR>> VirtualBox.exe for processing. Throgh what mechanism the user mode<BR>> callback functions are invoked? The user mode performs pooling? Address<BR>> space switching? Interprocess communications? ...<BR><BR>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).<BR><BR>> I really wanted to find this out. I am exploring doing a user mode<BR>> virtual disk driver for vbox. so the same vbox code can be used to mount<BR>> virtual disks, and vbox can have an integrated interface on Windows for<BR>> virtual disk mounting.<BR><BR>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.<BR><BR>Klaus<BR><BR>_______________________________________________<BR>vbox-dev mailing list<BR><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" rel=nofollow target=_blank>vbox-dev@virtualbox.org</A><BR><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" rel=nofollow target=_blank>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE></DIV><BR>-----Inline Attachment
 Follows-----<BR><BR>
<DIV class=plainMail>_______________________________________________<BR>vbox-dev mailing list<BR><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A><BR><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR></DIV></BLOCKQUOTE></td></tr></table>