csu: restore crt1.o symlink
[minix.git] / kernel / spinlock.h
blob7cfee2d9efee7d0a226db4887e3149a5c6ad6581
1 #ifndef __SPINLOCK_H__
2 #define __SPINLOCK_H__
4 #include "kernel/kernel.h"
6 typedef struct spinlock {
7 atomic_t val;
8 } spinlock_t;
10 #ifndef CONFIG_SMP
12 #define SPINLOCK_DEFINE(name)
13 #define PRIVATE_SPINLOCK_DEFINE(name)
14 #define SPINLOCK_DECLARE(name)
15 #define spinlock_init(sl)
16 #define spinlock_lock(sl)
17 #define spinlock_unlock(sl)
19 #else
21 /* SMP */
22 #define SPINLOCK_DEFINE(name) spinlock_t name;
23 #define PRIVATE_SPINLOCK_DEFINE(name) PRIVATE SPINLOCK_DEFINE(name)
24 #define SPINLOCK_DECLARE(name) extern SPINLOCK_DEFINE(name)
25 #define spinlock_init(sl) do { (sl)->val = 0; } while (0)
27 #if CONFIG_MAX_CPUS == 1
28 #define spinlock_lock(sl)
29 #define spinlock_unlock(sl)
30 #else
31 void arch_spinlock_lock(atomic_t * sl);
32 void arch_spinlock_unlock(atomic_t * sl);
33 #define spinlock_lock(sl) arch_spinlock_lock((atomic_t*) sl)
34 #define spinlock_unlock(sl) arch_spinlock_unlock((atomic_t*) sl)
35 #endif
38 #endif /* CONFIG_SMP */
40 #define BKL_LOCK() spinlock_lock(&big_kernel_lock)
41 #define BKL_UNLOCK() spinlock_unlock(&big_kernel_lock)
43 #endif /* __SPINLOCK_H__ */