Use new enable_interrupts_and_hlt function of x86_64

This commit is contained in:
Philipp Oppermann
2020-03-08 14:50:58 +01:00
parent c3ea4190ca
commit b3ba0ba4e9

View File

@@ -89,14 +89,7 @@ impl Executor {
// check if relevant interrupts occured since the last check
if interrupts::interrupt_wakeups().is_empty() {
// no interrupts occured -> hlt to wait for next interrupt
//
// It's important to execute `hlt` directly after `sti` because
// otherwise we could miss interrupts between the two
// instructions. Since `sti` only enables interrupts after the
// subsequent instruction, we can be sure that we don't miss an
// interrupt. (One exception are non-maskable interrupts, which
// can occur even when interrupts are disabled.)
unsafe { asm!("sti; hlt") };
x86_64::instructions::interrupts::enable_interrupts_and_hlt();
} else {
// there were some new wakeups -> continue execution
x86_64::instructions::interrupts::enable();