Simple and naive OS, crashes after 10 seconds
Posted: Tue Feb 20, 2018 4:34 am
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?
Other details:
No bootloader, just UEFI.
The Complete code is:
init() is defined:
I expect this "os" to loop forever, but it crashes after 10 seconds. Why?
Other details:
No bootloader, just UEFI.
The Complete code is:
Code: Select all
mov %rcx, %rdi # efi_handle_t
mov %rdx, %rsi # efi_system_table_t
call init
Code: Select all
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. */
}