tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD/i386 handling of CR2 vs. VirtualBox "raw" mode



On Wed, Jul 25, 2012 at 05:42:56PM +0400, Valeriy E. Ushakov wrote:
> I've been playing with NetBSD/i386 under VirtualBox (on non VT-x host).
...
> It turns out that that last problem is caused by the fact that trap()
> reads CR2 very late.  Since in vbox raw mode real CR2 is also an
> "emulated" CR2, so to say, real CR2 is already clobbered, so by the
> time we read it (as "emulated" CR2) in trap() the page fault address
> we read is wrong (it's usually an address of a field in cpu_info, like
> ntraps, that trap vector code touches on its way to call trap()).

Have you determined what actually causes CR2 to get changed?
Depending on exactly what changes ceCR2it, it may be impossible to actually
guarantee to read it early enough.

In any case surely this is a VirtualBox bug?
In should know when it modifies its CR2 value whether it is a real
host fault or an interval one (probably because it has to emulate
an instruction).

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index