diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2007-12-06 13:56:00 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2007-12-06 13:56:00 +0000 |
commit | cdac12a18cde570b9ea12bf911cee2d4659d663d (patch) | |
tree | 332501b4707f248c3d345a7964203faaaa8325e8 | |
parent | 5cc77f9098763fc830db0a2b2aa53d8254305084 (diff) | |
download | xen-cdac12a18cde570b9ea12bf911cee2d4659d663d.tar.gz xen-cdac12a18cde570b9ea12bf911cee2d4659d663d.tar.bz2 xen-cdac12a18cde570b9ea12bf911cee2d4659d663d.zip |
32-on-64: Fixes to previous changeset.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r-- | xen/common/grant_table.c | 14 | ||||
-rw-r--r-- | xen/common/memory.c | 2 | ||||
-rw-r--r-- | xen/common/page_alloc.c | 2 | ||||
-rw-r--r-- | xen/include/public/grant_table.h | 6 |
4 files changed, 15 insertions, 9 deletions
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 9ba4ed11ad..7aaad6417c 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -1031,6 +1031,7 @@ gnttab_transfer( grant_entry_t *sha; struct gnttab_transfer gop; unsigned long mfn; + unsigned int max_bitsize; for ( i = 0; i < count; i++ ) { @@ -1081,24 +1082,27 @@ gnttab_transfer( if ( xsm_grant_transfer(d, e) ) { + gop.status = GNTST_permission_denied; unlock_and_copyback: rcu_unlock_domain(e); page->count_info &= ~(PGC_count_mask|PGC_allocated); free_domheap_page(page); - gop.status = GNTST_permission_denied; goto copyback; } - if ( (1UL << domain_clamp_alloc_bitsize(e, BITS_PER_LONG-1)) <= mfn ) + max_bitsize = domain_clamp_alloc_bitsize( + e, BITS_PER_LONG+PAGE_SHIFT-1); + if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn ) { struct page_info *new_page; void *sp, *dp; - new_page = alloc_domheap_pages( - NULL, 0, - MEMF_bits(domain_clamp_alloc_bitsize(e, BITS_PER_LONG-1))); + new_page = alloc_domheap_pages(NULL, 0, MEMF_bits(max_bitsize)); if ( new_page == NULL ) + { + gop.status = GNTST_address_too_big; goto unlock_and_copyback; + } sp = map_domain_page(mfn); dp = map_domain_page(page_to_mfn(new_page)); diff --git a/xen/common/memory.c b/xen/common/memory.c index 90ff8a9827..849e2c1cd8 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -342,7 +342,7 @@ static long memory_exchange(XEN_GUEST_HANDLE(xen_memory_exchange_t) arg) d = current->domain; memflags |= MEMF_bits(domain_clamp_alloc_bitsize( - d, exch.out.address_bits ? : BITS_PER_LONG)); + d, exch.out.address_bits ? : (BITS_PER_LONG+PAGE_SHIFT))); cpu = select_local_cpu(d); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 9de3f31ebe..95c474bca6 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -786,7 +786,7 @@ struct page_info *__alloc_domheap_pages( ASSERT(!in_irq()); - bits = domain_clamp_alloc_bitsize(d, bits ? : BITS_PER_LONG); + bits = domain_clamp_alloc_bitsize(d, bits ? : (BITS_PER_LONG+PAGE_SHIFT)); if ( bits <= (PAGE_SHIFT + 1) ) return NULL; diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h index ba3467a97e..26f2c35b18 100644 --- a/xen/include/public/grant_table.h +++ b/xen/include/public/grant_table.h @@ -400,7 +400,8 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and_replace_t); #define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */ #define GNTST_permission_denied (-8) /* Not enough privilege for operation. */ #define GNTST_bad_page (-9) /* Specified page was invalid for op. */ -#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */ +#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */ +#define GNTST_address_too_big (-11) /* transfer page address too large. */ #define GNTTABOP_error_msgs { \ "okay", \ @@ -413,7 +414,8 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and_replace_t); "no spare translation slot in the I/O MMU", \ "permission denied", \ "bad page", \ - "copy arguments cross page boundary" \ + "copy arguments cross page boundary", \ + "page address size too large" \ } #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */ |