ia64/xen-unstable

view xen/include/asm-x86/shared.h @ 15812:86a154e1ef5d

[HVM] Shadow: don't shadow the p2m table.
For HVM vcpus with paging disabled, we used to shadow the p2m table,
and skip the p2m lookup to go from gfn to mfn. Instead, we now
provide a simple pagetable that gives a one-to-one mapping of 4GB, and
shadow that, making the translations from gfn to mfn via the p2m.
This removes the paging-disabled special-case code from the shadow
fault handler, and allows us to expand the p2m interface, since all HVM
translations now go through the same p2m lookups.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Aug 31 11:06:22 2007 +0100 (2007-08-31)
parents 405573aedd24
children af33f2054f47
line source
1 #ifndef __XEN_X86_SHARED_H__
2 #define __XEN_X86_SHARED_H__
4 #ifdef CONFIG_COMPAT
6 #define nmi_reason(d) (!has_32bit_shinfo(d) ? \
7 (void *)&(d)->shared_info->native.arch.nmi_reason : \
8 (void *)&(d)->shared_info->compat.arch.nmi_reason)
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 }
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 }
42 #else
44 #define nmi_reason(d) ((void *)&(d)->shared_info->arch.nmi_reason)
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 }
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
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)
73 GET_SET_VCPU(unsigned long, cr2)
75 #undef GET_SET_VCPU
76 #undef GET_SET_SHARED
78 #endif /* __XEN_X86_SHARED_H__ */