1 /*
2 * <asm/smplock.h>
3 *
4 * Default SMP lock implementation
5 */
6 #ifdef __KERNEL__
7 #include <linux/interrupt.h>
8 #include <linux/spinlock.h>
9
10 extern spinlock_t kernel_flag;
11
12 #define kernel_locked() spin_is_locked(&kernel_flag)
13
14 /*
15 * Release global kernel lock and global interrupt lock
16 */
17 #define release_kernel_lock(task, cpu) \
18 do { \
19 if (task->lock_depth >= 0) \
20 spin_unlock(&kernel_flag); \
21 release_irqlock(cpu); \
22 __sti(); \
23 } while (0)
24
25 /*
26 * Re-acquire the kernel lock
27 */
28 #define reacquire_kernel_lock(task) \
29 do { \
30 if (task->lock_depth >= 0) \
31 spin_lock(&kernel_flag); \
32 } while (0)
33
34
35 /*
36 * Getting the big kernel lock.
37 *
38 * This cannot happen asynchronously,
39 * so we only need to worry about other
40 * CPU's.
41 */
42 extern __inline__ void lock_kernel(void)
43 {
44 if (!++current->lock_depth)
45 spin_lock(&kernel_flag);
46 }
47
48 extern __inline__ void unlock_kernel(void)
49 {
50 if (--current->lock_depth < 0)
51 spin_unlock(&kernel_flag);
52 }
53 #endif /* __KERNEL__ */
54
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.