vkernel - Unbreak 32-bit vkernel builds by fixing broken assertion
[dragonfly.git] / sys / sys / mplock2.h
CommitLineData
684a93c4
MD
1/*
2 * SYS/MPLOCK2.H
3 *
4 * Implement the MP lock. Note that debug operations
5 */
6#ifndef _SYS_MPLOCK2_H_
7#define _SYS_MPLOCK2_H_
8
684a93c4 9#include <machine/atomic.h>
684a93c4
MD
10#ifndef _SYS_THREAD_H_
11#include <sys/thread.h>
12#endif
13#ifndef _SYS_GLOBALDATA_H_
14#include <sys/globaldata.h>
15#endif
16
17#ifdef SMP
18
b5d16701
MD
19/*
20 * NOTE: try_mplock()/lwkt_trytoken() return non-zero on success.
21 */
22#define get_mplock() lwkt_gettoken(&mp_token)
23#define try_mplock() lwkt_trytoken(&mp_token)
24#define rel_mplock() lwkt_reltoken(&mp_token)
25#define get_mplock_count(td) lwkt_cnttoken(&mp_token, td)
684a93c4 26
684a93c4 27void cpu_get_initial_mplock(void);
684a93c4 28
01672f8c
MD
29#define MP_LOCK_HELD() LWKT_TOKEN_HELD_EXCL(&mp_token)
30#define ASSERT_MP_LOCK_HELD() ASSERT_LWKT_TOKEN_HELD_EXCL(&mp_token)
c5724852 31
684a93c4
MD
32#else
33
34/*
35 * UNI-PROCESSOR BUILD - Degenerate case macros
36 */
37#define get_mplock()
38#define rel_mplock()
39#define try_mplock() 1
40#define owner_mplock() 0
b5d16701 41#define MP_LOCK_HELD(gd) 1
684a93c4
MD
42#define ASSERT_MP_LOCK_HELD(td)
43
44#endif
45
46#endif