privcmd.c (f929eb1ed50f079f1638cdabe511ac2e347f541a) | privcmd.c (5489d7e93a06fbb5d06d6d7e43a4c56f1571c891) |
---|---|
1/* 2 * Copyright (c) 2014 Roger Pau Monné <roger.pau@citrix.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 301 unchanged lines hidden (view full) --- 310 } else { 311 error = xen_translate_error(error); 312 hcall->retval = 0; 313 } 314 break; 315 } 316 case IOCTL_PRIVCMD_MMAPBATCH: { 317 struct ioctl_privcmd_mmapbatch *mmap; | 1/* 2 * Copyright (c) 2014 Roger Pau Monné <roger.pau@citrix.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 301 unchanged lines hidden (view full) --- 310 } else { 311 error = xen_translate_error(error); 312 hcall->retval = 0; 313 } 314 break; 315 } 316 case IOCTL_PRIVCMD_MMAPBATCH: { 317 struct ioctl_privcmd_mmapbatch *mmap; |
318 struct xen_add_to_physmap_range add; | 318 struct xen_add_to_physmap_batch add; |
319 xen_ulong_t *idxs; 320 xen_pfn_t *gpfns; 321 int *errs; 322 unsigned int index; 323 struct privcmd_map *umap; 324 uint16_t num; 325 326 mmap = (struct ioctl_privcmd_mmapbatch *)arg; --- 6 unchanged lines hidden (view full) --- 333 umap = setup_virtual_area(td, mmap->addr, mmap->num); 334 if (umap == NULL) { 335 error = EINVAL; 336 break; 337 } 338 339 add.domid = DOMID_SELF; 340 add.space = XENMAPSPACE_gmfn_foreign; | 319 xen_ulong_t *idxs; 320 xen_pfn_t *gpfns; 321 int *errs; 322 unsigned int index; 323 struct privcmd_map *umap; 324 uint16_t num; 325 326 mmap = (struct ioctl_privcmd_mmapbatch *)arg; --- 6 unchanged lines hidden (view full) --- 333 umap = setup_virtual_area(td, mmap->addr, mmap->num); 334 if (umap == NULL) { 335 error = EINVAL; 336 break; 337 } 338 339 add.domid = DOMID_SELF; 340 add.space = XENMAPSPACE_gmfn_foreign; |
341 add.foreign_domid = mmap->dom; | 341 add.u.foreign_domid = mmap->dom; |
342 343 /* 344 * The 'size' field in the xen_add_to_physmap_range only 345 * allows for UINT16_MAX mappings in a single hypercall. 346 */ 347 num = MIN(mmap->num, UINT16_MAX); 348 349 idxs = malloc(sizeof(*idxs) * num, M_PRIVCMD, M_WAITOK); --- 15 unchanged lines hidden (view full) --- 365 366 for (i = 0; i < num; i++) 367 gpfns[i] = atop(umap->phys_base_addr + 368 (i + index) * PAGE_SIZE); 369 370 bzero(errs, sizeof(*errs) * num); 371 372 error = HYPERVISOR_memory_op( | 342 343 /* 344 * The 'size' field in the xen_add_to_physmap_range only 345 * allows for UINT16_MAX mappings in a single hypercall. 346 */ 347 num = MIN(mmap->num, UINT16_MAX); 348 349 idxs = malloc(sizeof(*idxs) * num, M_PRIVCMD, M_WAITOK); --- 15 unchanged lines hidden (view full) --- 365 366 for (i = 0; i < num; i++) 367 gpfns[i] = atop(umap->phys_base_addr + 368 (i + index) * PAGE_SIZE); 369 370 bzero(errs, sizeof(*errs) * num); 371 372 error = HYPERVISOR_memory_op( |
373 XENMEM_add_to_physmap_range, &add); | 373 XENMEM_add_to_physmap_batch, &add); |
374 if (error != 0) { 375 error = xen_translate_error(error); 376 goto mmap_out; 377 } 378 379 for (i = 0; i < num; i++) { 380 if (errs[i] != 0) { 381 errs[i] = xen_translate_error(errs[i]); --- 230 unchanged lines hidden --- | 374 if (error != 0) { 375 error = xen_translate_error(error); 376 goto mmap_out; 377 } 378 379 for (i = 0; i < num; i++) { 380 if (errs[i] != 0) { 381 errs[i] = xen_translate_error(errs[i]); --- 230 unchanged lines hidden --- |