From 60dd9a5ff55f32cf34041218818307a4c7b5d78a Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Mon, 12 Apr 2010 23:31:52 -0400 Subject: Add cli() and sti() wrappers... use with care... --- include/asm_x86.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/include/asm_x86.h b/include/asm_x86.h index b5bf166..6636abb 100644 --- a/include/asm_x86.h +++ b/include/asm_x86.h @@ -1,4 +1,4 @@ -/* Intel ia32 assembly. +/* Intel ia32 assembly. * Don't include directly, use asm.h instead. * * Most of this code comes straight out of the Linux kernel. @@ -16,6 +16,16 @@ static __inline__ void cpu_relax(void) __asm__ __volatile("pause"); } +/* please, use these only if you _really_ know what you're doing + * ... and remember iopl(3) first!! (include sys/io.h) + */ +static inline void cli(void) { + asm volatile("cli": : :"memory"); +} + +static inline void sti(void) { + asm volatile("sti": : :"memory"); +} #ifdef __i386__ @@ -26,18 +36,18 @@ typedef struct { int counter; } atomic_t; /** * atomic_read - read atomic variable * @v: pointer of type atomic_t - * + * * Atomically reads the value of @v. - */ + */ #define atomic_read(v) ((v)->counter) /** * atomic_set - set atomic variable * @v: pointer of type atomic_t * @i: required value - * + * * Atomically sets the value of @v to @i. - */ + */ #define atomic_set(v,i) (((v)->counter) = (i)) static __inline__ void atomic_add(int i, atomic_t *v) @@ -65,7 +75,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) : : "memory"); return i + __i; } - + #define atomic_inc_return(v) (atomic_add_return(1,v)) -- cgit v1.2.2