diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index f75011e..77ae77f 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4629,6 +4629,7 @@ static int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap xat spin_unlock(&d->grant_table->lock); break; + case XENMAPSPACE_gmfn_range: case XENMAPSPACE_gmfn: { p2m_type_t p2mt; @@ -4700,6 +4701,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) { struct xen_add_to_physmap xatp; struct domain *d; + unsigned int size, i; if ( copy_from_guest(&xatp, arg, 1) ) return -EFAULT; @@ -4714,7 +4716,18 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) return -EPERM; } - xenmem_add_to_physmap(d, xatp); + size = 1; + if ( xatp.space == XENMAPSPACE_gmfn_range ) + { + size = xatp.size; + } + + for ( i = 0; i < size; i++ ) + { + xenmem_add_to_physmap(d, xatp); + xatp.idx++; + xatp.gpfn++; + } rcu_unlock_domain(d); diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h index 08355e3..860b8c0 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -212,6 +212,7 @@ struct xen_add_to_physmap { #define XENMAPSPACE_shared_info 0 /* shared info page */ #define XENMAPSPACE_grant_table 1 /* grant table page */ #define XENMAPSPACE_gmfn 2 /* GMFN */ +#define XENMAPSPACE_gmfn_range 3 /* GMFN range */ unsigned int space; #define XENMAPIDX_grant_table_status 0x80000000 @@ -221,6 +222,9 @@ struct xen_add_to_physmap { /* GPFN where the source mapping page should appear. */ xen_pfn_t gpfn; + + /* Number of page, used for GMFN range */ + unsigned int size; }; typedef struct xen_add_to_physmap xen_add_to_physmap_t; DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);