diff options
author | Avi Kivity <avi@qumranet.com> | 2007-05-30 12:31:17 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-07-16 05:05:43 -0400 |
commit | e60d75ea292071e7ab33c10ca73fdd33fcbbe501 (patch) | |
tree | 85ca6a1b9f0dca02ec166acca4627127312ecf8e /drivers/kvm/mmu.c | |
parent | ef0197e8d9273ad8fbfb1bbd30e46e42a32c79e8 (diff) |
KVM: MMU: Move set_pte_common() to pte width dependent code
In preparation of some modifications.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r-- | drivers/kvm/mmu.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 46491b4cd859..a7631502f22b 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -965,54 +965,6 @@ static void paging_new_cr3(struct kvm_vcpu *vcpu) | |||
965 | kvm_arch_ops->set_cr3(vcpu, vcpu->mmu.root_hpa); | 965 | kvm_arch_ops->set_cr3(vcpu, vcpu->mmu.root_hpa); |
966 | } | 966 | } |
967 | 967 | ||
968 | static inline void set_pte_common(struct kvm_vcpu *vcpu, | ||
969 | u64 *shadow_pte, | ||
970 | gpa_t gaddr, | ||
971 | int dirty, | ||
972 | u64 access_bits, | ||
973 | gfn_t gfn) | ||
974 | { | ||
975 | hpa_t paddr; | ||
976 | |||
977 | *shadow_pte |= access_bits << PT_SHADOW_BITS_OFFSET; | ||
978 | if (!dirty) | ||
979 | access_bits &= ~PT_WRITABLE_MASK; | ||
980 | |||
981 | paddr = gpa_to_hpa(vcpu, gaddr & PT64_BASE_ADDR_MASK); | ||
982 | |||
983 | *shadow_pte |= access_bits; | ||
984 | |||
985 | if (is_error_hpa(paddr)) { | ||
986 | *shadow_pte |= gaddr; | ||
987 | *shadow_pte |= PT_SHADOW_IO_MARK; | ||
988 | *shadow_pte &= ~PT_PRESENT_MASK; | ||
989 | return; | ||
990 | } | ||
991 | |||
992 | *shadow_pte |= paddr; | ||
993 | |||
994 | if (access_bits & PT_WRITABLE_MASK) { | ||
995 | struct kvm_mmu_page *shadow; | ||
996 | |||
997 | shadow = kvm_mmu_lookup_page(vcpu, gfn); | ||
998 | if (shadow) { | ||
999 | pgprintk("%s: found shadow page for %lx, marking ro\n", | ||
1000 | __FUNCTION__, gfn); | ||
1001 | access_bits &= ~PT_WRITABLE_MASK; | ||
1002 | if (is_writeble_pte(*shadow_pte)) { | ||
1003 | *shadow_pte &= ~PT_WRITABLE_MASK; | ||
1004 | kvm_arch_ops->tlb_flush(vcpu); | ||
1005 | } | ||
1006 | } | ||
1007 | } | ||
1008 | |||
1009 | if (access_bits & PT_WRITABLE_MASK) | ||
1010 | mark_page_dirty(vcpu->kvm, gaddr >> PAGE_SHIFT); | ||
1011 | |||
1012 | page_header_update_slot(vcpu->kvm, shadow_pte, gaddr); | ||
1013 | rmap_add(vcpu, shadow_pte); | ||
1014 | } | ||
1015 | |||
1016 | static void inject_page_fault(struct kvm_vcpu *vcpu, | 968 | static void inject_page_fault(struct kvm_vcpu *vcpu, |
1017 | u64 addr, | 969 | u64 addr, |
1018 | u32 err_code) | 970 | u32 err_code) |