summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-05-15 02:09:50 +0200
committerRichard Braun <rbraun@sceen.net>2013-05-15 02:09:50 +0200
commitec41b64a5b5601db55946d18fc00ede44d242d63 (patch)
treeb7b51f82874905ed0c0fef7cbef56ee1cea98c4b
parent079a3639475304ecdc24b850c0f2679fe4be1aea (diff)
x86/cpu: make cpu_idle safely enable interrupts
The idle loop is being reworked and requires this change.
-rw-r--r--arch/x86/machine/cpu.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h
index 9acd746a..edc98801 100644
--- a/arch/x86/machine/cpu.h
+++ b/arch/x86/machine/cpu.h
@@ -406,12 +406,16 @@ cpu_pause(void)
/*
* Make the CPU idle until the next interrupt.
*
+ * Interrupts are enabled. Besides, they're enabled in a way that doesn't
+ * allow the processor handling them before entering the idle state if they
+ * were disabled before calling this function.
+ *
* Implies a compiler barrier.
*/
static __always_inline void
cpu_idle(void)
{
- asm volatile("hlt" : : : "memory");
+ asm volatile("sti; hlt" : : : "memory");
}
/*
@@ -425,7 +429,7 @@ cpu_halt(void)
cpu_intr_disable();
for (;;)
- cpu_idle();
+ asm volatile("hlt" : : : "memory");
}
/*