4 * Default SMP lock implementation
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
11 #include <linux/interrupt.h>
12 #include <linux/spinlock.h>
13 #include <asm/current.h>
15 extern spinlock_t kernel_flag;
17 #define kernel_locked() spin_is_locked(&kernel_flag)
20 * Release global kernel lock and global interrupt lock
22 #define release_kernel_lock(task, cpu) \
24 if (task->lock_depth >= 0) \
25 spin_unlock(&kernel_flag); \
26 release_irqlock(cpu); \
31 * Re-acquire the kernel lock
33 #define reacquire_kernel_lock(task) \
35 if (task->lock_depth >= 0) \
36 spin_lock(&kernel_flag); \
41 * Getting the big kernel lock.
43 * This cannot happen asynchronously,
44 * so we only need to worry about other
47 static inline void lock_kernel(void)
49 if (!++current->lock_depth)
50 spin_lock(&kernel_flag);
53 static inline void unlock_kernel(void)
55 if (--current->lock_depth < 0)
56 spin_unlock(&kernel_flag);