From 97fbdfdbfb15de325fd148bcecc9187d0f778db5 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 16 Mar 2011 17:40:36 -0700 Subject: qemu: Upgrade 0.13.0 -> 0.14.0 * ppc-hack patch is dropped. * Other patches which were direct backports or has been merged upstream in 0.14.0 are also dropped Signed-off-by: Khem Raj --- .../qemu/qemu-0.13.0/enable-i386-linux-user.patch | 53 - .../fallback-to-safe-mmap_min_addr.patch | 37 - .../qemu/qemu-0.13.0/fix-configure-checks.patch | 20 - .../qemu/qemu-0.13.0/fix-dirent.patch | 12 - .../qemu/qemu-0.13.0/fix-nogl.patch | 96 - .../qemu/qemu-0.13.0/glflags.patch | 13 - .../qemu/qemu-0.13.0/init-info.patch | 16 - .../qemu/qemu-0.13.0/linker-flags.patch | 22 - .../qemu/qemu-0.13.0/no-strip.patch | 26 - .../qemu/qemu-0.13.0/parallel_make.patch | 34 - .../qemu/qemu-0.13.0/port92_fix.patch | 196 - .../qemu/qemu-0.13.0/powerpc_rom.bin | Bin 4096 -> 0 bytes .../qemu/qemu-0.13.0/qemu-git-qemugl-host.patch | 34364 ------------------ .../qemu/qemu-0.13.0/qemu-ppc-hack.patch | 108 - .../qemu/qemu-0.13.0/qemu-vmware-vga-depth.patch | 115 - .../qemugl-allow-glxcontext-release.patch | 63 - .../qemu/qemu-0.13.0/vmware-vga-fifo-rewind.patch | 198 - .../qemu/qemu-0.13.0/wacom-tablet-fix.patch | 65 - .../qemu-0.13.0/workaround_bad_futex_headers.patch | 24 - ...t-and-use-GCC-atomic-builtins-for-locking.patch | 84 + .../qemu/qemu-0.14.0/enable-i386-linux-user.patch | 53 + .../fallback-to-safe-mmap_min_addr.patch | 37 + .../qemu/qemu-0.14.0/fix-configure-checks.patch | 20 + .../qemu/qemu-0.14.0/fix-nogl.patch | 125 + .../qemu/qemu-0.14.0/init-info.patch | 16 + .../qemu/qemu-0.14.0/larger_default_ram_size.patch | 20 + .../qemu/qemu-0.14.0/linker-flags.patch | 22 + .../qemu/qemu-0.14.0/no-strip.patch | 13 + .../qemu/qemu-0.14.0/powerpc_rom.bin | Bin 0 -> 4096 bytes .../qemu/qemu-0.14.0/qemu-git-qemugl-host.patch | 34366 +++++++++++++++++++ .../qemu/qemu-0.14.0/qemu-vmware-vga-depth.patch | 115 + .../qemugl-allow-glxcontext-release.patch | 63 + .../spice-qxl-locking-fix-for-qemu-kvm.patch | 150 + meta/recipes-devtools/qemu/qemu_0.13.0.bb | 41 - meta/recipes-devtools/qemu/qemu_0.14.0.bb | 36 + 35 files changed, 35120 insertions(+), 35503 deletions(-) delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/enable-i386-linux-user.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/fallback-to-safe-mmap_min_addr.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/fix-configure-checks.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/fix-dirent.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/fix-nogl.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/glflags.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/init-info.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/linker-flags.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/no-strip.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/parallel_make.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/port92_fix.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/powerpc_rom.bin delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/qemu-git-qemugl-host.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/qemu-ppc-hack.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/qemu-vmware-vga-depth.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/qemugl-allow-glxcontext-release.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/vmware-vga-fifo-rewind.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/wacom-tablet-fix.patch delete mode 100644 meta/recipes-devtools/qemu/qemu-0.13.0/workaround_bad_futex_headers.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/enable-i386-linux-user.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/fallback-to-safe-mmap_min_addr.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/fix-configure-checks.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/fix-nogl.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/init-info.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/larger_default_ram_size.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/linker-flags.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/no-strip.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/powerpc_rom.bin create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/qemu-git-qemugl-host.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/qemu-vmware-vga-depth.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/qemugl-allow-glxcontext-release.patch create mode 100644 meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch delete mode 100644 meta/recipes-devtools/qemu/qemu_0.13.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu_0.14.0.bb diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/enable-i386-linux-user.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/enable-i386-linux-user.patch deleted file mode 100644 index 95420ef99e..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/enable-i386-linux-user.patch +++ /dev/null @@ -1,53 +0,0 @@ -Enable i386-linux-user - -Signed-off-by: Zhai Edwin - -Index: qemu-0.13.0/Makefile.target -=================================================================== ---- qemu-0.13.0.orig/Makefile.target 2011-01-17 16:50:39.000000000 +0800 -+++ qemu-0.13.0/Makefile.target 2011-01-17 16:50:41.000000000 +0800 -@@ -54,8 +54,13 @@ - libobj-y += cpuid.o - endif - libobj-$(CONFIG_NEED_MMU) += mmu.o -+ifndef CONFIG_LINUX_USER - libobj-$(TARGET_I386) += helper_opengl.o opengl_exec.o - libobj-$(TARGET_X86_64) += helper_opengl.o opengl_exec.o -+else -+libobj-$(TARGET_I386) += dummygl.o -+libobj-$(TARGET_X86_64) += dummygl.o -+endif #CONFIG_LINUX_USER - libobj-$(TARGET_ARM) += dummygl.o - libobj-$(TARGET_MIPS) += dummygl.o - libobj-$(TARGET_PPC) += dummygl.o -Index: qemu-0.13.0/target-i386/dummygl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-i386/dummygl.c 2011-01-17 16:50:41.000000000 +0800 -@@ -0,0 +1,26 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+void opengl_exec_set_parent_window(Display* _dpy, Window _parent_window) -+{ -+ -+} -+ -+void opengl_process_enable(void) -+{ -+ -+} -+ -+ -+void mem_opengl(uint64_t ptr) -+{ -+ -+} -+ -+void helper_opengl(void) -+{ -+} diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/fallback-to-safe-mmap_min_addr.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/fallback-to-safe-mmap_min_addr.patch deleted file mode 100644 index 7c782b92a4..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/fallback-to-safe-mmap_min_addr.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c313f89c33217ac0e471554dace2144718f86669 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Thu, 13 May 2010 12:23:40 +0200 -Subject: [PATCH] linux-user: use default mmap_min_addr 65536 when /proc/sys/vm/mmap_min_addr cannot be read - -* 65536 is default at least for ubuntu and fedora. ---- - linux-user/main.c | 5 +++++ - 1 files changed, 5 insertions(+), 0 deletions(-) - -Index: qemu-0.13.0/linux-user/main.c -=================================================================== ---- qemu-0.13.0.orig/linux-user/main.c -+++ qemu-0.13.0/linux-user/main.c -@@ -36,6 +36,7 @@ - #include "envlist.h" - - #define DEBUG_LOGFILE "/tmp/qemu.log" -+#define MMAP_MIN_ADDR_DEFAULT 65536 - - char *exec_path; - -@@ -2973,8 +2974,14 @@ int main(int argc, char **argv, char **e - if (fscanf(fp, "%lu", &tmp) == 1) { - mmap_min_addr = tmp; - qemu_log("host mmap_min_addr=0x%lx\n", mmap_min_addr); -+ } else { -+ qemu_log("cannot read value from /proc/sys/vm/mmap_min_addr, assuming %d\n", MMAP_MIN_ADDR_DEFAULT); -+ mmap_min_addr = MMAP_MIN_ADDR_DEFAULT; - } - fclose(fp); -+ } else { -+ qemu_log("cannot open /proc/sys/vm/mmap_min_addr for reading, assuming %d\n", MMAP_MIN_ADDR_DEFAULT); -+ mmap_min_addr = MMAP_MIN_ADDR_DEFAULT; - } - } - diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/fix-configure-checks.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/fix-configure-checks.patch deleted file mode 100644 index 46ddc6e206..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/fix-configure-checks.patch +++ /dev/null @@ -1,20 +0,0 @@ -In native builds, qemu can fail to find zlib development files in the native -sysroot and the build machine might not have zlib-dev packages installed. - -Add CFLAGS to qemu's CFLAGS which in the native case means BUILD_CFLAGS are -added and files in the sysroot can be found. - -Patch from Paul Eggleton, Comments by RP 28/11/10 - -Index: qemu-0.13.0/configure -=================================================================== ---- qemu-0.13.0.orig/configure 2010-10-16 04:56:09.000000000 +0800 -+++ qemu-0.13.0/configure 2011-01-15 18:19:41.000000000 +0800 -@@ -134,6 +134,7 @@ - QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" - QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" - QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" -+QEMU_CFLAGS="$QEMU_CFLAGS $CFLAGS" - LDFLAGS="-g $LDFLAGS" - - gcc_flags="-Wold-style-declaration -Wold-style-definition -fstack-protector-all" diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/fix-dirent.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/fix-dirent.patch deleted file mode 100644 index 8bbfa0e88e..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/fix-dirent.patch +++ /dev/null @@ -1,12 +0,0 @@ -Index: qemu/linux-user/syscall.c -=================================================================== ---- qemu.orig/linux-user/syscall.c 2010-05-11 13:16:22.421783949 -0400 -+++ qemu/linux-user/syscall.c 2010-05-11 13:16:31.759805849 -0400 -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/fix-nogl.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/fix-nogl.patch deleted file mode 100644 index fa518abbf7..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/fix-nogl.patch +++ /dev/null @@ -1,96 +0,0 @@ -Index: qemu-0.13.0/Makefile.target -=================================================================== ---- qemu-0.13.0.orig/Makefile.target 2011-01-17 16:53:08.000000000 +0800 -+++ qemu-0.13.0/Makefile.target 2011-01-17 16:53:11.000000000 +0800 -@@ -55,6 +55,10 @@ - endif - libobj-$(CONFIG_NEED_MMU) += mmu.o - libobj-$(TARGET_I386) += helper_opengl.o opengl_exec.o -+libobj-$(TARGET_X86_64) += helper_opengl.o opengl_exec.o -+libobj-$(TARGET_ARM) += dummygl.o -+libobj-$(TARGET_MIPS) += dummygl.o -+libobj-$(TARGET_PPC) += dummygl.o - libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o - - libobj-y += disas.o -Index: qemu-0.13.0/target-arm/dummygl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-arm/dummygl.c 2011-01-17 16:53:11.000000000 +0800 -@@ -0,0 +1,22 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+void opengl_exec_set_parent_window(Display* _dpy, Window _parent_window) -+{ -+ -+} -+ -+void opengl_process_enable(void) -+{ -+ -+} -+ -+ -+void mem_opengl(uint64_t ptr) -+{ -+ -+} -Index: qemu-0.13.0/target-mips/dummygl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-mips/dummygl.c 2011-01-17 16:53:11.000000000 +0800 -@@ -0,0 +1,22 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+void opengl_exec_set_parent_window(Display* _dpy, Window _parent_window) -+{ -+ -+} -+ -+void opengl_process_enable(void) -+{ -+ -+} -+ -+ -+void mem_opengl(uint64_t ptr) -+{ -+ -+} -Index: qemu-0.13.0/target-ppc/dummygl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-ppc/dummygl.c 2011-01-17 16:53:11.000000000 +0800 -@@ -0,0 +1,22 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+void opengl_exec_set_parent_window(Display* _dpy, Window _parent_window) -+{ -+ -+} -+ -+void opengl_process_enable(void) -+{ -+ -+} -+ -+ -+void mem_opengl(uint64_t ptr) -+{ -+ -+} diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/glflags.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/glflags.patch deleted file mode 100644 index 0a27c2dee1..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/glflags.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: git/Makefile.target -=================================================================== ---- git.orig/Makefile.target 2010-05-27 12:35:26.000000000 -0400 -+++ git/Makefile.target 2010-05-27 12:59:53.520415731 -0400 -@@ -326,7 +326,7 @@ vl.o: qemu-options.h - - monitor.o: qemu-monitor.h - --LIBS += -lGL -lGLU -+LIBS += -lGL - - ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) - diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/init-info.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/init-info.patch deleted file mode 100644 index 77022ae541..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/init-info.patch +++ /dev/null @@ -1,16 +0,0 @@ -# This is a workaround to the crashes seen on Ubuntu. Setting info to zero -# makes info.info.x11.display zero and avoids the calls to -# opengl_exec_set_parent_window, one of which is crashing. - -Index: qemu-0.13.0/ui/sdl.c -=================================================================== ---- qemu-0.13.0.orig/ui/sdl.c 2011-01-15 17:40:59.000000000 +0800 -+++ qemu-0.13.0/ui/sdl.c 2011-01-15 17:41:04.000000000 +0800 -@@ -857,6 +857,7 @@ - vi = SDL_GetVideoInfo(); - host_format = *(vi->vfmt); - -+ bzero(&info, sizeof(info)); - SDL_GetWMInfo(&info); - if (info.subsystem == SDL_SYSWM_X11 && info.info.x11.display) - opengl_exec_set_parent_window(info.info.x11.display, diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/linker-flags.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/linker-flags.patch deleted file mode 100644 index 54c480f94b..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/linker-flags.patch +++ /dev/null @@ -1,22 +0,0 @@ -Fedora 13 switched the default behaviour of the linker to no longer -indirectly link to required libraries (i.e. dependencies of a library -already linked to). Therefore we need to explicitly pass the depended on -libraries into the linker for building to work on Fedora 13. - -More information is available on the Fedora Wiki: -https://fedoraproject.org/wiki/UnderstandingDSOLinkChange - -JL - 15/06/10 -Index: qemu-0.13.0/Makefile.target -=================================================================== ---- qemu-0.13.0.orig/Makefile.target 2011-01-15 17:30:45.000000000 +0800 -+++ qemu-0.13.0/Makefile.target 2011-01-15 17:33:22.000000000 +0800 -@@ -193,7 +193,7 @@ - obj-y += rwhandler.o - obj-$(CONFIG_KVM) += kvm.o kvm-all.o - obj-$(CONFIG_NO_KVM) += kvm-stub.o --LIBS+=-lz -+LIBS+=-lz -lX11 -ldl - - QEMU_CFLAGS += $(VNC_TLS_CFLAGS) - QEMU_CFLAGS += $(VNC_SASL_CFLAGS) diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/no-strip.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/no-strip.patch deleted file mode 100644 index 62cdec6109..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/no-strip.patch +++ /dev/null @@ -1,26 +0,0 @@ -Index: qemu-0.13.0/Makefile -=================================================================== ---- qemu-0.13.0.orig/Makefile 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/Makefile 2011-01-17 16:44:57.000000000 +0800 -@@ -185,7 +185,7 @@ - install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig - $(INSTALL_DIR) "$(DESTDIR)$(bindir)" - ifneq ($(TOOLS),) -- $(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)" -+ $(INSTALL_PROG) $(TOOLS) "$(DESTDIR)$(bindir)" - endif - ifneq ($(BLOBS),) - $(INSTALL_DIR) "$(DESTDIR)$(datadir)" -Index: qemu-0.13.0/Makefile.target -=================================================================== ---- qemu-0.13.0.orig/Makefile.target 2011-01-17 16:42:36.000000000 +0800 -+++ qemu-0.13.0/Makefile.target 2011-01-17 16:44:57.000000000 +0800 -@@ -351,7 +351,7 @@ - - install: all - ifneq ($(PROGS),) -- $(INSTALL) -m 755 $(STRIP_OPT) $(PROGS) "$(DESTDIR)$(bindir)" -+ $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)" - endif - - # Include automatically generated dependency files diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/parallel_make.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/parallel_make.patch deleted file mode 100644 index 278b1a759d..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/parallel_make.patch +++ /dev/null @@ -1,34 +0,0 @@ -Make -j(>=6) always fail as some job depends on config-host.h. Added following -patch in upstream to resolve it. - -Could remove it in next upgrade if necessary. - -Signed-off-by: Zhai Edwin - -commit f0acb38015409024683911380daa94cc974e4e0e -Author: Paul Brook -Date: Fri Nov 26 18:46:03 2010 +0000 - - Add missing dependency. - - Teach Makefile that cmd.o depends on a generated header (specifically - config-host.h). - - Signed-off-by: Paul Brook - (cherry picked from commit 6e14404aab26f74a448747d1e793ac16bde8a92b) - - Signed-off-by: Aurelien Jarno - -Index: qemu-0.13.0/Makefile -=================================================================== ---- qemu-0.13.0.orig/Makefile 2011-01-18 09:45:45.000000000 +0800 -+++ qemu-0.13.0/Makefile 2011-01-18 09:45:45.000000000 +0800 -@@ -107,7 +107,7 @@ - ###################################################################### - - qemu-img.o: qemu-img-cmds.h --qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS) -+qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o: $(GENERATED_HEADERS) - - qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y) - diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/port92_fix.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/port92_fix.patch deleted file mode 100644 index e101c687c0..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/port92_fix.patch +++ /dev/null @@ -1,196 +0,0 @@ -With qemu 0.13.0, poky failed to start on ppc arch because both ppc_prep_init -and i8042_initfn try to register to port 0x92 then cause conflict. Introduce -this patch from upstream to fix it. - -Could remove it in future if necessary. - -Signed-off-by: Zhai, Edwin - -commit 4b78a802ffaabb325a0f7b773031da92d173bde1 -Author: Blue Swirl -Date: Thu Jan 6 18:24:35 2011 +0000 - - pc: move port 92 stuff back to pc.c from pckbd.c - - 956a3e6bb7386de48b642d4fee11f7f86a2fcf9a introduced a bug concerning - reset bit for port 92. - - Since the keyboard output port and port 92 are not compatible anyway, - let's separate them. - - Reported-by: Peter Lieven - Signed-off-by: Blue Swirl - -- - v2: added reset handler and VMState - -Index: qemu-0.13.0/hw/pc.c -=================================================================== ---- qemu-0.13.0.orig/hw/pc.c 2010-10-16 04:56:09.000000000 +0800 -+++ qemu-0.13.0/hw/pc.c 2011-01-20 20:37:37.000000000 +0800 -@@ -409,11 +409,91 @@ - qemu_register_reset(pc_cmos_init_late, &arg); - } - -+/* port 92 stuff: could be split off */ -+typedef struct Port92State { -+ ISADevice dev; -+ uint8_t outport; -+ qemu_irq *a20_out; -+} Port92State; -+ -+static void port92_write(void *opaque, uint32_t addr, uint32_t val) -+{ -+ Port92State *s = opaque; -+ -+ DPRINTF("port92: write 0x%02x\n", val); -+ s->outport = val; -+ qemu_set_irq(*s->a20_out, (val >> 1) & 1); -+ if (val & 1) { -+ qemu_system_reset_request(); -+ } -+} -+ -+static uint32_t port92_read(void *opaque, uint32_t addr) -+{ -+ Port92State *s = opaque; -+ uint32_t ret; -+ -+ ret = s->outport; -+ DPRINTF("port92: read 0x%02x\n", ret); -+ return ret; -+} -+ -+static void port92_init(ISADevice *dev, qemu_irq *a20_out) -+{ -+ Port92State *s = DO_UPCAST(Port92State, dev, dev); -+ -+ s->a20_out = a20_out; -+} -+ -+static const VMStateDescription vmstate_port92_isa = { -+ .name = "port92", -+ .version_id = 1, -+ .minimum_version_id = 1, -+ .minimum_version_id_old = 1, -+ .fields = (VMStateField []) { -+ VMSTATE_UINT8(outport, Port92State), -+ VMSTATE_END_OF_LIST() -+ } -+}; -+ -+static void port92_reset(DeviceState *d) -+{ -+ Port92State *s = container_of(d, Port92State, dev.qdev); -+ -+ s->outport &= ~1; -+} -+ -+static int port92_initfn(ISADevice *dev) -+{ -+ Port92State *s = DO_UPCAST(Port92State, dev, dev); -+ -+ register_ioport_read(0x92, 1, 1, port92_read, s); -+ register_ioport_write(0x92, 1, 1, port92_write, s); -+ s->outport = 0; -+ return 0; -+} -+ -+static ISADeviceInfo port92_info = { -+ .qdev.name = "port92", -+ .qdev.size = sizeof(Port92State), -+ .qdev.vmsd = &vmstate_port92_isa, -+ .qdev.no_user = 1, -+ .qdev.reset = port92_reset, -+ .init = port92_initfn, -+}; -+ -+static void port92_register(void) -+{ -+ isa_qdev_register(&port92_info); -+} -+device_init(port92_register) -+ - static void handle_a20_line_change(void *opaque, int irq, int level) - { - CPUState *cpu = opaque; - - /* XXX: send to all CPUs ? */ -+ /* XXX: add logic to handle multiple A20 line sources */ - cpu_x86_set_a20(cpu, level); - } - -@@ -1017,7 +1097,7 @@ - PITState *pit; - qemu_irq rtc_irq = NULL; - qemu_irq *a20_line; -- ISADevice *i8042; -+ ISADevice *i8042, *port92; - qemu_irq *cpu_exit_irq; - - register_ioport_write(0x80, 1, 1, ioport80_write, NULL); -@@ -1051,10 +1131,12 @@ - } - } - -- a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 1); -+ a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); - i8042 = isa_create_simple("i8042"); -- i8042_setup_a20_line(i8042, a20_line); -+ i8042_setup_a20_line(i8042, &a20_line[0]); - vmmouse_init(i8042); -+ port92 = isa_create_simple("port92"); -+ port92_init(port92, &a20_line[1]); - - cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); - DMA_init(0, cpu_exit_irq); -Index: qemu-0.13.0/hw/pckbd.c -=================================================================== ---- qemu-0.13.0.orig/hw/pckbd.c 2010-10-16 04:56:09.000000000 +0800 -+++ qemu-0.13.0/hw/pckbd.c 2011-01-20 20:33:44.000000000 +0800 -@@ -209,10 +209,8 @@ - ps2_queue(s->kbd, b); - } - --static void ioport92_write(void *opaque, uint32_t addr, uint32_t val) -+static void outport_write(KBDState *s, uint32_t val) - { -- KBDState *s = opaque; -- - DPRINTF("kbd: write outport=0x%02x\n", val); - s->outport = val; - if (s->a20_out) { -@@ -223,16 +221,6 @@ - } - } - --static uint32_t ioport92_read(void *opaque, uint32_t addr) --{ -- KBDState *s = opaque; -- uint32_t ret; -- -- ret = s->outport; -- DPRINTF("kbd: read outport=0x%02x\n", ret); -- return ret; --} -- - static void kbd_write_command(void *opaque, uint32_t addr, uint32_t val) - { - KBDState *s = opaque; -@@ -340,7 +328,7 @@ - kbd_queue(s, val, 1); - break; - case KBD_CCMD_WRITE_OUTPORT: -- ioport92_write(s, 0, val); -+ outport_write(s, val); - break; - case KBD_CCMD_WRITE_MOUSE: - ps2_write_mouse(s->mouse, val); -@@ -469,8 +457,6 @@ - register_ioport_write(0x60, 1, 1, kbd_write_data, s); - register_ioport_read(0x64, 1, 1, kbd_read_status, s); - register_ioport_write(0x64, 1, 1, kbd_write_command, s); -- register_ioport_read(0x92, 1, 1, ioport92_read, s); -- register_ioport_write(0x92, 1, 1, ioport92_write, s); - - s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s); - s->mouse = ps2_mouse_init(kbd_update_aux_irq, s); diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/powerpc_rom.bin b/meta/recipes-devtools/qemu/qemu-0.13.0/powerpc_rom.bin deleted file mode 100644 index c4044296c5..0000000000 Binary files a/meta/recipes-devtools/qemu/qemu-0.13.0/powerpc_rom.bin and /dev/null differ diff --git a/meta/recipes-devtools/qemu/qemu-0.13.0/qemu-git-qemugl-host.patch b/meta/recipes-devtools/qemu/qemu-0.13.0/qemu-git-qemugl-host.patch deleted file mode 100644 index 085477c575..0000000000 --- a/meta/recipes-devtools/qemu/qemu-0.13.0/qemu-git-qemugl-host.patch +++ /dev/null @@ -1,34364 +0,0 @@ -Index: qemu-0.13.0/Makefile.target -=================================================================== ---- qemu-0.13.0.orig/Makefile.target 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/Makefile.target 2011-01-17 16:42:36.000000000 +0800 -@@ -54,6 +54,7 @@ - libobj-y += cpuid.o - endif - libobj-$(CONFIG_NEED_MMU) += mmu.o -+libobj-$(TARGET_I386) += helper_opengl.o opengl_exec.o - libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o - - libobj-y += disas.o -@@ -76,6 +77,21 @@ - # cpu_signal_handler() in cpu-exec.c. - signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS) - -+parse_gl_h: parse_gl_h.c -+ $(HOST_CC) -g -o $@ $< -+server_stub.c: parse_gl_h -+ ./parse_gl_h -+gl_func.h: parse_gl_h -+ ./parse_gl_h -+GL_CFLAGS := -Wall -g -O2 -fno-strict-aliasing -+opengl_func.h: gl_func.h -+helper_opengl.o: helper_opengl.c opengl_func.h server_stub.c -+ $(CC) $(GL_CFLAGS) $(DEFINES) -c -o $@ $< -I.. -I. -I../fpu -I../target-i386 -DNEED_CPU_H -+gl_beginend.h: ../target-i386/beginend_funcs.sh -+ $< > $@ -+opengl_exec.o : opengl_exec.c server_stub.c gl_func.h opengl_func.h gl_beginend.h -+ $(CC) $(GL_CFLAGS) $(DEFINES) -c -o $@ $< -I. -I../target-i386 -+ - ######################################################### - # Linux user emulator target - -@@ -202,6 +218,10 @@ - obj-i386-y += debugcon.o multiboot.o - obj-i386-y += pc_piix.o - -+ifeq ($(TARGET_BASE_ARCH), i386) -+QEMU_CFLAGS += -DTARGET_OPENGL_OK -+endif -+ - # shared objects - obj-ppc-y = ppc.o - obj-ppc-y += vga.o -@@ -301,6 +321,8 @@ - - monitor.o: qemu-monitor.h - -+LIBS += -lGL -lGLU -+ - $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) - - obj-y += $(addprefix ../, $(common-obj-y)) -Index: qemu-0.13.0/hw/pixel_ops.h -=================================================================== ---- qemu-0.13.0.orig/hw/pixel_ops.h 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/hw/pixel_ops.h 2011-01-17 16:42:36.000000000 +0800 -@@ -4,6 +4,12 @@ - return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6); - } - -+static inline unsigned int rgb_to_pixel8bgr(unsigned int r, unsigned int g, -+ unsigned int b) -+{ -+ return ((b >> 5) << 5) | ((g >> 5) << 2) | (r >> 6); -+} -+ - static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g, - unsigned int b) - { -Index: qemu-0.13.0/hw/vmware_vga.c -=================================================================== ---- qemu-0.13.0.orig/hw/vmware_vga.c 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/hw/vmware_vga.c 2011-01-17 16:42:36.000000000 +0800 -@@ -519,6 +519,8 @@ - - #define CMD(f) le32_to_cpu(s->cmd->f) - -+static uint32_t last_cmd; -+ - static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) - { - if (!s->config || !s->enable) -@@ -528,11 +530,18 @@ - - static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s) - { -- uint32_t cmd = s->fifo[CMD(stop) >> 2]; -- s->cmd->stop = cpu_to_le32(CMD(stop) + 4); -- if (CMD(stop) >= CMD(max)) -+ int offset = CMD(stop); -+ -+ if (unlikely(s->cmd->next_cmd == s->cmd->stop)) { -+ fprintf(stderr, "%s: FIFO empty during CMD %i\n", -+ __FUNCTION__, last_cmd); -+ return 0x00000000; -+ } -+ -+ s->cmd->stop = cpu_to_le32(offset + 4); -+ if (offset + 4 >= CMD(max)) - s->cmd->stop = s->cmd->min; -- return cmd; -+ return s->fifo[offset >> 2]; - } - - static inline uint32_t vmsvga_fifo_read(struct vmsvga_state_s *s) -@@ -542,12 +551,12 @@ - - static void vmsvga_fifo_run(struct vmsvga_state_s *s) - { -- uint32_t cmd, colour; -+ uint32_t colour; - int args = 0; - int x, y, dx, dy, width, height; - struct vmsvga_cursor_definition_s cursor; - while (!vmsvga_fifo_empty(s)) -- switch (cmd = vmsvga_fifo_read(s)) { -+ switch (last_cmd = vmsvga_fifo_read(s)) { - case SVGA_CMD_UPDATE: - case SVGA_CMD_UPDATE_VERBOSE: - x = vmsvga_fifo_read(s); -@@ -654,7 +663,7 @@ - while (args --) - vmsvga_fifo_read(s); - printf("%s: Unknown command 0x%02x in SVGA command FIFO\n", -- __FUNCTION__, cmd); -+ __FUNCTION__, last_cmd); - break; - } - -@@ -1173,6 +1182,12 @@ - - vga_init_vbe(&s->vga); - -+#ifdef EMBED_STDVGA -+ s->vga.map_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS; -+ s->vga.map_end = VBE_DISPI_LFB_PHYSICAL_ADDRESS + vga_ram_size; -+ vga_dirty_log_start(s); -+#endif -+ - rom_add_vga(VGABIOS_FILENAME); - - vmsvga_reset(s); -Index: qemu-0.13.0/qemu-char.c -=================================================================== ---- qemu-0.13.0.orig/qemu-char.c 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/qemu-char.c 2011-01-17 16:42:36.000000000 +0800 -@@ -2278,6 +2278,69 @@ - return NULL; - } - -+#define TARGET_OPENGL_OK -+#if defined(TARGET_OPENGL_OK) -+static uint8_t buffer[32]; -+static int buffer_len; -+static int hexdigit[128] = { -+ ['0'] = 0x0, -+ ['1'] = 0x1, -+ ['2'] = 0x2, -+ ['3'] = 0x3, -+ ['4'] = 0x4, -+ ['5'] = 0x5, -+ ['6'] = 0x6, -+ ['7'] = 0x7, -+ ['8'] = 0x8, -+ ['9'] = 0x9, -+ ['a'] = 0xa, -+ ['b'] = 0xb, -+ ['c'] = 0xc, -+ ['d'] = 0xd, -+ ['e'] = 0xe, -+ ['f'] = 0xf, -+}; -+ -+static int opengl_chr_write(CharDriverState *chr, const uint8_t *buf, int len) -+{ -+ uint64_t ptr = 0; -+ int i; -+ -+ if (memchr(buf, 'x', len)) -+ opengl_process_enable(); -+ return len; -+ memcpy(buffer + buffer_len, buf, len); -+ buffer_len += len; -+ -+ if (buffer_len >= 16) { -+ for (i = 0; i < 16; i ++) -+ ptr = (ptr << 4) + hexdigit[buffer[i]]; -+ -+ buffer_len -= 16; -+ if (buffer_len) -+ memcpy(buffer, buffer + 16, buffer_len); -+ -+ mem_opengl(ptr); -+ } -+ -+ return len; -+} -+ -+CharDriverState *qemu_chr_open_opengl(void) -+{ -+ CharDriverState *chr = qemu_mallocz(sizeof(CharDriverState)); -+ -+ chr->opaque = chr; -+ chr->chr_write = opengl_chr_write; -+ -+ qemu_chr_generic_open(chr); -+ -+ return chr; -+} -+#else -+#define qemu_chr_open_opengl() 0 -+#endif -+ - QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) - { - char host[65], port[33], width[8], height[8]; -@@ -2396,6 +2459,10 @@ - qemu_opt_set(opts, "path", filename); - return opts; - } -+ if (!strcmp(filename, "opengl")){ -+ qemu_opt_set(opts, "backend", "opengl"); -+ return opts; -+ } - - fail: - qemu_opts_del(opts); -@@ -2411,6 +2478,7 @@ - { .name = "udp", .open = qemu_chr_open_udp }, - { .name = "msmouse", .open = qemu_chr_open_msmouse }, - { .name = "vc", .open = text_console_init }, -+ { .name = "opengl", .open = qemu_chr_open_opengl }, - #ifdef _WIN32 - { .name = "file", .open = qemu_chr_open_win_file_out }, - { .name = "pipe", .open = qemu_chr_open_win_pipe }, -Index: qemu-0.13.0/slirp/udp.c -=================================================================== ---- qemu-0.13.0.orig/slirp/udp.c 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/slirp/udp.c 2011-01-17 16:42:36.000000000 +0800 -@@ -40,6 +40,7 @@ - - #include - #include "ip_icmp.h" -+#include "bswap.h" - - static uint8_t udp_tos(struct socket *so); - -@@ -125,6 +126,11 @@ - goto bad; - } - -+ if (ntohs(uh->uh_dport) == 9999 && m->m_len - iphlen == 16) { -+ mem_opengl(le64_to_cpup((uint64_t *) (m->m_data + iphlen + 8))); -+ goto bad; -+ } -+ - if (slirp->restricted) { - goto bad; - } -Index: qemu-0.13.0/sysemu.h -=================================================================== ---- qemu-0.13.0.orig/sysemu.h 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/sysemu.h 2011-01-17 16:42:36.000000000 +0800 -@@ -133,6 +133,7 @@ - extern int old_param; - extern int boot_menu; - extern QEMUClock *rtc_clock; -+extern int force_pointer; - - #define MAX_NODES 64 - extern int nb_numa_nodes; -Index: qemu-0.13.0/target-i386/beginend_funcs.sh -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-i386/beginend_funcs.sh 2011-01-17 16:42:36.000000000 +0800 -@@ -0,0 +1,23 @@ -+#! /bin/sh -+# Copyright 2008 (C) Intel Corporation -+# -+# echo names of functions that are legal between a glBegin and glEnd pair. -+echo -e MAGIC_MACRO\(glVertex{2,3,4}{s,i,f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glTexCoord{1,2,3,4}{s,i,f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glMultiTexCoord{1,2,3,4}{s,i,f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glNormal3{b,s,i,f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glFogCoord{f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glColor{3,4}{b,s,i,f,d,ub,us,ui}{,v}\)\\n -+echo -e MAGIC_MACRO\(glSecondaryColor3{b,s,i,f,d,ub,us,ui}{,v}\)\\n -+echo -e MAGIC_MACRO\(glIndex{s,i,f,d,ub}{,v}\)\\n -+echo -e MAGIC_MACRO\(glVertexAttrib{1,2,3,4}{s,f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glVertexAttrib4{b,i,ub,us,ui}v\)\\n -+echo -e MAGIC_MACRO\(glVertexAttrib4Nub\)\\n -+echo -e MAGIC_MACRO\(glVertexAttrib4N{b,s,i,ub,us,ui}v\)\\n -+echo -e MAGIC_MACRO\(glArrayElement\)\\n -+echo -e MAGIC_MACRO\(glEvalCoord{1,2}{f,d}{,v}\)\\n -+echo -e MAGIC_MACRO\(glEvalPoint{1,2}\)\\n -+echo -e MAGIC_MACRO\(glMaterial{i,f}{,v}\)\\n -+echo -e MAGIC_MACRO\(glCallList\)\\n -+echo -e MAGIC_MACRO\(glCallLists\)\\n -+echo -e MAGIC_MACRO\(glEdgeFlag{,v}\)\\n -Index: qemu-0.13.0/target-i386/ghash.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-i386/ghash.c 2011-01-17 16:42:36.000000000 +0800 -@@ -0,0 +1,347 @@ -+/* This is a modified and simplified version of original ghash.c */ -+ -+/* GLIB - Library of useful routines for C programming -+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+ -+/* -+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS -+ * file for a list of people on the GLib Team. See the ChangeLog -+ * files for a list of changes. These files are distributed with -+ * GLib at ftp://ftp.gtk.org/pub/gtk/. -+ */ -+ -+ -+#include -+ -+#include "ghash.h" -+ -+#define HASH_TABLE_MIN_SIZE 11 -+#define HASH_TABLE_MAX_SIZE 13845163 -+ -+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) -+ -+ -+typedef struct _SimpleHashNode SimpleHashNode; -+ -+struct _SimpleHashNode -+{ -+ int key; -+ void* value; -+ SimpleHashNode *next; -+}; -+ -+struct _SimpleHashTable -+{ -+ int size; -+ int nnodes; -+ SimpleHashNode **nodes; -+ SimpleDestroyNotify value_destroy_func; -+}; -+ -+static const unsigned int simple_primes[] = -+{ -+ 11, -+ 19, -+ 37, -+ 73, -+ 109, -+ 163, -+ 251, -+ 367, -+ 557, -+ 823, -+ 1237, -+ 1861, -+ 2777, -+ 4177, -+ 6247, -+ 9371, -+ 14057, -+ 21089, -+ 31627, -+ 47431, -+ 71143, -+ 106721, -+ 160073, -+ 240101, -+ 360163, -+ 540217, -+ 810343, -+ 1215497, -+ 1823231, -+ 2734867, -+ 4102283, -+ 6153409, -+ 9230113, -+ 13845163, -+}; -+ -+static const unsigned int simple_nprimes = sizeof (simple_primes) / sizeof (simple_primes[0]); -+ -+unsigned int simple_spaced_primes_closest (unsigned int num) -+{ -+ int i; -+ -+ for (i = 0; i < simple_nprimes; i++) -+ if (simple_primes[i] > num) -+ return simple_primes[i]; -+ -+ return simple_primes[simple_nprimes - 1]; -+} -+ -+#define HASH_TABLE_RESIZE(hash_table) \ -+ do { \ -+ if ((hash_table->size >= 3 * hash_table->nnodes && \ -+ hash_table->size > HASH_TABLE_MIN_SIZE) || \ -+ (3 * hash_table->size <= hash_table->nnodes && \ -+ hash_table->size < HASH_TABLE_MAX_SIZE)) \ -+ simple_hash_table_resize (hash_table); \ -+ } while(0) -+ -+static void simple_hash_table_resize (SimpleHashTable *hash_table); -+static SimpleHashNode** simple_hash_table_lookup_node (SimpleHashTable *hash_table, -+ int key); -+static SimpleHashNode* simple_hash_node_new (int key, -+ void* value); -+static void simple_hash_nodes_destroy (SimpleHashNode *hash_node, -+ SimpleDestroyNotify value_destroy_func); -+ -+ -+#define alloc0(type, n) (type*)calloc(n, sizeof(type)) -+ -+SimpleHashTable* -+simple_hash_table_new (SimpleDestroyNotify value_destroy_func) -+{ -+ SimpleHashTable *hash_table; -+ -+ hash_table = alloc0(SimpleHashTable, 1); -+ hash_table->size = HASH_TABLE_MIN_SIZE; -+ hash_table->nnodes = 0; -+ hash_table->value_destroy_func = value_destroy_func; -+ hash_table->nodes = alloc0 (SimpleHashNode*, hash_table->size); -+ -+ return hash_table; -+} -+ -+SimpleHashTable* simple_hash_table_clone(SimpleHashTable *hash_table, -+ SimpleCloneValue clone_value_func) -+{ -+ SimpleHashTable *hash_table_new; -+ SimpleHashNode *new_node; -+ SimpleHashNode *node; -+ int i; -+ -+ hash_table_new = alloc0 (SimpleHashTable, 1); -+ hash_table_new->size = hash_table->size; -+ hash_table_new->nnodes = hash_table->nnodes; -+ hash_table_new->value_destroy_func = hash_table->value_destroy_func; -+ hash_table_new->nodes = alloc0 (SimpleHashNode*, hash_table_new->size); -+ for (i = 0; i < hash_table->size; i++) -+ { -+ node = hash_table->nodes[i]; -+ while(node) -+ { -+ SimpleHashNode *next = hash_table_new->nodes[i]; -+ new_node = simple_hash_node_new(node->key, -+ (clone_value_func)? clone_value_func(node->value) : node->value); -+ new_node->next = next; -+ hash_table_new->nodes[i] = new_node; -+ node = node->next; -+ } -+ } -+ return hash_table_new; -+} -+ -+void -+simple_hash_table_destroy (SimpleHashTable *hash_table) -+{ -+ int i; -+ -+ for (i = 0; i < hash_table->size; i++) -+ { -+ simple_hash_nodes_destroy (hash_table->nodes[i], -+ hash_table->value_destroy_func); -+ hash_table->nodes[i] = NULL; -+ } -+ free (hash_table->nodes); -+ free (hash_table); -+} -+ -+static inline SimpleHashNode** -+simple_hash_table_lookup_node (SimpleHashTable *hash_table, -+ int key) -+{ -+ SimpleHashNode **node; -+ -+ node = &hash_table->nodes[(unsigned int)key % hash_table->size]; -+ while (*node && (*node)->key != key) -+ node = &(*node)->next; -+ -+ return node; -+} -+ -+void* -+simple_hash_table_lookup (SimpleHashTable *hash_table, int key) -+{ -+ SimpleHashNode *node; -+ -+ node = *simple_hash_table_lookup_node (hash_table, key); -+ -+ return node ? node->value : NULL; -+} -+ -+void** -+simple_hash_table_lookup_pointer (SimpleHashTable *hash_table, int key) -+{ -+ SimpleHashNode *node; -+ -+ node = *simple_hash_table_lookup_node (hash_table, key); -+ -+ return node ? &node->value : NULL; -+} -+ -+ -+void -+simple_hash_table_insert (SimpleHashTable *hash_table, -+ int key, -+ void* value) -+{ -+ SimpleHashNode **node; -+ -+ node = simple_hash_table_lookup_node (hash_table, key); -+ -+ if (*node) -+ { -+ /* do not reset node->key in this place, keeping -+ * the old key is the intended behaviour. -+ * simple_hash_table_replace() can be used instead. -+ */ -+ if (hash_table->value_destroy_func) -+ hash_table->value_destroy_func ((*node)->value); -+ -+ (*node)->value = value; -+ } -+ else -+ { -+ *node = simple_hash_node_new (key, value); -+ hash_table->nnodes++; -+ HASH_TABLE_RESIZE (hash_table); -+ } -+} -+int -+simple_hash_table_remove (SimpleHashTable *hash_table, -+ int key) -+{ -+ SimpleHashNode **node, *dest; -+ -+ node = simple_hash_table_lookup_node (hash_table, key); -+ if (*node) -+ { -+ dest = *node; -+ (*node) = dest->next; -+ if (hash_table->value_destroy_func) -+ hash_table->value_destroy_func (dest->value); -+ free (dest); -+ hash_table->nnodes--; -+ -+ HASH_TABLE_RESIZE (hash_table); -+ -+ return 1; -+ } -+ -+ return 0; -+} -+ -+ -+void -+simple_hash_table_foreach (SimpleHashTable *hash_table, -+ SimpleHFunc func, -+ void* user_data) -+{ -+ SimpleHashNode *node; -+ int i; -+ -+ for (i = 0; i < hash_table->size; i++) -+ for (node = hash_table->nodes[i]; node; node = node->next) -+ (* func) (node->key, node->value, user_data); -+} -+ -+unsigned int -+simple_hash_table_size (SimpleHashTable *hash_table) -+{ -+ return hash_table->nnodes; -+} -+ -+static void -+simple_hash_table_resize (SimpleHashTable *hash_table) -+{ -+ SimpleHashNode **new_nodes; -+ SimpleHashNode *node; -+ SimpleHashNode *next; -+ unsigned int hash_val; -+ int new_size; -+ int i; -+ -+ new_size = simple_spaced_primes_closest (hash_table->nnodes); -+ new_size = CLAMP (new_size, HASH_TABLE_MIN_SIZE, HASH_TABLE_MAX_SIZE); -+ -+ new_nodes = alloc0 (SimpleHashNode*, new_size); -+ -+ for (i = 0; i < hash_table->size; i++) -+ for (node = hash_table->nodes[i]; node; node = next) -+ { -+ next = node->next; -+ -+ hash_val = (unsigned int)(node->key) % new_size; -+ -+ node->next = new_nodes[hash_val]; -+ new_nodes[hash_val] = node; -+ } -+ -+ free (hash_table->nodes); -+ hash_table->nodes = new_nodes; -+ hash_table->size = new_size; -+} -+ -+static SimpleHashNode* -+simple_hash_node_new (int key, -+ void* value) -+{ -+ SimpleHashNode *hash_node = alloc0 (SimpleHashNode, 1); -+ -+ hash_node->key = key; -+ hash_node->value = value; -+ hash_node->next = NULL; -+ -+ return hash_node; -+} -+ -+static void -+simple_hash_nodes_destroy (SimpleHashNode *hash_node, -+ SimpleDestroyNotify value_destroy_func) -+{ -+ while (hash_node) -+ { -+ SimpleHashNode *next = hash_node->next; -+ if (value_destroy_func) -+ value_destroy_func (hash_node->value); -+ free (hash_node); -+ hash_node = next; -+ } -+} -Index: qemu-0.13.0/target-i386/ghash.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-i386/ghash.h 2011-01-17 16:42:36.000000000 +0800 -@@ -0,0 +1,59 @@ -+/* This is a modified and simplified version of original ghash.h */ -+ -+ -+/* GLIB - Library of useful routines for C programming -+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+ -+/* -+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS -+ * file for a list of people on the GLib Team. See the ChangeLog -+ * files for a list of changes. These files are distributed with -+ * GLib at ftp://ftp.gtk.org/pub/gtk/. -+ */ -+ -+#ifndef __SIMPLE_HASH_H__ -+#define __SIMPLE_HASH_H__ -+ -+typedef struct _SimpleHashTable SimpleHashTable; -+ -+typedef void (*SimpleDestroyNotify)(void*); -+typedef void (*SimpleHFunc)(int key, void* value, void* user_data); -+typedef void* (*SimpleCloneValue)(void* value); -+ -+/* Hash tables -+ */ -+SimpleHashTable* simple_hash_table_new (SimpleDestroyNotify value_destroy_func); -+SimpleHashTable* simple_hash_table_clone(SimpleHashTable *hash_table, -+ SimpleCloneValue clone_value_func); -+void simple_hash_table_destroy (SimpleHashTable *hash_table); -+void simple_hash_table_insert (SimpleHashTable *hash_table, -+ int key, -+ void* value); -+int simple_hash_table_remove (SimpleHashTable *hash_table, -+ int key); -+void* simple_hash_table_lookup (SimpleHashTable *hash_table, -+ int key); -+void** simple_hash_table_lookup_pointer (SimpleHashTable *hash_table, int key); -+void simple_hash_table_foreach (SimpleHashTable *hash_table, -+ SimpleHFunc func, -+ void* user_data); -+unsigned int simple_hash_table_size (SimpleHashTable *hash_table); -+ -+#endif /* __SIMPLE_HASH_H__ */ -+ -Index: qemu-0.13.0/target-i386/gl_func_perso.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-i386/gl_func_perso.h 2011-01-17 16:42:36.000000000 +0800 -@@ -0,0 +1,135 @@ -+/* -+ * Hand-implemented GL/GLX API -+ * -+ * Copyright (c) 2006,2007 Even Rouault -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this software and associated documentation files (the "Software"), to deal -+ * in the Software without restriction, including without limitation the rights -+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+ * copies of the Software, and to permit persons to whom the Software is -+ * furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -+ * THE SOFTWARE. -+ */ -+ -+MAGIC_MACRO(_init32), -+MAGIC_MACRO(_init64), -+MAGIC_MACRO(_synchronize), -+MAGIC_MACRO(_serialized_calls), -+MAGIC_MACRO(_exit_process), -+MAGIC_MACRO(_moveResizeWindow), -+MAGIC_MACRO(_changeWindowState), -+MAGIC_MACRO(_send_cursor), -+ -+/* When you add a glX call here, you HAVE TO update IS_GLX_CALL */ -+MAGIC_MACRO(glXChooseVisual), -+MAGIC_MACRO(glXQueryExtensionsString), -+MAGIC_MACRO(glXQueryServerString), -+MAGIC_MACRO(glXCreateContext), -+MAGIC_MACRO(glXCopyContext), -+MAGIC_MACRO(glXDestroyContext), -+MAGIC_MACRO(glXGetClientString), -+MAGIC_MACRO(glXQueryVersion), -+MAGIC_MACRO(glXMakeCurrent), -+MAGIC_MACRO(glXGetConfig), -+MAGIC_MACRO(glXGetConfig_extended), -+MAGIC_MACRO(glXWaitGL), -+MAGIC_MACRO(glXWaitX), -+MAGIC_MACRO(glXGetFBConfigAttrib_extended), -+MAGIC_MACRO(glXChooseFBConfig), -+MAGIC_MACRO(glXChooseFBConfigSGIX), -+MAGIC_MACRO(glXGetFBConfigs), -+MAGIC_MACRO(glXCreatePbuffer), -+MAGIC_MACRO(glXCreateGLXPbufferSGIX), -+MAGIC_MACRO(glXDestroyPbuffer), -+MAGIC_MACRO(glXDestroyGLXPbufferSGIX), -+MAGIC_MACRO(glXCreateNewContext), -+MAGIC_MACRO(glXCreateContextWithConfigSGIX), -+MAGIC_MACRO(glXGetVisualFromFBConfig), -+MAGIC_MACRO(glXGetFBConfigAttrib), -+MAGIC_MACRO(glXGetFBConfigAttribSGIX), -+MAGIC_MACRO(glXQueryContext), -+MAGIC_MACRO(glXQueryDrawable), -+MAGIC_MACRO(glXQueryGLXPbufferSGIX), -+MAGIC_MACRO(glXUseXFont), -+MAGIC_MACRO(glXIsDirect), -+MAGIC_MACRO(glXGetProcAddress_fake), -+MAGIC_MACRO(glXGetProcAddress_global_fake), -+MAGIC_MACRO(glXSwapBuffers), -+MAGIC_MACRO(glXQueryExtension), -+MAGIC_MACRO(glXGetScreenDriver), -+MAGIC_MACRO(glXGetDriverConfig), -+MAGIC_MACRO(glXSwapIntervalSGI), -+MAGIC_MACRO(glXBindTexImageATI), -+MAGIC_MACRO(glXReleaseTexImageATI), -+MAGIC_MACRO(glXBindTexImageARB), -+MAGIC_MACRO(glXReleaseTexImageARB), -+ -+MAGIC_MACRO(glGetString), -+ -+MAGIC_MACRO(glShaderSourceARB_fake), -+MAGIC_MACRO(glShaderSource_fake), -+MAGIC_MACRO(glVertexPointer_fake), -+MAGIC_MACRO(glNormalPointer_fake), -+MAGIC_MACRO(glColorPointer_fake), -+MAGIC_MACRO(glSecondaryColorPointer_fake), -+MAGIC_MACRO(glIndexPointer_fake), -+MAGIC_MACRO(glTexCoordPointer_fake), -+MAGIC_MACRO(glEdgeFlagPointer_fake), -+MAGIC_MACRO(glVertexAttribPointerARB_fake), -+MAGIC_MACRO(glVertexAttribPointerNV_fake), -+MAGIC_MACRO(glWeightPointerARB_fake), -+MAGIC_MACRO(glMatrixIndexPointerARB_fake), -+MAGIC_MACRO(glFogCoordPointer_fake), -+MAGIC_MACRO(glVariantPointerEXT_fake), -+MAGIC_MACRO(glInterleavedArrays_fake), -+MAGIC_MACRO(glElementPointerATI_fake), -+MAGIC_MACRO(glTuxRacerDrawElements_fake), -+MAGIC_MACRO(glVertexAndNormalPointer_fake), -+MAGIC_MACRO(glTexCoordPointer01_fake), -+MAGIC_MACRO(glTexCoordPointer012_fake), -+MAGIC_MACRO(glVertexNormalPointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalColorPointerInterlaced_fake), -+MAGIC_MACRO(glVertexColorTexCoord0PointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalTexCoord0PointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalTexCoord01PointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalTexCoord012PointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalColorTexCoord0PointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalColorTexCoord01PointerInterlaced_fake), -+MAGIC_MACRO(glVertexNormalColorTexCoord012PointerInterlaced_fake), -+MAGIC_MACRO(glGenTextures_fake), -+MAGIC_MACRO(glGenBuffersARB_fake), -+MAGIC_MACRO(glGenLists_fake), -+MAGIC_MACRO(_glDrawElements_buffer), -+MAGIC_MACRO(_glDrawRangeElements_buffer), -+MAGIC_MACRO(_glMultiDrawElements_buffer), -+MAGIC_MACRO(_glVertexPointer_buffer), -+MAGIC_MACRO(_glNormalPointer_buffer), -+MAGIC_MACRO(_glColorPointer_buffer), -+MAGIC_MACRO(_glSecondaryColorPointer_buffer), -+MAGIC_MACRO(_glIndexPointer_buffer), -+MAGIC_MACRO(_glTexCoordPointer_buffer), -+MAGIC_MACRO(_glEdgeFlagPointer_buffer), -+MAGIC_MACRO(_glVertexAttribPointerARB_buffer), -+MAGIC_MACRO(_glWeightPointerARB_buffer), -+MAGIC_MACRO(_glMatrixIndexPointerARB_buffer), -+MAGIC_MACRO(_glFogCoordPointer_buffer), -+MAGIC_MACRO(_glVariantPointerEXT_buffer), -+MAGIC_MACRO(_glGetError_fake), -+MAGIC_MACRO(_glReadPixels_pbo), -+MAGIC_MACRO(_glDrawPixels_pbo), -+MAGIC_MACRO(_glMapBufferARB_fake), -+MAGIC_MACRO(_glSelectBuffer_fake), -+MAGIC_MACRO(_glGetSelectBuffer_fake), -+MAGIC_MACRO(_glFeedbackBuffer_fake), -+MAGIC_MACRO(_glGetFeedbackBuffer_fake), -Index: qemu-0.13.0/target-i386/helper.c -=================================================================== ---- qemu-0.13.0.orig/target-i386/helper.c 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/target-i386/helper.c 2011-01-17 16:42:36.000000000 +0800 -@@ -914,7 +914,7 @@ - } - - page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1); -- paddr = (pte & TARGET_PAGE_MASK) + page_offset; -+ paddr = (pte & PHYS_ADDR_MASK) + page_offset; - return paddr; - } - -Index: qemu-0.13.0/target-i386/helper.h -=================================================================== ---- qemu-0.13.0.orig/target-i386/helper.h 2011-01-17 16:41:59.000000000 +0800 -+++ qemu-0.13.0/target-i386/helper.h 2011-01-17 16:42:36.000000000 +0800 -@@ -217,4 +217,6 @@ - DEF_HELPER_2(rcrq, tl, tl, tl) - #endif - -+DEF_HELPER_0(opengl, void) -+ - #include "def-helper.h" -Index: qemu-0.13.0/target-i386/helper_opengl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu-0.13.0/target-i386/helper_opengl.c 2011-01-17 16:44:27.000000000 +0800 -@@ -0,0 +1,1207 @@ -+/* -+ * Host-side implementation of GL/GLX API -+ * -+ * Copyright (c) 2006,2007 Even Rouault -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this software and associated documentation files (the "Software"), to deal -+ * in the Software without restriction, including without limitation the rights -+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+ * copies of the Software, and to permit persons to whom the Software is -+ * furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -+ * THE SOFTWARE. -+ */ -+#define _XOPEN_SOURCE 600 -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "exec.h" -+ -+#if defined(CONFIG_USER_ONLY) -+void helper_opengl(void) -+{ -+ /* TODO */ -+} -+#else -+ -+#include "opengl_func.h" -+ -+#define ENABLE_GL_LOG -+ -+extern FILE *stderr; -+ -+extern void init_process_tab(void); -+extern int do_function_call(int func_number, arg_t *args, char *ret_string); -+ -+extern void sdl_set_opengl_window(int x, int y, int width, int height); -+ -+static int last_process_id = 0; -+static int must_save = 0; -+ -+static int allow_kernel = 0; -+ -+static inline void *get_phys_mem_addr(const CPUState *env, target_ulong addr) -+{ -+ int is_user, index; -+ -+ index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); -+ is_user = ((env->hflags & HF_CPL_MASK) == 3); -+ /* A sanity check for the int0x99 case */ -+ if (unlikely(is_user == 0 && !allow_kernel)) { -+ fprintf(stderr, "not in userland !!!\n"); -+ return NULL; -+ } -+ if (__builtin_expect -+ (env->tlb_table[is_user][index].addr_code != -+ (addr & TARGET_PAGE_MASK), 0)) { -+ target_ulong ret = cpu_get_phys_page_debug((CPUState *) env, addr); -+ -+ if (ret == -1) { -+ fprintf(stderr, -+ "cpu_get_phys_page_debug(env, " TARGET_FMT_lx ") == " -+ TARGET_FMT_lx "\n", addr, ret); -+ fprintf(stderr, -+ "not in phys mem " TARGET_FMT_lx "(" TARGET_FMT_lx " " -+ TARGET_FMT_lx ")\n", addr, -+ env->tlb_table[is_user][index].addr_code, -+ addr & TARGET_PAGE_MASK); -+ fprintf(stderr, "cpu_x86_handle_mmu_fault = %d\n", -+ cpu_x86_handle_mmu_fault((CPUState *) env, addr, 0, 1, 1)); -+ return NULL; -+ } else { -+ if (ret + TARGET_PAGE_SIZE <= ram_bytes_total()) { -+ return qemu_get_ram_ptr(ret + -+ (((target_ulong) addr) & (TARGET_PAGE_SIZE - 1))); -+ } else { -+ fprintf(stderr, -+ "cpu_get_phys_page_debug(env, " TARGET_FMT_lx ") == " -+ TARGET_FMT_lx "\n", addr, ret); -+ fprintf(stderr, -+ "ret=" TARGET_FMT_lx " last_ram_offset= " TARGET_FMT_lx -+ "\n", ret, (target_ulong) ram_bytes_total()); -+ return NULL; -+ } -+ } -+ } else -+ return (void *) (addr + env->tlb_table[is_user][index].addend); -+} -+ -+#ifndef MIN -+#define MIN(a, b) (((a) < (b)) ? (a) : (b)) -+#endif -+ -+enum { -+ NOT_MAPPED, -+ MAPPED_CONTIGUOUS, -+ MAPPED_NOT_CONTIGUOUS -+}; -+ -+#define TARGET_ADDR_LOW_ALIGN(x) ((target_ulong)(x) & ~(TARGET_PAGE_SIZE - 1)) -+ -+/* Return NOT_MAPPED if a page is not mapped into target physical memory */ -+/* MAPPED_CONTIGUOUS if all pages are mapped into target physical memory and contiguous */ -+/* MAPPED_NOT_CONTIGUOUS if all pages are mapped into target physical memory but not contiguous */ -+static int get_target_mem_state(const CPUState *env, -+ target_ulong target_addr, int len) -+{ -+ target_ulong aligned_target_addr = TARGET_ADDR_LOW_ALIGN(target_addr); -+ int to_end_page = -+ (long) aligned_target_addr + TARGET_PAGE_SIZE - (long) target_addr; -+ int ret = MAPPED_CONTIGUOUS; -+ -+ if (aligned_target_addr != target_addr) { -+ void *phys_addr = get_phys_mem_addr(env, aligned_target_addr); -+ void *last_phys_addr = phys_addr; -+ -+ if (phys_addr == 0) { -+ return NOT_MAPPED; -+ } -+ if (len > to_end_page) { -+ len -= to_end_page; -+ aligned_target_addr += TARGET_PAGE_SIZE; -+ int i; -+ -+ for (i = 0; i < len; i += TARGET_PAGE_SIZE) { -+ void *phys_addr = -+ get_phys_mem_addr(env, aligned_target_addr + i); -+ if (phys_addr == 0) { -+ return NOT_MAPPED; -+ } -+ if (phys_addr != last_phys_addr + TARGET_PAGE_SIZE) -+ ret = MAPPED_NOT_CONTIGUOUS; -+ last_phys_addr = phys_addr; -+ } -+ } -+ } else { -+ void *last_phys_addr = NULL; -+ int i; -+ -+ for (i = 0; i < len; i += TARGET_PAGE_SIZE) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr + i); -+ -+ if (phys_addr == 0) { -+ return NOT_MAPPED; -+ } -+ if (i != 0 && phys_addr != last_phys_addr + TARGET_PAGE_SIZE) -+ ret = MAPPED_NOT_CONTIGUOUS; -+ last_phys_addr = phys_addr; -+ } -+ } -+ return ret; -+} -+ -+/* copy len bytes from host memory at addr host_addr to target memory at logical addr target_addr */ -+/* Returns 1 if successfull, 0 if some target pages are not mapped into target physical memory */ -+static int memcpy_host_to_target(const CPUState *env, -+ target_ulong target_addr, -+ const void *host_addr, int len) -+{ -+ int i; -+ target_ulong aligned_target_addr = TARGET_ADDR_LOW_ALIGN(target_addr); -+ int to_end_page = -+ (long) aligned_target_addr + TARGET_PAGE_SIZE - (long) target_addr; -+ int ret = get_target_mem_state(env, target_addr, len); -+ -+ if (ret == NOT_MAPPED) { -+ return 0; -+ } -+ -+ if (ret == MAPPED_CONTIGUOUS) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr); -+ -+ memcpy(phys_addr, host_addr, len); -+ } else { -+ if (aligned_target_addr != target_addr) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr); -+ -+ memcpy(phys_addr, host_addr, MIN(len, to_end_page)); -+ if (len <= to_end_page) { -+ return 1; -+ } -+ len -= to_end_page; -+ host_addr += to_end_page; -+ target_addr = aligned_target_addr + TARGET_PAGE_SIZE; -+ } -+ for (i = 0; i < len; i += TARGET_PAGE_SIZE) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr + i); -+ -+ memcpy(phys_addr, host_addr + i, -+ (i + TARGET_PAGE_SIZE <= -+ len) ? TARGET_PAGE_SIZE : len & (TARGET_PAGE_SIZE - 1)); -+ } -+ } -+ -+ return 1; -+} -+ -+static int memcpy_target_to_host(const CPUState *env, void *host_addr, -+ target_ulong target_addr, int len) -+{ -+ int i; -+ target_ulong aligned_target_addr = TARGET_ADDR_LOW_ALIGN(target_addr); -+ int to_end_page = -+ (long) aligned_target_addr + TARGET_PAGE_SIZE - (long) target_addr; -+ int ret = get_target_mem_state(env, target_addr, len); -+ -+ if (ret == NOT_MAPPED) { -+ return 0; -+ } -+ -+ if (ret == MAPPED_CONTIGUOUS) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr); -+ -+ memcpy(host_addr, phys_addr, len); -+ } else { -+ if (aligned_target_addr != target_addr) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr); -+ -+ memcpy(host_addr, phys_addr, MIN(len, to_end_page)); -+ if (len <= to_end_page) -+ return 1; -+ -+ len -= to_end_page; -+ host_addr += to_end_page; -+ target_addr = aligned_target_addr + TARGET_PAGE_SIZE; -+ } -+ for (i = 0; i < len; i += TARGET_PAGE_SIZE) { -+ void *phys_addr = get_phys_mem_addr(env, target_addr + i); -+ -+ memcpy(host_addr + i, phys_addr, -+ (i + TARGET_PAGE_SIZE <= -+ len) ? TARGET_PAGE_SIZE : len & (TARGET_PAGE_SIZE - 1)); -+ } -+ } -+ -+ return 1; -+} -+ -+static int memcpy_target_to_host_1_1(const CPUState *env, void *host_addr, -+ target_ulong target_addr, int nb_args) -+{ -+ return memcpy_target_to_host(env, host_addr, target_addr, nb_args * 8); -+} -+ -+static int wordsize = 0; -+static int (*argcpy_target_to_host) (const CPUState *env, void *host_addr, -+ target_ulong target_addr, int nb_args) = -+ memcpy_target_to_host_1_1; -+ -+void do_disconnect_current(void); -+void do_context_switch(Display *dpy, pid_t pid, int call); -+ -+static void disconnect_current(void) -+{ -+ last_process_id = 0; -+ -+ return do_disconnect_current(); -+} -+ -+static int memcpy_target32_to_host(const CPUState *env, void *host_addr, -+ target_ulong target_addr, int nb_args) -+{ -+ int ret; -+ uint32_t args_temp[nb_args], *src = args_temp; -+ arg_t *dest = host_addr; -+ -+ ret = memcpy_target_to_host(env, args_temp, target_addr, nb_args * 4); -+ if (!ret) -+ return ret; -+ -+ while (nb_args) { -+ /* TODO: endianness */ -+ *dest = 0; -+ *(uint32_t *) (dest++) = *src++; -+ nb_args--; -+ } -