[vbox-dev] Fwd: Explanation about Ring0 context

Luca Carotenuto luca.carotenuto.91 at gmail.com
Tue Feb 2 09:00:55 UTC 2016

Gregory, thanks for the reply;
anyway, my question was about R3 context of the host.
Since the host must emulate the E1000 behaviour, it doesn't need to access
the I/O space on the host. So, why does it need to be in R0 context?
Also, as far as I know, the file VBoxDD.so is a library for R3 context, and
it has the references
for functions running in R0 context (e.g. e1kRegWriteTDT).
How can it be possible?

Kind Regards,
Luca Carotenuto

2016-02-01 16:11 GMT+01:00 Gregory Woodbury <redwolfe at gmail.com>:

> Depending on the CPU architecture, Ring 3 processes cannot access the
> I/O space without causing a General Protection Exception.
> Callback routines from IO requests are to let the application be told
> that an operation is completed.
> And thus have to be in the application's memory space, but they are
> actually called from the
> kernel in R0 space. There are special provisions in the x86 type
> architecture for this, and
> the callback routine has only a limited amount of freedom to access IO
> space.
> In a fully emulated environment, this might not be necessary, but
> using the hardware virtualization of KVM/QEMU, to access
> the IO space still requires Ring0 privleges.  I is a sort of
> mind-bending set of restrictions and interactioins until one
> gets used to thinking like the system developers did.
> On Mon, Feb 1, 2016 at 6:59 AM, Luca Carotenuto
> <luca.carotenuto.91 at gmail.com> wrote:
> > 1) As I understand, when we talk about Ring-0 context, we refer to kernel
> > space, while Ring-3 context refers to user space. Am I right?
> >
> > 2) I'm looking inside the E1000 emulation code
> > (/src/VBox/Devices/Network/DevE1000.cpp).
> > Assuming that the above is right, for what concerns the registers
> callbacks,
> >  I do not understand why those callbacks are compiled to be executed in
> > Ring-0 context
> > (When I use logging inside those functions, the thread name i R0).
> > Infact, looking inside the VboxDD.so file in the "out/bin" directory
> (using
> > objdump tool), it seems that this code "belongs" to Ring-3 context,
> > so why is it running in Ring-0 context?
> --
> G.Wolfe Woodbury
> redwolfe at gmail.com

Luca Carotenuto

Luca Carotenuto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20160202/eeb66362/attachment.html 

More information about the vbox-dev mailing list