1 #include <xen/mm.h>
2 #include <asm/shadow.h>
3
_enable_log_dirty(struct domain * d,bool log_global)4 static int _enable_log_dirty(struct domain *d, bool log_global)
5 {
6 ASSERT(is_pv_domain(d));
7 return -EOPNOTSUPP;
8 }
9
_disable_log_dirty(struct domain * d)10 static int _disable_log_dirty(struct domain *d)
11 {
12 ASSERT(is_pv_domain(d));
13 return -EOPNOTSUPP;
14 }
15
_clean_dirty_bitmap(struct domain * d)16 static void _clean_dirty_bitmap(struct domain *d)
17 {
18 ASSERT(is_pv_domain(d));
19 }
20
shadow_domain_init(struct domain * d,unsigned int domcr_flags)21 int shadow_domain_init(struct domain *d, unsigned int domcr_flags)
22 {
23 static const struct log_dirty_ops sh_none_ops = {
24 .enable = _enable_log_dirty,
25 .disable = _disable_log_dirty,
26 .clean = _clean_dirty_bitmap,
27 };
28
29 paging_log_dirty_init(d, &sh_none_ops);
30 return is_pv_domain(d) ? 0 : -EOPNOTSUPP;
31 }
32
_page_fault(struct vcpu * v,unsigned long va,struct cpu_user_regs * regs)33 static int _page_fault(struct vcpu *v, unsigned long va,
34 struct cpu_user_regs *regs)
35 {
36 ASSERT_UNREACHABLE();
37 return 0;
38 }
39
_invlpg(struct vcpu * v,unsigned long va)40 static bool _invlpg(struct vcpu *v, unsigned long va)
41 {
42 ASSERT_UNREACHABLE();
43 return true;
44 }
45
_gva_to_gfn(struct vcpu * v,struct p2m_domain * p2m,unsigned long va,uint32_t * pfec)46 static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
47 unsigned long va, uint32_t *pfec)
48 {
49 ASSERT_UNREACHABLE();
50 return gfn_x(INVALID_GFN);
51 }
52
_update_cr3(struct vcpu * v,int do_locking)53 static void _update_cr3(struct vcpu *v, int do_locking)
54 {
55 ASSERT_UNREACHABLE();
56 }
57
_update_paging_modes(struct vcpu * v)58 static void _update_paging_modes(struct vcpu *v)
59 {
60 ASSERT_UNREACHABLE();
61 }
62
_write_p2m_entry(struct domain * d,unsigned long gfn,l1_pgentry_t * p,l1_pgentry_t new,unsigned int level)63 static void _write_p2m_entry(struct domain *d, unsigned long gfn,
64 l1_pgentry_t *p, l1_pgentry_t new,
65 unsigned int level)
66 {
67 ASSERT_UNREACHABLE();
68 }
69
70 static const struct paging_mode sh_paging_none = {
71 .page_fault = _page_fault,
72 .invlpg = _invlpg,
73 .gva_to_gfn = _gva_to_gfn,
74 .update_cr3 = _update_cr3,
75 .update_paging_modes = _update_paging_modes,
76 .write_p2m_entry = _write_p2m_entry,
77 };
78
shadow_vcpu_init(struct vcpu * v)79 void shadow_vcpu_init(struct vcpu *v)
80 {
81 ASSERT(is_pv_vcpu(v));
82 v->arch.paging.mode = &sh_paging_none;
83 }
84