summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-02-26 20:49:17 +0100
committerRichard Braun <rbraun@sceen.net>2013-02-26 20:49:17 +0100
commitc5f5244fc70018d5271da9e5fe8b52212b29321d (patch)
treec510b91801a8436a0dafe206f3219ca329d06d8d
parent644a177521a390133c98b9de83934a25e2be4f67 (diff)
x86/cpu: add implicit compiler barriers
-rw-r--r--arch/x86/machine/cpu.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h
index bd5c2b8f..9e846e34 100644
--- a/arch/x86/machine/cpu.h
+++ b/arch/x86/machine/cpu.h
@@ -311,6 +311,8 @@ cpu_tlb_flush_va(unsigned long va)
/*
* Return the content of the EFLAGS register.
+ *
+ * Implies a compiler barrier.
*/
static __always_inline unsigned long
cpu_get_eflags(void)
@@ -319,7 +321,8 @@ cpu_get_eflags(void)
asm volatile("pushf\n"
"pop %0\n"
- : "=r" (eflags));
+ : "=r" (eflags)
+ : : "memory");
return eflags;
}
@@ -348,18 +351,23 @@ cpu_intr_disable(void)
/*
* Restore the content of the EFLAGS register, possibly enabling interrupts.
+ *
+ * Implies a compiler barrier.
*/
static __always_inline void
cpu_intr_restore(unsigned long eflags)
{
asm volatile("push %0\n"
"popf\n"
- : : "r" (eflags));
+ : : "r" (eflags)
+ : "memory");
}
/*
* Disable local interrupts, returning the previous content of the EFLAGS
* register.
+ *
+ * Implies a compiler barrier.
*/
static __always_inline unsigned long
cpu_intr_save(void)
@@ -374,6 +382,8 @@ cpu_intr_save(void)
/*
* Return true if interrupts are enabled.
+ *
+ * Implies a compiler barrier.
*/
static __always_inline int
cpu_intr_enabled(void)