This source file includes following definitions.
- lock_kernel
- unlock_kernel
1 #ifndef __LINUX_SMPLOCK_H
2 #define __LINUX_SMPLOCK_H
3
4 #ifdef __SMP__
5
6
7
8
9
10 extern __inline void lock_kernel(void)
11 {
12 unsigned long flags;
13 int proc = smp_processor_id();
14
15 save_flags(flags);
16 cli();
17
18 while(set_bit(0, (void *)&kernel_flag))
19 {
20
21
22
23 if (proc == active_kernel_processor)
24 break;
25 do
26 {
27 smp_spins++;
28
29
30
31 if (test_bit(proc, (void *)&smp_invalidate_needed))
32 if (clear_bit(proc, (void *)&smp_invalidate_needed))
33 local_invalidate();
34 }
35 while(test_bit(0, (void *)&kernel_flag));
36 }
37
38
39
40
41 active_kernel_processor = proc;
42 kernel_counter++;
43 restore_flags(flags);
44 }
45
46 extern __inline void unlock_kernel(void)
47 {
48 unsigned long flags;
49 save_flags(flags);
50 cli();
51
52
53
54
55 if (kernel_counter == 0)
56 panic("Kernel counter wrong.\n");
57
58 if(! --kernel_counter)
59 {
60 active_kernel_processor = NO_PROC_ID;
61 clear_bit(0, (void *)&kernel_flag);
62 }
63 restore_flags(flags);
64 }
65
66 #endif
67 #endif