return ring_ref;
out_unmap_left:
if (pages_left)
- xc_gntshr_munmap(ctrl->gntshr, ctrl->read.buffer, pages_left * PAGE_SIZE);
+ xc_gntshr_munmap(ctrl->gntshr, ctrl->read.buffer, pages_left);
out_ring:
- xc_gntshr_munmap(ctrl->gntshr, ring, PAGE_SIZE);
+ xc_gntshr_munmap(ctrl->gntshr, ring, 1);
ring_ref = -1;
ctrl->ring = NULL;
ctrl->write.order = ctrl->read.order = 0;
out_unmap_left:
if (ctrl->write.order >= PAGE_SHIFT)
xc_gnttab_munmap(ctrl->gnttab, ctrl->write.buffer,
- 1 << ctrl->write.order);
+ 1 << (ctrl->write.order - PAGE_SHIFT));
out_unmap_ring:
- xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, PAGE_SIZE);
+ xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, 1);
ctrl->ring = 0;
ctrl->write.order = ctrl->read.order = 0;
rv = -1;
if (ctrl->ring) {
if (ctrl->is_server) {
ctrl->ring->srv_live = 0;
- xc_gntshr_munmap(ctrl->gntshr, ctrl->ring, PAGE_SIZE);
+ xc_gntshr_munmap(ctrl->gntshr, ctrl->ring, 1);
} else {
ctrl->ring->cli_live = 0;
- xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, PAGE_SIZE);
+ xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, 1);
}
}
if (ctrl->event) {
static int linux_gntshr_munmap(xc_gntshr *xcg, xc_osdep_handle h,
void *start_address, uint32_t count)
{
- return munmap(start_address, count);
+ return munmap(start_address, count * XC_PAGE_SIZE);
}
static struct xc_osdep_ops linux_gntshr_ops = {