aboutsummaryrefslogtreecommitdiff
path: root/osdep.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-24 14:33:24 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-24 14:33:24 +0000
commit33f002714be2ed58ed05ae3870d5ea6915df4b47 (patch)
tree6b5f907e0c0b42bc6ca4222f1e14462be5e30c1a /osdep.c
parent3e98dc8ec6af89c7f4f1e006b979eb405b431629 (diff)
Add "cache" parameter to "-drive" (Laurent Vivier).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3848 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'osdep.c')
-rw-r--r--osdep.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/osdep.c b/osdep.c
index 8191b1f717..f824bc1ea2 100644
--- a/osdep.c
+++ b/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 @@ static 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)
{