This source file includes following definitions.
- lock_kernel
- unlock_kernel
1 #ifndef __I386_SMPLOCK_H
2 #define __I386_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 #ifdef __SMP_PROF__
28 smp_spins[smp_processor_id()]++;
29 #endif
30
31
32
33 if (test_bit(proc, (void *)&smp_invalidate_needed))
34 if (clear_bit(proc, (void *)&smp_invalidate_needed))
35 local_flush_tlb();
36 }
37 while(test_bit(0, (void *)&kernel_flag));
38 }
39
40
41
42
43 active_kernel_processor = proc;
44 kernel_counter++;
45 restore_flags(flags);
46 }
47
48 extern __inline void unlock_kernel(void)
49 {
50 unsigned long flags;
51 save_flags(flags);
52 cli();
53
54
55
56
57 if (kernel_counter == 0)
58 panic("Kernel counter wrong.\n");
59
60 if(! --kernel_counter)
61 {
62 active_kernel_processor = NO_PROC_ID;
63 clear_bit(0, (void *)&kernel_flag);
64 }
65 restore_flags(flags);
66 }
67
68 #endif
69 #endif