kqemu flavor, tested by several in an unflavored earlier version

prodded by marco@
This commit is contained in:
todd 2008-01-19 23:53:58 +00:00
parent 4f79d70ecc
commit 9a1552a179
5 changed files with 78 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.23 2008/01/09 10:17:54 todd Exp $
# $OpenBSD: Makefile,v 1.24 2008/01/19 23:53:58 todd Exp $
# no success building on other archs yet
ONLY_FOR_ARCHS= amd64 arm i386 powerpc
@ -32,9 +32,14 @@ REGRESS_TARGET= test test2
PATCH_LIST= patch-* misc-*
.endif
FLAVORS= no_x11
FLAVORS= no_x11 kqemu
FLAVOR?=
.if ${FLAVOR:L:Mkqemu}
#CONFIGURE_ARGS+= --enable-kqemu
CONFIGURE_ENV+= USE_KQEMU=yes
.endif
.if ${FLAVOR:L:Mno_x11}
CONFIGURE_ARGS+= --disable-gfx-check \
--disable-sdl

View File

@ -1,7 +1,7 @@
$OpenBSD: misc-target-i386_helper_c,v 1.1 2005/11/03 18:41:55 fgsch Exp $
--- target-i386/helper.c.orig Tue Oct 25 02:58:34 2005
+++ target-i386/helper.c Tue Oct 25 02:59:43 2005
@@ -3483,3 +3483,13 @@ void tlb_fill(target_ulong addr, int is_
$OpenBSD: misc-target-i386_helper_c,v 1.2 2008/01/19 23:53:58 todd Exp $
--- target-i386/helper.c.orig Mon Feb 5 17:01:54 2007
+++ target-i386/helper.c Wed Jan 16 11:22:08 2008
@@ -3838,3 +3838,13 @@ void tlb_fill(target_ulong addr, int is_write, int is_
}
env = saved_env;
}

View File

@ -1,7 +1,7 @@
$OpenBSD: misc-target-i386_op_c,v 1.1 2005/11/03 18:41:55 fgsch Exp $
--- target-i386/op.c.orig Tue Oct 25 02:58:19 2005
+++ target-i386/op.c Tue Oct 25 02:59:25 2005
@@ -2100,12 +2100,12 @@ void OPPROTO op_fdivr_STN_ST0(void)
$OpenBSD: misc-target-i386_op_c,v 1.2 2008/01/19 23:53:58 todd Exp $
--- target-i386/op.c.orig Mon Feb 5 17:01:54 2007
+++ target-i386/op.c Wed Jan 16 11:22:08 2008
@@ -2164,12 +2164,12 @@ void OPPROTO op_fdivr_STN_ST0(void)
/* misc FPU operations */
void OPPROTO op_fchs_ST0(void)
{

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
$OpenBSD: patch-configure,v 1.9 2008/01/19 23:53:58 todd Exp $
--- configure.orig Mon Feb 5 17:01:54 2007
+++ configure Tue Apr 3 08:21:26 2007
+++ configure Wed Jan 16 11:23:08 2008
@@ -21,10 +21,10 @@ prefix=""
interp_prefix="/usr/gnemul/qemu-%M"
static="no"
@ -33,15 +33,19 @@ $OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
*)
cpu="unknown"
;;
@@ -122,6 +125,7 @@ oss="yes"
@@ -122,7 +125,11 @@ oss="yes"
;;
OpenBSD)
bsd="yes"
+openbsd="yes"
oss="yes"
+if [ "$USE_KQEMU" = "yes" ] ; then
+ kqemu="yes"
+fi
;;
Darwin)
@@ -573,7 +577,7 @@ else
bsd="yes"
@@ -573,7 +580,7 @@ else
if test -z "$prefix" ; then
prefix="/usr/local"
fi
@ -50,7 +54,7 @@ $OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
datadir="$prefix/share/qemu"
docdir="$prefix/share/doc/qemu"
bindir="$prefix/bin"
@@ -601,9 +605,7 @@ if test "$darwin" = "yes" ; then
@@ -601,9 +608,7 @@ if test "$darwin" = "yes" ; then
echo "Cocoa support $cocoa"
fi
echo "SDL support $sdl"
@ -61,7 +65,7 @@ $OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
echo "mingw32 support $mingw32"
echo "Adlib support $adlib"
echo "CoreAudio support $coreaudio"
@@ -648,6 +650,7 @@ echo "mandir=$mandir" >> $config_mak
@@ -648,6 +653,7 @@ echo "mandir=$mandir" >> $config_mak
echo "datadir=$datadir" >> $config_mak
echo "docdir=$docdir" >> $config_mak
echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
@ -69,7 +73,7 @@ $OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
echo "MAKE=$make" >> $config_mak
echo "INSTALL=$install" >> $config_mak
echo "CC=$cc" >> $config_mak
@@ -667,6 +670,9 @@ if test "$cpu" = "i386" ; then
@@ -667,6 +673,9 @@ if test "$cpu" = "i386" ; then
elif test "$cpu" = "x86_64" ; then
echo "ARCH=x86_64" >> $config_mak
echo "#define HOST_X86_64 1" >> $config_h
@ -79,7 +83,7 @@ $OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
elif test "$cpu" = "armv4b" ; then
echo "ARCH=arm" >> $config_mak
echo "#define HOST_ARM 1" >> $config_h
@@ -746,6 +752,9 @@ fi
@@ -746,6 +755,9 @@ fi
if test "$oss" = "yes" ; then
echo "CONFIG_OSS=yes" >> $config_mak
echo "#define CONFIG_OSS 1" >> $config_h
@ -89,7 +93,7 @@ $OpenBSD: patch-configure,v 1.8 2007/05/01 12:55:14 todd Exp $
fi
if test "$coreaudio" = "yes" ; then
echo "CONFIG_COREAUDIO=yes" >> $config_mak
@@ -777,6 +786,13 @@ echo "TARGET_DIRS=$target_list" >> $config_mak
@@ -777,6 +789,13 @@ echo "TARGET_DIRS=$target_list" >> $config_mak
if [ "$build_docs" = "yes" ] ; then
echo "BUILD_DOCS=yes" >> $config_mak
fi

View File

@ -0,0 +1,50 @@
$OpenBSD: patch-osdep_c,v 1.1 2008/01/19 23:53:58 todd Exp $
--- osdep.c.orig Mon Feb 5 17:01:54 2007
+++ osdep.c Mon Jan 7 19:01:42 2008
@@ -79,7 +79,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>
@@ -87,9 +94,15 @@ 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
@@ -151,11 +164,13 @@ void *kqemu_vmalloc(size_t size)
}
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");