--- zzzz-none-000/linux-2.4.17/include/asm-mips/smplock.h 2000-03-23 20:50:09.000000000 +0000 +++ sangam-fb-401/linux-2.4.17/include/asm-mips/smplock.h 2004-04-08 07:35:46.000000000 +0000 @@ -1,4 +1,4 @@ -/* $Id: smplock.h,v 1.2 1999/10/09 00:01:43 ralf Exp $ +/* $Id: smplock.h,v 1.1.1.1 2003/06/23 22:18:40 jharrell Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -6,12 +6,32 @@ * * Default SMP lock implementation */ +#include #include #include extern spinlock_t kernel_flag; +#ifdef CONFIG_PREEMPT_TIMES +#define lock_bkl() do { \ + current->preempt_count++; \ + preempt_lock_start(3); \ + _raw_spin_lock(&kernel_flag); \ +} while (0) +#else +#define lock_bkl() spin_lock(&kernel_flag) +#endif +#define unlock_bkl() spin_unlock(&kernel_flag) + +#ifdef CONFIG_SMP #define kernel_locked() spin_is_locked(&kernel_flag) +#else +#ifdef CONFIG_PREEMPT +#define kernel_locked() preempt_is_disabled() +#else +#define kernel_locked() 1 +#endif +#endif /* * Release global kernel lock and global interrupt lock @@ -33,6 +53,19 @@ spin_lock(&kernel_flag); \ } while (0) +#ifdef CONFIG_PREEMPT_TIMES +#define lock_kernel() do { \ + if (current->lock_depth == -1) \ + lock_bkl(); \ + ++current->lock_depth; \ +} while (0) + +#define unlock_kernel() do { \ + if (--current->lock_depth < 0) \ + unlock_bkl(); \ +} while (0) + +#else /* CONFIG_PREEMPT_TIMES */ /* * Getting the big kernel lock. @@ -43,8 +76,14 @@ */ extern __inline__ void lock_kernel(void) { +#ifdef CONFIG_PREEMPT + if (current->lock_depth == -1) + spin_lock(&kernel_flag); + ++current->lock_depth; +#else if (!++current->lock_depth) spin_lock(&kernel_flag); +#endif } extern __inline__ void unlock_kernel(void) @@ -52,3 +91,4 @@ if (--current->lock_depth < 0) spin_unlock(&kernel_flag); } +#endif /* CONFIG_PREEMPT_TIMES */