[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] libs/foreignmemory: Implement on NetBSD
On 26/01/2021 22:47, Manuel Bouyer wrote: > diff --git a/tools/libs/foreignmemory/netbsd.c > b/tools/libs/foreignmemory/netbsd.c > index 54a418ebd6..a7e1d72ffc 100644 > --- a/tools/libs/foreignmemory/netbsd.c > +++ b/tools/libs/foreignmemory/netbsd.c > @@ -97,7 +102,48 @@ void *osdep_map_foreign_batch(xenforeignmem_handle *fmem, > uint32_t dom, > int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, > void *addr, size_t num) > { > - return munmap(addr, num*XC_PAGE_SIZE); > + return munmap(addr, num*PAGE_SIZE); > +} > + > +int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem, > + domid_t domid) > +{ > + errno = EOPNOTSUPP; > + return -1; > +} > + > +int osdep_xenforeignmemory_unmap_resource( > + xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres) > +{ > + return fres ? munmap(fres->addr, fres->nr_frames << PAGE_SHIFT) : 0; > +} > + > +int osdep_xenforeignmemory_map_resource( > + xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres) > +{ > + privcmd_mmap_resource_t mr = { > + .dom = fres->domid, > + .type = fres->type, > + .id = fres->id, > + .idx = fres->frame, > + .num = fres->nr_frames, > + }; > + int rc; > + > + fres->addr = mmap(fres->addr, fres->nr_frames << PAGE_SHIFT, > + fres->prot, fres->flags | MAP_ANON | MAP_SHARED, -1, > 0); > + if ( fres->addr == MAP_FAILED ) > + return -1; > + > + mr.addr = (uintptr_t)fres->addr; > + > + rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr); > + if ( rc ) > + { > + PERROR("ioctl failed"); return -1; I was rebasing my resource_size fix over this patch. It would be easiest for me if I fix up and commit this patch, if everyone is happy with that. ~Andrew
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |