summaryrefslogtreecommitdiff
path: root/osdep.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-05-22 14:10:48 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-05-22 14:10:48 +0000
commit6cb7ee859a1b28aae8eab7f88908c9c9262b8a5c (patch)
tree4d7cd93dc2f22f141e76fa3da3c696a0ca84abc3 /osdep.c
parente4d165c24b1975478476722a9ef384147721807a (diff)
downloadqemu-6cb7ee859a1b28aae8eab7f88908c9c9262b8a5c.tar.gz
qemu-6cb7ee859a1b28aae8eab7f88908c9c9262b8a5c.tar.bz2
qemu-6cb7ee859a1b28aae8eab7f88908c9c9262b8a5c.zip
Only use /dev/shm hack when kqemu is enabled.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1930 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'osdep.c')
-rw-r--r--osdep.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/osdep.c b/osdep.c
index f2a69d9a71..ffa29fe8e4 100644
--- a/osdep.c
+++ b/osdep.c
@@ -29,6 +29,9 @@
#include <unistd.h>
#include "cpu.h"
+#if defined(USE_KQEMU)
+#include "vl.h"
+#endif
#if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
@@ -321,13 +324,15 @@ void qemu_vfree(void *ptr)
VirtualFree(ptr, 0, MEM_RELEASE);
}
-#elif defined(USE_KQEMU)
+#else
+
+#if defined(USE_KQEMU)
#include <sys/vfs.h>
#include <sys/mman.h>
#include <fcntl.h>
-void *qemu_vmalloc(size_t size)
+void *kqemu_vmalloc(size_t size)
{
static int phys_ram_fd = -1;
static int phys_ram_size = 0;
@@ -362,6 +367,7 @@ void *qemu_vmalloc(size_t size)
"QEMU_TMPDIR environment variable to set another directory where the QEMU\n"
"temporary RAM file will be opened.\n");
}
+ fprintf(stderr, "Or disable the accelerator module with -no-kqemu\n");
exit(1);
}
}
@@ -403,16 +409,20 @@ void *qemu_vmalloc(size_t size)
return ptr;
}
-void qemu_vfree(void *ptr)
+void kqemu_vfree(void *ptr)
{
/* may be useful some day, but currently we do not need to free */
}
-#else
+#endif
/* alloc shared memory pages */
void *qemu_vmalloc(size_t size)
{
+#if defined(USE_KQEMU)
+ if (kqemu_allowed)
+ return kqemu_vmalloc(size);
+#endif
#ifdef _BSD
return valloc(size);
#else
@@ -422,6 +432,10 @@ void *qemu_vmalloc(size_t size)
void qemu_vfree(void *ptr)
{
+#if defined(USE_KQEMU)
+ if (kqemu_allowed)
+ kqemu_vfree(ptr);
+#endif
free(ptr);
}