~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to xen/include/asm-x86/shared.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __XEN_X86_SHARED_H__
 
2
#define __XEN_X86_SHARED_H__
 
3
 
 
4
#ifdef CONFIG_COMPAT
 
5
 
 
6
#define nmi_reason(d) (!has_32bit_shinfo(d) ?                             \
 
7
                       (u32 *)&(d)->shared_info->native.arch.nmi_reason : \
 
8
                       (u32 *)&(d)->shared_info->compat.arch.nmi_reason)
 
9
 
 
10
#define GET_SET_SHARED(type, field)                             \
 
11
static inline type arch_get_##field(const struct domain *d)     \
 
12
{                                                               \
 
13
    return !has_32bit_shinfo(d) ?                               \
 
14
           d->shared_info->native.arch.field :                  \
 
15
           d->shared_info->compat.arch.field;                   \
 
16
}                                                               \
 
17
static inline void arch_set_##field(struct domain *d,           \
 
18
                                    type val)                   \
 
19
{                                                               \
 
20
    if ( !has_32bit_shinfo(d) )                                 \
 
21
        d->shared_info->native.arch.field = val;                \
 
22
    else                                                        \
 
23
        d->shared_info->compat.arch.field = val;                \
 
24
}
 
25
 
 
26
#define GET_SET_VCPU(type, field)                               \
 
27
static inline type arch_get_##field(const struct vcpu *v)       \
 
28
{                                                               \
 
29
    return !has_32bit_shinfo(v->domain) ?                       \
 
30
           v->vcpu_info->native.arch.field :                    \
 
31
           v->vcpu_info->compat.arch.field;                     \
 
32
}                                                               \
 
33
static inline void arch_set_##field(struct vcpu *v,             \
 
34
                                    type val)                   \
 
35
{                                                               \
 
36
    if ( !has_32bit_shinfo(v->domain) )                         \
 
37
        v->vcpu_info->native.arch.field = val;                  \
 
38
    else                                                        \
 
39
        v->vcpu_info->compat.arch.field = val;                  \
 
40
}
 
41
 
 
42
#else
 
43
 
 
44
#define nmi_reason(d) ((u32 *)&(d)->shared_info->arch.nmi_reason)
 
45
 
 
46
#define GET_SET_SHARED(type, field)                             \
 
47
static inline type arch_get_##field(const struct domain *d)     \
 
48
{                                                               \
 
49
    return d->shared_info->arch.field;                          \
 
50
}                                                               \
 
51
static inline void arch_set_##field(struct domain *d,           \
 
52
                                    type val)                   \
 
53
{                                                               \
 
54
    d->shared_info->arch.field = val;                           \
 
55
}
 
56
 
 
57
#define GET_SET_VCPU(type, field)                               \
 
58
static inline type arch_get_##field(const struct vcpu *v)       \
 
59
{                                                               \
 
60
    return v->vcpu_info->arch.field;                            \
 
61
}                                                               \
 
62
static inline void arch_set_##field(struct vcpu *v,             \
 
63
                                    type val)                   \
 
64
{                                                               \
 
65
    v->vcpu_info->arch.field = val;                             \
 
66
}
 
67
#endif
 
68
 
 
69
GET_SET_SHARED(unsigned long, max_pfn)
 
70
GET_SET_SHARED(xen_pfn_t, pfn_to_mfn_frame_list_list)
 
71
GET_SET_SHARED(unsigned long, nmi_reason)
 
72
 
 
73
GET_SET_VCPU(unsigned long, cr2)
 
74
 
 
75
#undef GET_SET_VCPU
 
76
#undef GET_SET_SHARED
 
77
 
 
78
#endif /* __XEN_X86_SHARED_H__ */