OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

315 lines
8.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../qemu/qvm86.patch
  5. # Copyright (C) 2006 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. by AgBr <agbr@hotbox.ru>
  17. http://lists.gnu.org/archive/html/qvm86-devel/2006-10/msg00000.html
  18. diff -urN qemu-0.8.2/configure qemu-0.8.2-qvm86/configure
  19. --- qemu-0.8.2/configure 2006-07-22 21:23:34.000000000 +0400
  20. +++ qemu-0.8.2-qvm86/configure 2006-10-15 18:34:17.438159229 +0400
  21. @@ -87,6 +87,8 @@
  22. bsd="no"
  23. linux="no"
  24. kqemu="no"
  25. +qvm86="no"
  26. +kernel_module="no"
  27. profiler="no"
  28. kernel_path=""
  29. cocoa="no"
  30. @@ -107,6 +109,10 @@
  31. ;;
  32. MINGW32*)
  33. mingw32="yes"
  34. +if [ "$cpu" = "i386" ] ; then
  35. + kqemu="yes"
  36. + qvm86="yes"
  37. +fi
  38. ;;
  39. FreeBSD)
  40. bsd="yes"
  41. @@ -136,6 +142,7 @@
  42. user="yes"
  43. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  44. kqemu="yes"
  45. + qvm86="yes"
  46. fi
  47. ;;
  48. esac
  49. @@ -221,6 +228,8 @@
  50. ;;
  51. --disable-kqemu) kqemu="no"
  52. ;;
  53. + --disable-qvm86) qvm86="no"
  54. + ;;
  55. --enable-profiler) profiler="yes"
  56. ;;
  57. --kernel-path=*) kernel_path="$optarg"
  58. @@ -267,6 +276,7 @@
  59. echo ""
  60. echo "kqemu kernel acceleration support:"
  61. echo " --disable-kqemu disable kqemu support"
  62. +echo " --disable-qvm86 disable qvm86 build"
  63. echo " --kernel-path=PATH set the kernel path (configure probes it)"
  64. echo ""
  65. echo "Advanced options (experts only):"
  66. @@ -515,6 +525,64 @@
  67. bindir="$prefix/bin"
  68. fi
  69. +# kqemu support
  70. +if test $kqemu = "yes" ; then
  71. + # test if the source code is installed
  72. + if test '!' -f "kqemu/Makefile" ; then
  73. + kqemu="no"
  74. + fi
  75. +fi
  76. +if test $qvm86 = "yes" ; then
  77. + # test if the source code is installed
  78. + if test '!' -f "qvm86/Makefile" ; then
  79. + qvm86="no"
  80. + fi
  81. +fi
  82. +
  83. +if test $kqemu = "yes" -o $qvm86 = "yes" ; then
  84. + kernel_module=yes
  85. +fi
  86. +
  87. +# find the kernel path
  88. +if test $kernel_module = "yes"; then
  89. +if test "$linux" = "yes"; then
  90. +if test -z "$kernel_path" ; then
  91. +kernel_version=`uname -r`
  92. +kernel_path="/lib/modules/$kernel_version/build"
  93. +if test '!' -d "$kernel_path/include" ; then
  94. + kernel_path="/usr/src/linux"
  95. + if test '!' -d "$kernel_path/include" ; then
  96. + echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kernel module"
  97. + kernel_module="no"
  98. + fi
  99. +fi
  100. +fi
  101. +fi # linux
  102. +fi # kernel_module
  103. +
  104. +if test $kernel_module = yes; then
  105. +if test "$linux" = "yes"; then
  106. +
  107. +# test that the kernel config is present
  108. +if test '!' -f "$kernel_path/.config" ; then
  109. + echo "No .config file present in $kernel_path - kernel module cannot be built"
  110. + kernel_module="no";
  111. +fi
  112. +
  113. +# find build system (2.6 or legacy)
  114. +kbuild26="yes"
  115. +if grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then
  116. +kbuild26="no"
  117. +fi
  118. +
  119. +fi # linux
  120. +fi # kernel_module
  121. +
  122. +if test ! $kernel_module = "yes"; then
  123. + kqemu="no"
  124. + qvm86="no"
  125. +fi
  126. +
  127. echo "Install prefix $prefix"
  128. echo "BIOS directory $datadir"
  129. echo "binary directory $bindir"
  130. @@ -559,6 +627,20 @@
  131. fi
  132. echo "FMOD support $fmod $fmod_support"
  133. echo "kqemu support $kqemu"
  134. +echo "qvm86 support $qvm86"
  135. +if test $kernel_module = "yes"; then
  136. +if test "$linux" = "yes"; then
  137. +echo ""
  138. +echo "Kernel module configuration:"
  139. +echo "kernel sources $kernel_path"
  140. +echo -n "kbuild type "
  141. +if test $kbuild26 = "yes"; then
  142. +echo "2.6"
  143. +else
  144. +echo "2.4"
  145. +fi
  146. +fi
  147. +fi
  148. echo "Documentation $build_docs"
  149. [ ! -z "$uname_release" ] && \
  150. echo "uname -r $uname_release"
  151. @@ -700,14 +782,26 @@
  152. echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
  153. echo "#define CONFIG_FMOD 1" >> $config_h
  154. fi
  155. -qemu_version=`head $source_path/VERSION`
  156. -echo "VERSION=$qemu_version" >>$config_mak
  157. -echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
  158. -
  159. -echo "SRC_PATH=$source_path" >> $config_mak
  160. -if [ "$source_path_used" = "yes" ]; then
  161. - echo "VPATH=$source_path" >> $config_mak
  162. +echo -n "VERSION=" >>$config_mak
  163. +head $source_path/VERSION >>$config_mak
  164. +echo "" >>$config_mak
  165. +echo -n "#define QEMU_VERSION \"" >> $config_h
  166. +head $source_path/VERSION >> $config_h
  167. +echo "\"" >> $config_h
  168. +
  169. +if test $kqemu = "yes" ; then
  170. + echo "CONFIG_KQEMU=yes" >> $config_mak
  171. +fi
  172. +if test $qvm86 = "yes" ; then
  173. + echo "CONFIG_QVM86=yes" >> $config_mak
  174. +fi
  175. +if test $kernel_module = "yes" ; then
  176. + echo "KERNEL_PATH=$kernel_path" >> $config_mak
  177. + if test "$kbuild26" = "yes" ; then
  178. + echo "CONFIG_KBUILD26=yes" >> $config_mak
  179. + fi
  180. fi
  181. +echo "SRC_PATH=$source_path" >> $config_mak
  182. echo "TARGET_DIRS=$target_list" >> $config_mak
  183. if [ "$build_docs" = "yes" ] ; then
  184. echo "BUILD_DOCS=yes" >> $config_mak
  185. @@ -788,7 +882,7 @@
  186. echo "TARGET_ARCH=i386" >> $config_mak
  187. echo "#define TARGET_ARCH \"i386\"" >> $config_h
  188. echo "#define TARGET_I386 1" >> $config_h
  189. - if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
  190. + if test $kernel_module = "yes" -a "$target_softmmu" = "yes" -a "$cpu" = "i386"; then
  191. echo "#define USE_KQEMU 1" >> $config_h
  192. fi
  193. elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
  194. diff -urN qemu-0.8.2/kqemu.c qemu-0.8.2-qvm86/kqemu.c
  195. --- qemu-0.8.2/kqemu.c 2006-07-22 21:23:34.000000000 +0400
  196. +++ qemu-0.8.2-qvm86/kqemu.c 2006-10-15 18:34:32.971225425 +0400
  197. @@ -45,6 +45,7 @@
  198. #include <unistd.h>
  199. #include <fcntl.h>
  200. #include "kqemu.h"
  201. +#include "qvm86/kqemu.h"
  202. /* compatibility stuff */
  203. #ifndef KQEMU_RET_SYSCALL
  204. @@ -59,9 +60,9 @@
  205. #endif
  206. #ifdef _WIN32
  207. -#define KQEMU_DEVICE "\\\\.\\kqemu"
  208. +#define KQEMU_DEVICE "\\\\.\\qvm86"
  209. #else
  210. -#define KQEMU_DEVICE "/dev/kqemu"
  211. +#define KQEMU_DEVICE "/dev/qvm86"
  212. #endif
  213. #ifdef _WIN32
  214. @@ -152,6 +153,8 @@
  215. /* XXX: we could update more of the target CPUID state so that the
  216. non accelerated code sees exactly the same CPU features as the
  217. accelerated code */
  218. + /* Other flags not supported by qvm86 */
  219. + env->cpuid_features &= ~(CPUID_PAT | CPUID_PAE | CPUID_SEP);
  220. }
  221. int kqemu_init(CPUState *env)
  222. @@ -236,6 +239,7 @@
  223. env->kqemu_enabled = kqemu_allowed;
  224. nb_pages_to_flush = 0;
  225. nb_ram_pages_to_update = 0;
  226. + printf ("QEMU acceleration layer enabled\n");
  227. return 0;
  228. }
  229. diff -urN qemu-0.8.2/Makefile qemu-0.8.2-qvm86/Makefile
  230. --- qemu-0.8.2/Makefile 2006-07-22 21:23:34.000000000 +0400
  231. +++ qemu-0.8.2-qvm86/Makefile 2006-10-15 18:34:13.967814690 +0400
  232. @@ -26,7 +26,14 @@
  233. endif
  234. all: $(TOOLS) $(DOCS) recurse-all
  235. -
  236. +ifdef CONFIG_QVM86
  237. +ifdef CONFIG_WIN32
  238. + $(MAKE) -C qvm86 -f Makefile.winnt
  239. +else
  240. + $(MAKE) -C qvm86
  241. +endif
  242. +endif
  243. +
  244. subdir-%: dyngen$(EXESUF)
  245. $(MAKE) -C $(subst subdir-,,$@) all
  246. @@ -46,6 +53,16 @@
  247. for d in $(TARGET_DIRS); do \
  248. $(MAKE) -C $$d $@ || exit 1 ; \
  249. done
  250. +ifdef CONFIG_KQEMU
  251. + $(MAKE) -C kqemu clean
  252. +endif
  253. +ifdef CONFIG_QVM86
  254. +ifdef CONFIG_WIN32
  255. + $(MAKE) -C qvm86 -f Makefile.winnt clean
  256. +else
  257. + $(MAKE) -C qvm86 clean
  258. +endif
  259. +endif
  260. distclean: clean
  261. rm -f config-host.mak config-host.h $(DOCS)
  262. @@ -83,6 +100,12 @@
  263. for d in $(TARGET_DIRS); do \
  264. $(MAKE) -C $$d $@ || exit 1 ; \
  265. done
  266. +ifdef CONFIG_KQEMU
  267. + cd kqemu ; ./install.sh
  268. +endif
  269. +ifdef CONFIG_QVM86
  270. + cd qvm86 ; ./install.sh
  271. +endif
  272. # various test targets
  273. test speed test2: all
  274. diff -urN qemu-0.8.2/osdep.c qemu-0.8.2-qvm86/osdep.c
  275. --- qemu-0.8.2/osdep.c 2006-07-22 21:23:34.000000000 +0400
  276. +++ qemu-0.8.2-qvm86/osdep.c 2006-10-15 18:34:20.677547390 +0400
  277. @@ -326,7 +326,7 @@
  278. #else
  279. -#if defined(USE_KQEMU)
  280. +#if 0 && defined(USE_KQEMU)
  281. #include <sys/vfs.h>
  282. #include <sys/mman.h>
  283. @@ -419,7 +419,7 @@
  284. /* alloc shared memory pages */
  285. void *qemu_vmalloc(size_t size)
  286. {
  287. -#if defined(USE_KQEMU)
  288. +#if 0 && defined(USE_KQEMU)
  289. if (kqemu_allowed)
  290. return kqemu_vmalloc(size);
  291. #endif
  292. @@ -432,7 +432,7 @@
  293. void qemu_vfree(void *ptr)
  294. {
  295. -#if defined(USE_KQEMU)
  296. +#if 0 && defined(USE_KQEMU)
  297. if (kqemu_allowed)
  298. kqemu_vfree(ptr);
  299. #endif