From 099fb113f2b51117197cc96de99d0594c5870cd4 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 23 Sep 2008 13:18:32 -0300 Subject: [PATCH] --- yaml --- r: 115335 b: refs/heads/master c: 38187c830cab84daecb41169948467f1f19317e3 h: refs/heads/master i: 115333: e6ab22e58eec8063f4b3a10bf6786fd77569eee4 115331: 2f7f24ff1453edbc406210bbc3efc3cdac76547d 115327: 110aaa7f468de619bdaaa570f7a3609726a2b143 v: v3 --- [refs] | 2 +- trunk/arch/x86/kvm/mmu.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index e3b72e0b44ce..52d7b9175229 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a378b4e64c0fef2d9e53214db167878b7673a7a3 +refs/heads/master: 38187c830cab84daecb41169948467f1f19317e3 diff --git a/trunk/arch/x86/kvm/mmu.c b/trunk/arch/x86/kvm/mmu.c index 23752ef0839c..731e6fe9cb07 100644 --- a/trunk/arch/x86/kvm/mmu.c +++ b/trunk/arch/x86/kvm/mmu.c @@ -1180,11 +1180,16 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, || (write_fault && !is_write_protection(vcpu) && !user_fault)) { struct kvm_mmu_page *shadow; + if (largepage && has_wrprotected_page(vcpu->kvm, gfn)) { + ret = 1; + spte = shadow_trap_nonpresent_pte; + goto set_pte; + } + spte |= PT_WRITABLE_MASK; shadow = kvm_mmu_lookup_page(vcpu->kvm, gfn); - if (shadow || - (largepage && has_wrprotected_page(vcpu->kvm, gfn))) { + if (shadow) { pgprintk("%s: found shadow page for %lx, marking ro\n", __func__, gfn); ret = 1; @@ -1197,6 +1202,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, if (pte_access & ACC_WRITE_MASK) mark_page_dirty(vcpu->kvm, gfn); +set_pte: set_shadow_pte(shadow_pte, spte); return ret; }