Not calling ExitBootServices?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sleirsgoevy
Posts: 3
Joined: Thu Jul 07, 2022 3:30 pm

Not calling ExitBootServices?

Post by sleirsgoevy »

Question: on BIOS systems there is no ExitBootServices involved, instead the OS just moves the CPU to protected mode and forgets that BIOS existed. What bad things can happen if I do the same to UEFI?

That is: not call ExitBootServices, instead just load my own GDT/IDT/page tables, reconfigure PIC/APIC/whatever and boot the OS. And maybe even keep calling the boot services in some emulated environment (this is just a random spin-off thought, please don't interpret it the way that I'm lazy to write drivers).

Watchdog might be one concern, are there others?
sounds
Member
Member
Posts: 112
Joined: Sat Feb 04, 2012 5:03 pm

Re: Not calling ExitBootServices?

Post by sounds »

I think the question can be taken seriously. Is a UEFI BIOS likely to interfere if ExitBootServices is not called?

No one can give you a guarantee. You'd have to test it on real systems. But here are some things to watch out for:
  1. System Management Mode interrupts and ACPI System Control Interrupts (link) would transfer control to the UEFI BIOS and could lead to unexpected behavior.
  2. For servers, the BMC (link) would likely also behave in unexpected ways
It bears repeating: calling ExitBootServices does not mean the OS forgets all about the UEFI BIOS. The Boot Services are no longer available after that point, but the OS still accesses the UEFI BIOS when needed. Also, the things I mentioned above demonstrate how effectively the UEFI BIOS can assert itself when it wants something.
rdos
Member
Member
Posts: 3296
Joined: Wed Oct 01, 2008 1:55 pm

Re: Not calling ExitBootServices?

Post by rdos »

SMIs are active even after ExitBootServices, and UEFI can reboot or take over your machine if it feels you haven't done what it wants you to do, like initialize ACPI as if you were a late Windows version. Happened to me on a laptop.
sleirsgoevy
Posts: 3
Joined: Thu Jul 07, 2022 3:30 pm

Re: Not calling ExitBootServices?

Post by sleirsgoevy »

> ACPI

Good point. Leaving the PC without working power management is probably not a good idea.
Post Reply