errno = saved_errno;
}
+void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
+{
+ int ret;
+ void *ptr;
+
+ ret = posix_memalign(&ptr, alignment, size);
+ if (ret != 0 || !ptr)
+ return NULL;
+
+ return ptr;
+}
+
/*
* Local variables:
* mode: C
{
size_t size = npages * XC_PAGE_SIZE;
void *p;
- int ret;
- ret = posix_memalign(&p, XC_PAGE_SIZE, size);
- if (ret != 0 || !p)
+ p = xc_memalign(xch, XC_PAGE_SIZE, size);
+ if (!p)
return NULL;
if ( mlock(p, size) < 0 )
static void *minios_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, int npages)
{
- return memalign(PAGE_SIZE, npages * PAGE_SIZE);
+ return xc_memalign(xch, PAGE_SIZE, npages * PAGE_SIZE);
}
static void minios_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages)
fsync(fd);
}
+void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
+{
+ return memalign(alignment, size);
+}
+
static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
{
int fd = alloc_fd(FTYPE_GNTMAP);
static void *netbsd_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, int npages)
{
size_t size = npages * XC_PAGE_SIZE;
- void *p = valloc(size);
+ void *p;
+ p = xc_memalign(xch, XC_PAGE_SIZE, size);
if (!p)
return NULL;
errno = saved_errno;
}
+void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
+{
+ return valloc(size);
+}
+
static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type)
{
switch ( type )
static void *solaris_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, int npages)
{
- return memalign(XC_PAGE_SIZE, npages * XC_PAGE_SIZE);
+ return xc_memalign(xch, XC_PAGE_SIZE, npages * XC_PAGE_SIZE);
}
static void solaris_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages)
// TODO: Implement for Solaris!
}
+void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
+{
+ return memalign(alignment, size);
+}
+
static struct xc_osdep_ops *solaris_osdep_init(xc_interface *xch, enum xc_osdep_type type)
{
switch ( type )
uint64_t *time,
xc_hypercall_buffer_t *data);
+void *xc_memalign(xc_interface *xch, size_t alignment, size_t size);
+
/**
* Memory maps a range within one domain to a local address range. Mappings
* should be unmapped with munmap and should follow the same rules as mmap