Import 2.3.18pre1
[davej-history.git] / include / asm-mips / smplock.h
blob2be6e9461bb7aafea18d5adb2fa52bff797f5bd4
1 /* $Id$
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
7 * Default SMP lock implementation
8 */
9 #include <linux/interrupt.h>
10 #include <linux/spinlock.h>
12 extern spinlock_t kernel_flag;
15 * Release global kernel lock and global interrupt lock
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)
26 * Re-acquire the kernel lock
28 #define reacquire_kernel_lock(task) \
29 do { \
30 if (task->lock_depth >= 0) \
31 spin_lock(&kernel_flag); \
32 } while (0)
36 * Getting the big kernel lock.
38 * This cannot happen asynchronously,
39 * so we only need to worry about other
40 * CPU's.
42 extern __inline__ void lock_kernel(void)
44 if (!++current->lock_depth)
45 spin_lock(&kernel_flag);
48 extern __inline__ void unlock_kernel(void)
50 if (--current->lock_depth < 0)
51 spin_unlock(&kernel_flag);