Hi,
Chandra wrote:Combuster wrote:and the bios might undo unreal mode at every call you make to it.
Wow.
I'm not sure if this happens when calling Int 13h. I've been using Unreal mode and Int 13h simultaneously, but so far I've not seen such behaviour. So, I assume this applies on other BIOS calls.
The only BIOS function/s that are guaranteed to mess up unreal mode are the "extended memory move" and "switch to protected mode" functions (that nobody actually uses). In my experience (for network boot) the PXE functions almost always mess up unreal mode too (especially if you're using etherboot/gPXE).
However, nothing really prevents any BIOS function from using protected mode internally and messing up unreal mode, because there's no formal specification that says what a BIOS must/must not do; and just because one BIOS does things a certain way doesn't mean that all BIOSs do things the same way or that future BIOSs won't do things differently.
Also note that EFI/UEFI runs in protected/long mode, and for some computers the "BIOS" may just be a layer built on top of EFI/UEFI (e.g. like "bootcamp" on 80x86 Apple machines). In this case it would be tempting for the people writing the "BIOS compatibility layer" to reuse the EFI/UEFI drivers to access the disk, etc (to avoid the need to rewrite a bunch of different drivers). Basically the BIOS function/s could just switch to protected/long mode, use the existing EFI functions, then switch back to real mode. Worse, even though EFI/UEFI uses polling (and not IRQs) for devices, it does use a timer IRQ. This means that (as an extreme worst case) a "BIOS compatibility layer" could have an IRQ0 handler that switches to protected/long mode and transfers control to the real EFI/UEFI IRQ0 handler; where (from your real/unreal mode boot loader's perspective) unreal mode is disabled at unpredictable times.
Basically what I'm saying is that almost all BIOS functions on almost all current BIOSs are "safe" and won't interfere with unreal mode; but I'd be tempted to find an alternative (e.g. "disable IRQs, switch to protected mode, do what you have to, switch back to real mode, then enable IRQs again") that is more robust anyway.
Also note that I used unreal mode for all my boot loaders for a very long time without any problems (other than re-enabling unreal mode after calling any PXE function). As a precaution (and not for any tangible reason) I stopped doing that a few years ago and started using the "switch to/from protected mode" method instead.
Cheers,
Brendan