diff options
author | Izik Eidus <izike@qumranet.com> | 2007-11-11 22:02:22 +0200 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 17:53:01 +0200 |
commit | f9d46eb0e4a5b5e0926ca61c19f8c8bbb9496b28 (patch) | |
tree | 891e954d8c650641792e415ec6962d81dead116d /drivers/kvm/kvm_main.c | |
parent | 1a6f4d7fbd11e539630cd5637311a4e55fae60ef (diff) | |
download | lwn-f9d46eb0e4a5b5e0926ca61c19f8c8bbb9496b28.tar.gz lwn-f9d46eb0e4a5b5e0926ca61c19f8c8bbb9496b28.zip |
KVM: add kvm_is_error_hva()
Check for the "error hva", an address outside the user address space that
signals a bad gfn.
Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index d395c987894e..dfb65e2f87ee 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -498,6 +498,17 @@ int is_error_page(struct page *page) } EXPORT_SYMBOL_GPL(is_error_page); +static inline unsigned long bad_hva(void) +{ + return PAGE_OFFSET; +} + +int kvm_is_error_hva(unsigned long addr) +{ + return addr == bad_hva(); +} +EXPORT_SYMBOL_GPL(kvm_is_error_hva); + gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) { int i; |