diff options
author | Avi Kivity <avi@qumranet.com> | 2007-11-21 07:44:45 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:11 -0500 |
commit | 1755fbcc6666906cada43c1c839ca1fc6616d4a6 (patch) | |
tree | 2f878da8de7c7e9043337d7ee028116b0c397829 /drivers/kvm/kvm.h | |
parent | 38c335f1f57bd9edc3cd894e8f5f3fc133320ad3 (diff) |
KVM: MMU: Introduce gfn_to_gpa()
Converting a frame number to an address is tricky since the data type changes
size. Introduce a function to do it. This fixes an actual bug when
accessing guest ptes.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm.h')
-rw-r--r-- | drivers/kvm/kvm.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 048849d97b35..eda82cded88e 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -499,6 +499,10 @@ static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot) | |||
499 | return slot - kvm->memslots; | 499 | return slot - kvm->memslots; |
500 | } | 500 | } |
501 | 501 | ||
502 | static inline gpa_t gfn_to_gpa(gfn_t gfn) | ||
503 | { | ||
504 | return (gpa_t)gfn << PAGE_SHIFT; | ||
505 | } | ||
502 | 506 | ||
503 | enum kvm_stat_kind { | 507 | enum kvm_stat_kind { |
504 | KVM_STAT_VM, | 508 | KVM_STAT_VM, |