diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-03-27 23:01:49 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-03-27 23:01:49 -0700 |
commit | c35c76ea485bf0c12812de252733e7b1c3deab1e (patch) | |
tree | 32fceaf8400d917e5937ff56d961f1abe8b44d45 | |
parent | b36675d28c2874a074d3cdde86a4711697cdf82a (diff) | |
download | syslinux-c35c76ea485bf0c12812de252733e7b1c3deab1e.tar.gz syslinux-c35c76ea485bf0c12812de252733e7b1c3deab1e.tar.xz syslinux-c35c76ea485bf0c12812de252733e7b1c3deab1e.zip |
sys/cpu.h: add barriers
Add compiler barriers around instructions that muck with the interrupt
state and so on.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | com32/include/sys/cpu.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/com32/include/sys/cpu.h b/com32/include/sys/cpu.h index 695ff29a..807e13c4 100644 --- a/com32/include/sys/cpu.h +++ b/com32/include/sys/cpu.h @@ -121,22 +121,22 @@ static inline void wrmsr(uint64_t v, uint32_t msr) static inline void cpu_relax(void) { - asm volatile("rep ; nop"); + asm volatile("rep ; nop" : : : "memory"); } static inline void hlt(void) { - asm volatile("hlt"); + asm volatile("hlt" : : : "memory"); } static inline void cli(void) { - asm volatile("cli"); + asm volatile("cli" : : : "memory"); } static inline void sti(void) { - asm volatile("sti"); + asm volatile("sti" : : : "memory"); } typedef unsigned long irq_state_t; @@ -145,7 +145,7 @@ static inline irq_state_t irq_state(void) { irq_state_t __st; - asm volatile("pushfl ; popl %0" : "=rm" (__st)); + asm volatile("pushfl ; popl %0" : "=rm" (__st) : : "memory"); return __st; } @@ -158,7 +158,7 @@ static inline irq_state_t irq_save(void) static inline void irq_restore(irq_state_t __st) { - asm volatile("pushl %0 ; popfl" : : "rm" (__st)); + asm volatile("pushl %0 ; popfl" : : "rm" (__st) : "memory"); } |