aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm')
-rw-r--r--drivers/kvm/paging_tmpl.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 3ade9445ab23..7af49ae80e5a 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -170,6 +170,11 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
170 170
171 shadow_addr = vcpu->mmu.root_hpa; 171 shadow_addr = vcpu->mmu.root_hpa;
172 level = vcpu->mmu.shadow_root_level; 172 level = vcpu->mmu.shadow_root_level;
173 if (level == PT32E_ROOT_LEVEL) {
174 shadow_addr = vcpu->mmu.pae_root[(addr >> 30) & 3];
175 shadow_addr &= PT64_BASE_ADDR_MASK;
176 --level;
177 }
173 178
174 for (; ; level--) { 179 for (; ; level--) {
175 u32 index = SHADOW_PT_INDEX(addr, level); 180 u32 index = SHADOW_PT_INDEX(addr, level);
@@ -202,10 +207,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
202 shadow_addr = kvm_mmu_alloc_page(vcpu, shadow_ent); 207 shadow_addr = kvm_mmu_alloc_page(vcpu, shadow_ent);
203 if (!VALID_PAGE(shadow_addr)) 208 if (!VALID_PAGE(shadow_addr))
204 return ERR_PTR(-ENOMEM); 209 return ERR_PTR(-ENOMEM);
205 shadow_pte = shadow_addr | PT_PRESENT_MASK; 210 shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK
206 if (vcpu->mmu.root_level > 3 || level != 3) 211 | PT_WRITABLE_MASK | PT_USER_MASK;
207 shadow_pte |= PT_ACCESSED_MASK
208 | PT_WRITABLE_MASK | PT_USER_MASK;
209 *shadow_ent = shadow_pte; 212 *shadow_ent = shadow_pte;
210 prev_shadow_ent = shadow_ent; 213 prev_shadow_ent = shadow_ent;
211 } 214 }