Skip to content

Commit

Permalink
KVM: add kvm_is_error_hva()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Izik Eidus authored and Avi Kivity committed Jan 30, 2008
1 parent 1a6f4d7 commit f9d46eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
extern struct page *bad_page;

int is_error_page(struct page *page);
int kvm_is_error_hva(unsigned long addr);
int kvm_set_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem,
int user_alloc);
Expand Down
11 changes: 11 additions & 0 deletions drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f9d46eb

Please sign in to comment.