Hi,
Brendan wrote:The problem is that as an OS developer tries to go beyond the "simple OS" stage it becomes increasingly more difficult to justify.
Well, when you go beyond a simple OS you're soon going to want to do anything that involves USB directly instead of using the BIOS, so at that point you're ready to abandon the BIOS for anything other than changing screen mode, and if sufficient documentation is available to enable you to do that directly you might eventually abandon the BIOS for that too (assuming you consider it necessary to change it at all). There may be a stage in between, however, when it will still make more sense to "stop the world" for a little while to change screen mode rather than having to reboot the machine to do it in a much more disruptive way (or just put up with not being in the best screen mode for a particular task and enjoy watching the processor fail to update the screen at an adequate rate).
I'm also not sure just how much you would actually have to undo in order to use the BIOS to change screen mode, and it may vary on different machines. Is the BIOS really likely to interfere with other processors or even notice whether they're still actively processing data in the background? So long as they don't generate an interrupt that affects the processor being controlled by the BIOS, they may be completely invisible to it. I very much doubt that many BIOSes bother to check the state of every last piece of hardware on the machine every time they are asked to change screen mode just to see if they're still set up as it left them earlier.
... Basically you end up with a "stop the world" scenario where the entire OS and all of the hardware has to be stopped.
Stopping the world isn't necessarily going to be a problem, provided that you aren't doing something like writing a CD in the background, but if you want to run a specific program in a specific screen mode without anything else running in the background in order to get the best performance out of it, it may be possible to do that without having to reboot, and after you've finished with it you will then be able to go back into all the other programs you left open (but inactive) in the background. That functionality would be a real gain.
Then there's the video mode switch itself (which is probably the single most expensive BIOS function),
Surely it's pretty minor compared with loading or saving - just a fraction of a second?
followed by restoring the state of everything again. It adds up to a massive problem for any hardware that is sensitive to latency - dropped packets for networking, lost keyboard and mouse data (and potentially screwed up keyboard/mouse state), annoying glitches in audio output (and worse if you're recording any sound), trashed writable CDs caused by buffer under-runs,
You wouldn't do it at a time when anything like that was going to be disrupted - the OS would warn you clearly about anything that will be affected and suggest you wait until a point where no harm can be done to anything.
dropped hot-plug or thermal sensor events,
You'd be warned not to plug anything in or out. I don't know how you handle thermal sensor events, but if there's a risk of processors overheating while you're using the BIOS you can presumably stop them or slow them down as a precaution.
Then there's bugs. How are you going to test that all of the above works reliably on all different combinations of hardware under a range of different conditions? Quite simply you're not - it's going to be an untestable and unstable/glitchy mess, and the first time it fails is going to be the last time the unfortunate end-user will dare to use it.
If it causes a crash, the user may well never repeat the experiment, but just suppose it works absolutely fine every time on most machines - is it really so daft to provide the option? That option could then be disabled by the user for the future on that machine if there is a problem with it. I can see why you aren't keen to put in the work that would be needed for your OS to be able to do this kind of thing because "stopping the world" isn't in keeping with the kind of work a server needs to do, but I can't see anything that would necessarily result in bugs from programming your OS to be able to shut everything down and then start it all up again. If it's not possible for you to do that, then maybe you've built a bit of a mess which only works as well as it does by luck - even if it takes a while, it ought to be able to bring everything to a halt bit by bit without tripping over itself.
Basically, it's one of those things that seems easy in the beginning, but becomes incredibly hard in the long run. I'd be tempted to suggest that people who suggest this method will never get past the "simple OS" stage, regardless of how hard they try.
I suspect that they're more likely to succeed than if they shun the BIOS from the outset and set themselves a massive great boring slog of a task just to get their foot in the door. I initially tried to do everything without using the BIOS for anything beyond loading my boot sector, but it was a mistake - the BIOS is useful and will continue to be useful to me for a while yet. If you've got on top of USB and don't need to change screen mode (e.g. because your OS is designed for server use and the display is unimportant), then fine - you can stop using the BIOS moments after booting. If you manage to find sufficient documentation on changing the screen mode without using the BIOS and have the time to write all the code to do that, then again you may be free of the BIOS. However, I personally do not intend to spend years working on USB and screen-mode stuff at the moment - there are plenty of other areas of OS design which are higher priority, such as trying to build human-level A.I. into the heart of the system.
Of course some people don't intend to go past the "simple OS" stage. For example, they might be writing a simple OS for educational purposes - e.g. because they want to learn how to design software with fatal flaws.

Maybe so if their intention is to illustrate a fatal flaw. Mine is not. I need to be able to load and save data from time to time and there is very little harm at the moment in "stopping the world" for that, though it will clearly need to find a better way to do it later on. I also want users of my OS to be able to explore different screen modes, so I will continue to provide a route to doing that as my OS becomes more complex, and since changing screen mode isn't something you need to do every few seconds, there may never be any reason to bother doing it in any way other than via the BIOS. The reality is that there are perfectly good reasons for wanting to use the BIOS and it's up to each of us to make our own decisions about when to use or not use it. The ability of an OS to continue to use the BIOS does not need to restrict its complexity or capability. Even once my OS can save to USB devices directly rather than through the BIOS, it will still retain the BIOS method just in case the code for direct saving becomes corrupted (which might happen at some point while it's being modified) - it may on occasions enable important data to be saved that would otherwise be lost.