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.
void init(efi_handle_t h, efi_system_table_t *t)
{
unsigned long key;
get_memory_map(&key); /* Returns successfully, with @status=0. */
exit_boot_services(key); /* Returns successfully, with @status=0. */
asm("cli"); /* So we don't hvae to install IDT for interrupt handlers. */
while (1); /* I expect here to loop forever.
* In practice, crashes after about 10 seconds. */
}
get_memory_map(&key); /* Returns successfully, with @status=0. */
exit_boot_services(key); /* Returns successfully, with @status=0. */
What is this? It's not UEFI functions, what they do? Is this a pseudo code? Show the code instead.
ANT - NT-like OS for x64 and arm64. efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
nokimo33 wrote:I built an "OS", only a few lines, i.e 1)"cli" (for disabling interrupts), and 2) "while (1)" (for an infinite loop).
I expect this "os" to loop forever, but it crashes after 10 seconds. Why?
Assuming the code actually does what you intend (and doesn't have bugs, etc); there's only 3 things that can interrupt a CPU after interrupts are disabled with "CLI" - NMI, SMI and machine check exception. Machine check exceptions need to be enabled by the OS and therefore can't be the cause; and SMI "should work" regardless of what the OS does (if it was a problem it'd probably be a problem with lots of OSs).
If we assume it's NMI; then (without more information) my best guess would be a watchdog timer - a timer deliberately intended to reboot the computer if the OS locks up during boot. Unfortunately 10 seconds is a bit too quick to make this theory "very believable" (typically watchdog timers are set for a longer amount of time - e.g. 5 minutes).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
just a note, on UEFI, watchdog timer is disabled (by the UEFI) on return from ExitBootServices().
ANT - NT-like OS for x64 and arm64. efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).