Why exit Boot Services?
Why exit Boot Services?
While using UEFI, why we need to exit boot services? Can it work without exiting? (I wrote an entire shell without exiting boot services.)
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why exit Boot Services?
The graphics support in UEFI is a lot worse than in the legacy BIOS using VBE. With VBE, you can setup V86 mode to switch video modes. On UEFI, this is basically impossible.
What this means is that it's best to set the "optimal video mode" that match with the display at boot time, either with VBE or before exiting boot services in UEFI. There is not much use in being able to switch video modes during runtime anyway (I once supported this, but no longer use it).
Still, setting the right video mode with UEFI automatically is far from clear how to do. My current solution is to always use the first available, as this appears to be correct on the implementations I've seen, but this might break on other hardware. Non-native video modes are often not working properly with UEFI either, and some Intel PCs doesn't support the native mode at all if it is not 4:3.
What this means is that it's best to set the "optimal video mode" that match with the display at boot time, either with VBE or before exiting boot services in UEFI. There is not much use in being able to switch video modes during runtime anyway (I once supported this, but no longer use it).
Still, setting the right video mode with UEFI automatically is far from clear how to do. My current solution is to always use the first available, as this appears to be correct on the implementations I've seen, but this might break on other hardware. Non-native video modes are often not working properly with UEFI either, and some Intel PCs doesn't support the native mode at all if it is not 4:3.
-
- Posts: 5
- Joined: Mon Jul 15, 2024 3:15 am
Re: Why exit Boot Services?
To use the runtime services? RTC is a requirement for a real operating system.
Re: Why exit Boot Services?
I cannot see any use of the runtime services, and they also depend on keeping the paging structure from boot time. This is quite impossible if you switch from long mode to protected mode, but even if you keep the processor mode it requires the ability to keep the unity mapping, which is not a good idea.trulyirrelevant wrote: ↑Wed Jul 24, 2024 2:49 pm To use the runtime services? RTC is a requirement for a real operating system.
-
- Posts: 5
- Joined: Mon Jul 15, 2024 3:15 am
Re: Why exit Boot Services?
x86 and UEFI are antithetical, do BIOS
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why exit Boot Services?
No they don't.
You can call runtime services with your own paging structures. You can choose any virtual addresses, you don't need to identity-map the runtime services memory regions. Runtime services memory regions only need to be mapped right before you call runtime services, and you can unmap them after the call returns.
Re: Why exit Boot Services?
Still, basically every UEFI is 64-bit, and to call runtime services in long mode, I would need to switch the processor to long mode with an appropriate page table mapping, call the service, and switch back to protected mode. That might work for non-critical occasional services, but not much else. It's a bit like using BIOS services from protected mode. Switching video mode might work, but implementing important services that way is not a good idea.Octocontrabass wrote: ↑Thu Jul 25, 2024 7:43 pmNo they don't.
You can call runtime services with your own paging structures. You can choose any virtual addresses, you don't need to identity-map the runtime services memory regions. Runtime services memory regions only need to be mapped right before you call runtime services, and you can unmap them after the call returns.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm