blob: bef83135a1b8c1d2d0b71ddd231f9136bbbf6514 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/******************************************************************************
* preempt.h
*
* Track atomic regions in the hypervisor which disallow sleeping.
*
* Copyright (c) 2010, Keir Fraser <keir@xen.org>
*/
#ifndef __XEN_PREEMPT_H__
#define __XEN_PREEMPT_H__
#include <xen/types.h>
#include <xen/percpu.h>
DECLARE_PER_CPU(unsigned int, __preempt_count);
#define preempt_count() (this_cpu(__preempt_count))
#define preempt_disable() do { \
preempt_count()++; \
barrier(); \
} while (0)
#define preempt_enable() do { \
barrier(); \
preempt_count()--; \
} while (0)
bool_t in_atomic(void);
#ifndef NDEBUG
void ASSERT_NOT_IN_ATOMIC(void);
#else
#define ASSERT_NOT_IN_ATOMIC() ((void)0)
#endif
#endif /* __XEN_PREEMPT_H__ */
|