diff -urN qemu-0.8.2/configure qemu-0.8.2-qvm86/configure --- qemu-0.8.2/configure 2006-07-22 21:23:34.000000000 +0400 +++ qemu-0.8.2-qvm86/configure 2006-10-15 18:34:17.438159229 +0400 @@ -87,6 +87,8 @@ bsd="no" linux="no" kqemu="no" +qvm86="no" +kernel_module="no" profiler="no" kernel_path="" cocoa="no" @@ -107,6 +109,10 @@ ;; MINGW32*) mingw32="yes" +if [ "$cpu" = "i386" ] ; then + kqemu="yes" + qvm86="yes" +fi ;; FreeBSD) bsd="yes" @@ -136,6 +142,7 @@ user="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" + qvm86="yes" fi ;; esac @@ -221,6 +228,8 @@ ;; --disable-kqemu) kqemu="no" ;; + --disable-qvm86) qvm86="no" + ;; --enable-profiler) profiler="yes" ;; --kernel-path=*) kernel_path="$optarg" @@ -267,6 +276,7 @@ echo "" echo "kqemu kernel acceleration support:" echo " --disable-kqemu disable kqemu support" +echo " --disable-qvm86 disable qvm86 build" echo " --kernel-path=PATH set the kernel path (configure probes it)" echo "" echo "Advanced options (experts only):" @@ -515,6 +525,64 @@ bindir="$prefix/bin" fi +# kqemu support +if test $kqemu = "yes" ; then + # test if the source code is installed + if test '!' -f "kqemu/Makefile" ; then + kqemu="no" + fi +fi +if test $qvm86 = "yes" ; then + # test if the source code is installed + if test '!' -f "qvm86/Makefile" ; then + qvm86="no" + fi +fi + +if test $kqemu = "yes" -o $qvm86 = "yes" ; then + kernel_module=yes +fi + +# find the kernel path +if test $kernel_module = "yes"; then +if test "$linux" = "yes"; then +if test -z "$kernel_path" ; then +kernel_version=`uname -r` +kernel_path="/lib/modules/$kernel_version/build" +if test '!' -d "$kernel_path/include" ; then + kernel_path="/usr/src/linux" + if test '!' -d "$kernel_path/include" ; then + echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kernel module" + kernel_module="no" + fi +fi +fi +fi # linux +fi # kernel_module + +if test $kernel_module = yes; then +if test "$linux" = "yes"; then + +# test that the kernel config is present +if test '!' -f "$kernel_path/.config" ; then + echo "No .config file present in $kernel_path - kernel module cannot be built" + kernel_module="no"; +fi + +# find build system (2.6 or legacy) +kbuild26="yes" +if grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then +kbuild26="no" +fi + +fi # linux +fi # kernel_module + +if test ! $kernel_module = "yes"; then + kqemu="no" + qvm86="no" +fi + echo "Install prefix $prefix" echo "BIOS directory $datadir" echo "binary directory $bindir" @@ -559,6 +627,20 @@ fi echo "FMOD support $fmod $fmod_support" echo "kqemu support $kqemu" +echo "qvm86 support $qvm86" +if test $kernel_module = "yes"; then +if test "$linux" = "yes"; then +echo "" +echo "Kernel module configuration:" +echo "kernel sources $kernel_path" +echo -n "kbuild type " +if test $kbuild26 = "yes"; then +echo "2.6" +else +echo "2.4" +fi +fi +fi echo "Documentation $build_docs" [ ! -z "$uname_release" ] && \ echo "uname -r $uname_release" @@ -700,14 +782,26 @@ echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak echo "#define CONFIG_FMOD 1" >> $config_h fi -qemu_version=`head $source_path/VERSION` -echo "VERSION=$qemu_version" >>$config_mak -echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h - -echo "SRC_PATH=$source_path" >> $config_mak -if [ "$source_path_used" = "yes" ]; then - echo "VPATH=$source_path" >> $config_mak +echo -n "VERSION=" >>$config_mak +head $source_path/VERSION >>$config_mak +echo "" >>$config_mak +echo -n "#define QEMU_VERSION \"" >> $config_h +head $source_path/VERSION >> $config_h +echo "\"" >> $config_h + +if test $kqemu = "yes" ; then + echo "CONFIG_KQEMU=yes" >> $config_mak +fi +if test $qvm86 = "yes" ; then + echo "CONFIG_QVM86=yes" >> $config_mak +fi +if test $kernel_module = "yes" ; then + echo "KERNEL_PATH=$kernel_path" >> $config_mak + if test "$kbuild26" = "yes" ; then + echo "CONFIG_KBUILD26=yes" >> $config_mak + fi fi +echo "SRC_PATH=$source_path" >> $config_mak echo "TARGET_DIRS=$target_list" >> $config_mak if [ "$build_docs" = "yes" ] ; then echo "BUILD_DOCS=yes" >> $config_mak @@ -788,7 +882,7 @@ echo "TARGET_ARCH=i386" >> $config_mak echo "#define TARGET_ARCH \"i386\"" >> $config_h echo "#define TARGET_I386 1" >> $config_h - if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then + if test $kernel_module = "yes" -a "$target_softmmu" = "yes" -a "$cpu" = "i386"; then echo "#define USE_KQEMU 1" >> $config_h fi elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then diff -urN qemu-0.8.2/kqemu.c qemu-0.8.2-qvm86/kqemu.c --- qemu-0.8.2/kqemu.c 2006-07-22 21:23:34.000000000 +0400 +++ qemu-0.8.2-qvm86/kqemu.c 2006-10-15 18:34:32.971225425 +0400 @@ -45,6 +45,7 @@ #include #include #include "kqemu.h" +#include "qvm86/kqemu.h" /* compatibility stuff */ #ifndef KQEMU_RET_SYSCALL @@ -59,9 +60,9 @@ #endif #ifdef _WIN32 -#define KQEMU_DEVICE "\\\\.\\kqemu" +#define KQEMU_DEVICE "\\\\.\\qvm86" #else -#define KQEMU_DEVICE "/dev/kqemu" +#define KQEMU_DEVICE "/dev/qvm86" #endif #ifdef _WIN32 @@ -152,6 +153,8 @@ /* XXX: we could update more of the target CPUID state so that the non accelerated code sees exactly the same CPU features as the accelerated code */ + /* Other flags not supported by qvm86 */ + env->cpuid_features &= ~(CPUID_PAT | CPUID_PAE | CPUID_SEP); } int kqemu_init(CPUState *env) @@ -236,6 +239,7 @@ env->kqemu_enabled = kqemu_allowed; nb_pages_to_flush = 0; nb_ram_pages_to_update = 0; + printf ("QEMU acceleration layer enabled\n"); return 0; } diff -urN qemu-0.8.2/Makefile qemu-0.8.2-qvm86/Makefile --- qemu-0.8.2/Makefile 2006-07-22 21:23:34.000000000 +0400 +++ qemu-0.8.2-qvm86/Makefile 2006-10-15 18:34:13.967814690 +0400 @@ -26,7 +26,14 @@ endif all: $(TOOLS) $(DOCS) recurse-all - +ifdef CONFIG_QVM86 +ifdef CONFIG_WIN32 + $(MAKE) -C qvm86 -f Makefile.winnt +else + $(MAKE) -C qvm86 +endif +endif + subdir-%: dyngen$(EXESUF) $(MAKE) -C $(subst subdir-,,$@) all @@ -46,6 +53,16 @@ for d in $(TARGET_DIRS); do \ $(MAKE) -C $$d $@ || exit 1 ; \ done +ifdef CONFIG_KQEMU + $(MAKE) -C kqemu clean +endif +ifdef CONFIG_QVM86 +ifdef CONFIG_WIN32 + $(MAKE) -C qvm86 -f Makefile.winnt clean +else + $(MAKE) -C qvm86 clean +endif +endif distclean: clean rm -f config-host.mak config-host.h $(DOCS) @@ -83,6 +100,12 @@ for d in $(TARGET_DIRS); do \ $(MAKE) -C $$d $@ || exit 1 ; \ done +ifdef CONFIG_KQEMU + cd kqemu ; ./install.sh +endif +ifdef CONFIG_QVM86 + cd qvm86 ; ./install.sh +endif # various test targets test speed test2: all diff -urN qemu-0.8.2/osdep.c qemu-0.8.2-qvm86/osdep.c --- qemu-0.8.2/osdep.c 2006-07-22 21:23:34.000000000 +0400 +++ qemu-0.8.2-qvm86/osdep.c 2006-10-15 18:34:20.677547390 +0400 @@ -326,7 +326,7 @@ #else -#if defined(USE_KQEMU) +#if 0 && defined(USE_KQEMU) #include #include @@ -419,7 +419,7 @@ /* alloc shared memory pages */ void *qemu_vmalloc(size_t size) { -#if defined(USE_KQEMU) +#if 0 && defined(USE_KQEMU) if (kqemu_allowed) return kqemu_vmalloc(size); #endif @@ -432,7 +432,7 @@ void qemu_vfree(void *ptr) { -#if defined(USE_KQEMU) +#if 0 && defined(USE_KQEMU) if (kqemu_allowed) kqemu_vfree(ptr); #endif