4 * i386 SMP lock implementation
6 #include <linux/interrupt.h>
7 #include <linux/spinlock.h>
8 #include <linux/sched.h>
9 #include <asm/current.h>
11 extern spinlock_t kernel_flag
;
14 * Release global kernel lock and global interrupt lock
16 #define release_kernel_lock(task, cpu) \
18 if (task->lock_depth >= 0) \
19 spin_unlock(&kernel_flag); \
20 release_irqlock(cpu); \
25 * Re-acquire the kernel lock
27 #define reacquire_kernel_lock(task) \
29 if (task->lock_depth >= 0) \
30 spin_lock(&kernel_flag); \
35 * Getting the big kernel lock.
37 * This cannot happen asynchronously,
38 * so we only need to worry about other
41 extern __inline__
void lock_kernel(void)
44 if (!++current
->lock_depth
)
45 spin_lock(&kernel_flag
);
52 :"=m" (__dummy_lock(&kernel_flag
)),
53 "=m" (current
->lock_depth
));
57 extern __inline__
void unlock_kernel(void)
59 if (current
->lock_depth
< 0)
62 if (--current
->lock_depth
< 0)
63 spin_unlock(&kernel_flag
);
70 :"=m" (__dummy_lock(&kernel_flag
)),
71 "=m" (current
->lock_depth
));