Drop this in ports/emulators/qemu/patches, and build the port.

I'd be grateful if anybody was going to actually test all this,
and tell me if it works.

Thanks,
Adi

--- a
+++ osdep.c     Wed Oct 24 18:24:30 2007
@@ -79,7 +79,14 @@
 
 #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>
 
@@ -87,9 +94,15 @@
 {
     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
@@ -151,11 +164,13 @@
         }
         unlink(phys_ram_file);
     }
+#endif /* !__OpenBSD__ */
+
     size = (size + 4095) & ~4095;
     ftruncate(phys_ram_fd, phys_ram_size + size);
     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");
--- a
+++ configure   Wed Oct 24 18:19:00 2007
@@ -127,6 +127,9 @@
 bsd="yes"
 openbsd="yes"
 oss="yes"
+if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+    kqemu="yes"
+fi
 ;;
 Darwin)
 bsd="yes"

Reply via email to