Skip to contentSkip to conversation

Solaris kqemu patch

Qemu-devel Ben Taylor 1 participant 1 message Jan 12, 2007

lore
Share & tools
lore

Ben Taylor

author
#0 lore raw

This patch allows for the opensolaris kqemu module to be activated under a Solaris Express (11) host running qemu.

The solaris kqemu module is located at:

http://www.opensolaris.org/os/project/qemu/downloads/kqemu-osol-1.3.0pre9-v0.2.tar.gz

configure +5 -0
diff -ruN qemu-base/configure qemu/configure
@@ -151,6 +151,11 @@
     make="gmake"
     install="ginstall"
     solarisrev=`uname -r | cut -f2 -d.`
+    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+        if test "$solarisrev" -gt 10 ; then
+            kqemu="yes"
+        fi
+    fi
 fi
 
 # find source path
kqemu.c +3 -0
diff -ruN qemu-base/kqemu.c qemu/kqemu.c
@@ -26,6 +26,9 @@
 #include <sys/mman.h>
 #include <sys/ioctl.h>
 #endif
+#ifdef HOST_SOLARIS
+#include <sys/modctl.h>
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
osdep.c +13 -0
diff -ruN qemu-base/osdep.c qemu/osdep.c
@@ -27,6 +27,10 @@
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
+#ifdef HOST_SOLARIS
+#include <sys/types.h>
+#include <sys/statvfs.h>
+#endif
 
 #include "cpu.h"
 #if defined(USE_KQEMU)
@@ -86,13 +90,22 @@
     const char *tmpdir;
     char phys_ram_file[1024];
     void *ptr;
+#ifdef HOST_SOLARIS
+    struct statvfs stfs;
+#else
     struct statfs stfs;
+#endif
 
     if (phys_ram_fd < 0) {
         tmpdir = getenv("QEMU_TMPDIR");
         if (!tmpdir)
+#ifdef HOST_SOLARIS
+            tmpdir = "/tmp";
+        if (statvfs(tmpdir, &stfs) == 0) {
+#else
             tmpdir = "/dev/shm";
         if (statfs(tmpdir, &stfs) == 0) {
+#endif
             int64_t free_space;
             int ram_mb;