/root/src/xen/xen/include/xen/shared.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef __XEN_SHARED_H__ |
2 | | #define __XEN_SHARED_H__ |
3 | | |
4 | | #ifdef CONFIG_COMPAT |
5 | | |
6 | | #include <compat/xen.h> |
7 | | |
8 | | typedef union { |
9 | | struct shared_info native; |
10 | | struct compat_shared_info compat; |
11 | | } shared_info_t; |
12 | | |
13 | | /* |
14 | | * Compat field is never larger than native field, so cast to that as it |
15 | | * is the largest memory range it is safe for the caller to modify without |
16 | | * further discrimination between compat and native cases. |
17 | | */ |
18 | | #define __shared_info(d, s, field) \ |
19 | 24 | (*(!has_32bit_shinfo(d) ? \ |
20 | 24 | (typeof(&(s)->compat.field))&(s)->native.field : \ |
21 | 0 | &(s)->compat.field)) |
22 | | |
23 | | typedef union { |
24 | | struct vcpu_info native; |
25 | | struct compat_vcpu_info compat; |
26 | | } vcpu_info_t; |
27 | | |
28 | | /* As above, cast to compat field type. */ |
29 | | #define __vcpu_info(v, i, field) \ |
30 | 9.96M | (*(!has_32bit_shinfo((v)->domain) ? \ |
31 | 10.0M | (typeof(&(i)->compat.field))&(i)->native.field : \ |
32 | 18.4E | &(i)->compat.field)) |
33 | | |
34 | | #else |
35 | | |
36 | | typedef struct shared_info shared_info_t; |
37 | | #define __shared_info(d, s, field) ((s)->field) |
38 | | |
39 | | typedef struct vcpu_info vcpu_info_t; |
40 | | #define __vcpu_info(v, i, field) ((i)->field) |
41 | | |
42 | | #endif |
43 | | |
44 | | extern vcpu_info_t dummy_vcpu_info; |
45 | | |
46 | 24 | #define shared_info(d, field) __shared_info(d, (d)->shared_info, field) |
47 | 9.96M | #define vcpu_info(v, field) __vcpu_info(v, (v)->vcpu_info, field) |
48 | | |
49 | | #endif /* __XEN_SHARED_H__ */ |