kernel - Factor out TSC cputimer into common x86_64 code, use for vkernel.
[dragonfly.git] / sys / sys / mplock2.h
blob414213abad78d31f58873afa71416810adfdd288
1 /*
2 * SYS/MPLOCK2.H
4 * Implement the MP lock. Note that debug operations
5 */
6 #ifndef _SYS_MPLOCK2_H_
7 #define _SYS_MPLOCK2_H_
9 #include <machine/atomic.h>
10 #ifndef _SYS_THREAD_H_
11 #include <sys/thread.h>
12 #endif
13 #ifndef _SYS_GLOBALDATA_H_
14 #include <sys/globaldata.h>
15 #endif
18 * NOTE: try_mplock()/lwkt_trytoken() return non-zero on success.
20 #define get_mplock() lwkt_gettoken(&mp_token)
21 #define try_mplock() lwkt_trytoken(&mp_token)
22 #define rel_mplock() lwkt_reltoken(&mp_token)
23 #define get_mplock_count(td) lwkt_cnttoken(&mp_token, td)
25 void cpu_get_initial_mplock(void);
27 #define MP_LOCK_HELD() LWKT_TOKEN_HELD_EXCL(&mp_token)
28 #define ASSERT_MP_LOCK_HELD() ASSERT_LWKT_TOKEN_HELD_EXCL(&mp_token)
30 #endif