On 09/22/2010 11:21 AM, H. Peter Anvin wrote:
On 09/22/2010 05:52 AM, Kevin O'Connor wrote:
On Wed, Sep 22, 2010 at 06:40:58AM +0200, Peter Stuge wrote:
Kevin O'Connor wrote:
When in 16bit mode, one can only reliably access the first 1Meg of ram.
Flat real mode?
The BIOS can put the machine in big real mode when it launches the OS, but it can't expect that it will always be called in big real mode. The BIOS could attempt to transition to 32bit mode (or big real mode) in the disk handler, but it may have been called in vm86 mode which would then effectively cause a crash. (It also wipes out the hidden segment registers which may confuse the OS.) Use of vm86 mode is not uncommon - freedos does it and so does (I'm told) Linux.
The standard way to deal with this in the BIOS (and *only* the BIOS can do this!) is to trap into SMM and have an SMI handler do the I/O. Taking an SMI drops the CPU into big real mode regardless of what the previous CPU mode was.
The other option is to enter protected mode for the operation, or, if you detect that you're already in protected mode (which means V86 mode) then you invoke the INT 15h mover. Not all environments is going to handle the INT 15h mover correctly, though.
-hpa