summaryrefslogtreecommitdiff
path: root/osdep.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-15 18:33:42 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-15 18:33:42 +0000
commit7979385b8b50e520d73099a4609705108b98de40 (patch)
tree58e3f83a26a0df04bd347789c0163e0ac6c0a5e9 /osdep.c
parentabca6fefff17faa4eeca84ca0cc8b03c714137ac (diff)
downloadqemu-7979385b8b50e520d73099a4609705108b98de40.tar.gz
qemu-7979385b8b50e520d73099a4609705108b98de40.tar.bz2
qemu-7979385b8b50e520d73099a4609705108b98de40.zip
Preliminary OpenBSD host support (based on OpenBSD patches by Todd T. Fries)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5012 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'osdep.c')
-rw-r--r--osdep.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/osdep.c b/osdep.c
index 46434af605..a49efba01b 100644
--- a/osdep.c
+++ b/osdep.c
@@ -68,7 +68,14 @@ void qemu_vfree(void *ptr)
#if defined(USE_KQEMU)
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+#else
#include <sys/vfs.h>
+#endif
+
#include <sys/mman.h>
#include <fcntl.h>
@@ -76,9 +83,14 @@ static void *kqemu_vmalloc(size_t size)
{
static int phys_ram_fd = -1;
static int phys_ram_size = 0;
+ void *ptr;
+
+#ifdef __OpenBSD__ /* no need (?) for a dummy file on OpenBSD */
+ int map_anon = MAP_ANON;
+#else
+ int map_anon = 0;
const char *tmpdir;
char phys_ram_file[1024];
- void *ptr;
#ifdef HOST_SOLARIS
struct statvfs stfs;
#else
@@ -140,9 +152,10 @@ static void *kqemu_vmalloc(size_t size)
}
size = (size + 4095) & ~4095;
ftruncate(phys_ram_fd, phys_ram_size + size);
+#endif /* !__OpenBSD__ */
ptr = mmap(NULL,
size,
- PROT_WRITE | PROT_READ, MAP_SHARED,
+ PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,
phys_ram_fd, phys_ram_size);
if (ptr == MAP_FAILED) {
fprintf(stderr, "Could not map physical memory\n");