On 08/22/2010 07:08 PM, Kevin O'Connor wrote:
On Sun, Aug 22, 2010 at 02:25:44PM +0300, Avi Kivity wrote:
On 08/22/2010 02:15 PM, Gleb Natapov wrote:
4 - Have the entry points switch immediately to 32-bit mode and call 32-bit unpaged code in 4G-2M+. Everything, for example the INT 13 code, would run in 32-bit mode from high memory.
IIRC this was discussed already. Some applications call BIOS from vm16 mode so switch to 32-bin is impossible.
Ugh. We could use the old 286 trick and reset the CPU to escape to real mode, but this isn't a viable solution (for example, how would we get back?)
It may not even be possible to reset the cpu as that may be blocked by the OS when the bios is in vm86 mode.
Well, it's likely running with all ports open since the (guest) VMM does not know what the BIOS accesses.
btw, big real mode cannot be entered in vm86 mode. So anything involving that can safely be moved to upper memory 32-bit code.
One could try invoking an SMI to get into 32bit mode, but that also has difficulties (eg, the OS could block that too, paging would have to be emulated, it could be a security problem).
Even worse (from my perspective), kvm doesn't emulate SMM.
Even with all its warts I think .code16gcc is the best route.
For 16-bit runtime services, I agree. For POST and 32-bit runtime services, I think we can easily push the code to 4G-2M.