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