aboutsummaryrefslogtreecommitdiff
path: root/osdep.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-17 18:33:47 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-17 18:33:47 +0000
commit6e4255f6a65091fbe7d17bfda546e2aa1b72f9a6 (patch)
treead1300173386b62b0930a760ec4c55aa59cefef8 /osdep.c
parent74ffc7729e3a1e1e328ba053a15cb5b7a5a605d1 (diff)
windows support for kqemu (Filip Navara)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1366 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'osdep.c')
-rw-r--r--osdep.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/osdep.c b/osdep.c
index ba6d5f38a1..eef1ecbecb 100644
--- a/osdep.c
+++ b/osdep.c
@@ -273,15 +273,13 @@ void *get_mmap_addr(unsigned long size)
#else
-#ifdef _BSD
+#ifdef _WIN32
+#include <windows.h>
+#elif defined(_BSD)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
-#ifdef _WIN32
-/* XXX: find a solution to have page aligned data */
-#define memalign(align, size) malloc(size)
-#endif
int qemu_write(int fd, const void *buf, size_t n)
{
@@ -308,7 +306,22 @@ void *qemu_malloc(size_t size)
return malloc(size);
}
-#if defined(USE_KQEMU)
+#if defined(_WIN32)
+
+void *qemu_vmalloc(size_t size)
+{
+ /* FIXME: this is not exactly optimal solution since VirtualAlloc
+ has 64Kb granularity, but at least it guarantees us that the
+ memory is page aligned. */
+ return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
+}
+
+void qemu_vfree(void *ptr)
+{
+ VirtualFree(ptr, 0, MEM_RELEASE);
+}
+
+#elif defined(USE_KQEMU)
#include <sys/mman.h>
#include <fcntl.h>