Hi,
zyp wrote:
According to a table in the AMD docs you have both 16 and 32bit compatibility mode in long mode.
It's possible that 16bit compatibility mode equals V8086 mode.
No - within long mode there's 64 bit mode and compatibility mode, where compatibility mode executes code originally designed for 32 bit protected mode and 16 bit protected mode. AMD's documentation explicitly states that both Virtual 8086 and real mode are not supported in long mode (and that any attempt to enable virtual 8086 is silently ignored).
Basically a 64 bit CPU has the following modes:
[tt]__Long Mode
|_64 bit code
|_32 bit protected mode code
|_16 bit protected mode code
__Protected Mode
|_32 bit protected mode code
|_16 bit protected mode code
|_16 bit real mode code (via. virtual 8086)
__Real Mode
|_16 bit real mode code
__System Management Mode
|_Modified/32 bit real mode (that none of us should worry about)
__Stopped
|_CPU doesn't execute anything (entered on triple fault)[/tt]
To execute real mode code in long mode you have 3 choices - emulate it (ie. like Bochs), switch back to protected mode and use virtual 8086, or switch back to real mode.
I don't like any of these options - instead I'd set a default video mode during boot (when the CPU is in real mode anyway) and don't allow this video mode to be changed without a (32 bit or 64 bit) video driver.
Cheers,
Brendan