On Wed, Sep 22, 2010 at 08:09:06PM -0700, H. Peter Anvin wrote:
On 09/22/2010 07:05 PM, Kevin O'Connor wrote:
Actually you can switch to protected mode and turn the page tables on if you want.
That's a good idea. Though it still sounds tricky to handle page faults.
Yes, probably. On the other hand, if the BIOS low-level hardware drivers are executed in V86 mode without a 1:1 mapping you're pretty much dead anyway (since DMA would be all wrong.)
I was thinking in terms of a general SMI handler that could be used to replace all 16bit code.
I suppose one could write a simple SMI handler that just set the OHCI cmdstatus bits. That probably wouldn't be too hard and it wouldn't be too complex.
I didn't think there was a way for the user code to know it was running in vm86 mode - I thought it appeared just like regular real-mode. One could try to go into protected mode and try to catch the failure, but I'd guess most OSs that run code in vm86 mode would trap and abort in that situation.
No, the SMSW instruction can be used to distinguish protected mode and therefore V86 mode.
Thanks. Do you know of a way to backup the hidden segment registers? The BIOS can be invoked in real mode or bigreal mode. I didn't see a way for the BIOS to determine this so that it can properly return in the same mode (real vs bigreal).
There isn't one (other than binary search of the faulting space) except SMM.
I think that pretty much only leaves SMM then.