[vbox-dev] VirtualBox virtual device development

Jaka Bac jakabac at gmail.com
Tue Sep 14 21:27:39 GMT 2010


Thanks for your answer.

So I just use the PDMDevHlpIOPortRegister (for example) and forget
about the *R0 and *RC callback registration for now.
Do I need to put all my code in #ifdef IN_RING3 in this caes?

Jaka

On 14 September 2010 20:18, Sander van Leeuwen
<sander.x.van.leeuwen at oracle.com> wrote:
>  There are three different contexts in which device code can be run:
> - ring 3; host VM process context
> - ring 0; host kernel context (vt-x/amd-v only)
> - raw mode context; guest hypervisor context (software virtualization only)
>
> The last two are optimizations to prevent an expensive switch to the VM host
> process to
> handle e.g. very simple port I/O.
>
> If you want to start writing a virtual device, I suggest you focus on the
> ring 3 context only for now.
> The other two contexts have restrictions to which operations you're allowed
> to perform.
>
> Sander
>
> On 14-9-2010 17:22, Jaka Bac wrote:
>>
>> Hello
>>
>> I was looking at the code for the virtualbox's virtual devices and
>> there is something that I don't exacly understand.
>> I saw noticed that the one device implementation file actually
>> includes different handlers for device i/o (memory or port i/o), and
>> these are apparently compiled in more passes with different #define-s.
>> Could someone please explain what the IN_RING3 define specifies, and
>> what is the relationship with the handlers in the different contexts.
>>
>> Thank you in advance and Best Regards,
>> Jaka Bac
>>
>> _______________________________________________
>> vbox-dev mailing list
>> vbox-dev at virtualbox.org
>> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>




More information about the vbox-dev mailing list