This source file includes following definitions.
- lock_kernel
- unlock_kernel
1
2
3
4
5
6 #ifndef __SPARC_SMPLOCK_H
7 #define __SPARC_SMPLOCK_H
8
9 #include <asm/smp.h>
10 #include <asm/bitops.h>
11 #include <asm/atops.h>
12 #include <asm/pgtable.h>
13
14 #ifdef __SMP__
15
16
17
18
19
20
21 extern __inline void lock_kernel(void)
22 {
23 unsigned long flags;
24 int proc = smp_processor_id();
25
26 save_flags(flags); cli();
27 while(ldstub(&kernel_flag)) {
28 if(proc == active_kernel_processor)
29 break;
30 do {
31 #ifdef __SMP_PROF__
32 smp_spins[smp_processor_id()]++;
33 #endif
34 barrier();
35 } while(kernel_flag);
36 }
37 active_kernel_processor = proc;
38 kernel_counter++;
39 restore_flags(flags);
40 }
41
42
43 extern __inline void unlock_kernel(void)
44 {
45 unsigned long flags;
46
47 save_flags(flags); cli();
48 if(kernel_counter == 0)
49 panic("Bogus kernel counter.\n");
50
51 if(!--kernel_counter) {
52 active_kernel_processor = NO_PROC_ID;
53 kernel_flag = KLOCK_CLEAR;
54 }
55 restore_flags(flags);
56 }
57
58 #endif
59
60 #endif