diff options
author | Alex Williamson <alex.williamson@hp.com> | 2008-02-14 09:34:27 -0700 |
---|---|---|
committer | Alex Williamson <alex.williamson@hp.com> | 2008-02-14 09:34:27 -0700 |
commit | e38c4f55fe6ef6c393388ae181630ab3a92f77dd (patch) | |
tree | 24970faea32f21f96b9048f8a36c8e8d9dafe2b2 /tools/ioemu/osdep.c | |
parent | 03c9b741df33f676c99c7885ca7f795190df37d5 (diff) | |
parent | df5b25e9af9248d8e00d0ef7e4ce3eec9eb44f97 (diff) | |
download | xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.tar.gz xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.tar.bz2 xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.zip |
merge with xen-unstable.hg
Diffstat (limited to 'tools/ioemu/osdep.c')
-rw-r--r-- | tools/ioemu/osdep.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/ioemu/osdep.c b/tools/ioemu/osdep.c index d1eff8deb5..5ec16b47da 100644 --- a/tools/ioemu/osdep.c +++ b/tools/ioemu/osdep.c @@ -61,6 +61,10 @@ void *qemu_malloc(size_t size) } #if defined(_WIN32) +void *qemu_memalign(size_t alignment, size_t size) +{ + return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); +} void *qemu_vmalloc(size_t size) { @@ -172,6 +176,22 @@ void kqemu_vfree(void *ptr) #endif +void *qemu_memalign(size_t alignment, size_t size) +{ +#if defined(_POSIX_C_SOURCE) + int ret; + void *ptr; + ret = posix_memalign(&ptr, alignment, size); + if (ret != 0) + return NULL; + return ptr; +#elif defined(_BSD) + return valloc(size); +#else + return memalign(alignment, size); +#endif +} + /* alloc shared memory pages */ void *qemu_vmalloc(size_t size) { |