summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorZhai Edwin <edwin.zhai@intel.com>2011-05-10 14:02:35 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-11 16:48:05 +0100
commit9b80846152931bed018f33baaaf1ba253e756867 (patch)
treec2e872e000182926bcb1d1f6445d1d2b74b06e6f /meta
parent7aca3963e9c326e07b58240c3e5c9e2cc6eaf99e (diff)
downloadopenembedded-core-9b80846152931bed018f33baaaf1ba253e756867.tar.gz
openembedded-core-9b80846152931bed018f33baaaf1ba253e756867.tar.bz2
openembedded-core-9b80846152931bed018f33baaaf1ba253e756867.zip
qemu: Upgrade qemu git to the latest 0.14 branch
Also add missing patch to build qemu-git [YOCTO #1013] got fixed Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/enable-i386-linux-user.patch53
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/fix-nogl.patch125
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/linker-flags.patch22
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/no-strip.patch13
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/qemu-git-qemugl-host.patch34366
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/qemu-vmware-vga-depth.patch115
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/qemugl-allow-glxcontext-release.patch63
-rw-r--r--meta/recipes-devtools/qemu/qemu-git/qemugl-fix.patch73
-rw-r--r--meta/recipes-devtools/qemu/qemu_git.bb13
9 files changed, 34837 insertions, 6 deletions
diff --git a/meta/recipes-devtools/qemu/qemu-git/enable-i386-linux-user.patch b/meta/recipes-devtools/qemu/qemu-git/enable-i386-linux-user.patch
new file mode 100644
index 0000000000..3cf0953f10
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-git/enable-i386-linux-user.patch
@@ -0,0 +1,53 @@
+Enable i386-linux-user
+
+Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
+
+Index: qemu-0.14.0/Makefile.target
+===================================================================
+--- qemu-0.14.0.orig/Makefile.target
++++ qemu-0.14.0/Makefile.target
+@@ -78,8 +78,13 @@ ifeq ($(TARGET_BASE_ARCH), i386)
+ 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.14.0/target-i386/dummygl.c
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-i386/dummygl.c
+@@ -0,0 +1,26 @@
++#include <string.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <stdint.h>
++#include <X11/Xlib.h>
++#include <X11/Xutil.h>
++
++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-git/fix-nogl.patch b/meta/recipes-devtools/qemu/qemu-git/fix-nogl.patch
new file mode 100644
index 0000000000..0219cc8121
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-git/fix-nogl.patch
@@ -0,0 +1,125 @@
+Index: qemu-0.14.0/Makefile.target
+===================================================================
+--- qemu-0.14.0.orig/Makefile.target
++++ qemu-0.14.0/Makefile.target
+@@ -79,6 +79,12 @@ libobj-y += cpuid.o
+ 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_MIPS64) += dummygl.o
++libobj-$(TARGET_PPC) += dummygl.o
++libobj-$(TARGET_SH4) += dummygl.o
+ libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
+
+ libobj-y += disas.o
+Index: qemu-0.14.0/target-arm/dummygl.c
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-arm/dummygl.c
+@@ -0,0 +1,22 @@
++#include <string.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <stdint.h>
++#include <X11/Xlib.h>
++#include <X11/Xutil.h>
++
++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.14.0/target-mips/dummygl.c
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-mips/dummygl.c
+@@ -0,0 +1,22 @@
++#include <string.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <stdint.h>
++#include <X11/Xlib.h>
++#include <X11/Xutil.h>
++
++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.14.0/target-ppc/dummygl.c
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-ppc/dummygl.c
+@@ -0,0 +1,22 @@
++#include <string.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <stdint.h>
++#include <X11/Xlib.h>
++#include <X11/Xutil.h>
++
++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.14.0/target-sh4/dummygl.c
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-sh4/dummygl.c
+@@ -0,0 +1,22 @@
++#include <string.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <stdint.h>
++#include <X11/Xlib.h>
++#include <X11/Xutil.h>
++
++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-git/linker-flags.patch b/meta/recipes-devtools/qemu/qemu-git/linker-flags.patch
new file mode 100644
index 0000000000..470cf80cde
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-git/linker-flags.patch
@@ -0,0 +1,22 @@
+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.14.0/Makefile.target
+===================================================================
+--- qemu-0.14.0.orig/Makefile.target
++++ qemu-0.14.0/Makefile.target
+@@ -218,7 +218,7 @@ obj-$(CONFIG_REALLY_VIRTFS) += virtio-9p
+ 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-git/no-strip.patch b/meta/recipes-devtools/qemu/qemu-git/no-strip.patch
new file mode 100644
index 0000000000..cf0d659724
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-git/no-strip.patch
@@ -0,0 +1,13 @@
+Index: qemu-0.14.0/Makefile
+===================================================================
+--- qemu-0.14.0.orig/Makefile
++++ qemu-0.14.0/Makefile
+@@ -235,7 +235,7 @@ install-sysconfig:
+ 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)"
diff --git a/meta/recipes-devtools/qemu/qemu-git/qemu-git-qemugl-host.patch b/meta/recipes-devtools/qemu/qemu-git/qemu-git-qemugl-host.patch
new file mode 100644
index 0000000000..92467a7651
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-git/qemu-git-qemugl-host.patch
@@ -0,0 +1,34366 @@
+Index: qemu-0.14.0/Makefile.target
+===================================================================
+--- qemu-0.14.0.orig/Makefile.target
++++ qemu-0.14.0/Makefile.target
+@@ -78,6 +78,7 @@ ifeq ($(TARGET_BASE_ARCH), i386)
+ 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
+@@ -100,6 +101,21 @@ op_helper.o cpu-exec.o: QEMU_CFLAGS += $
+ # 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
+
+@@ -221,6 +237,10 @@ obj-i386-y += debugcon.o multiboot.o
+ obj-i386-y += pc_piix.o
+ obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+
++ifeq ($(TARGET_BASE_ARCH), i386)
++QEMU_CFLAGS += -DTARGET_OPENGL_OK
++endif
++
+ # shared objects
+ obj-ppc-y = ppc.o
+ obj-ppc-y += vga.o
+@@ -331,6 +351,8 @@ main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
+
+ monitor.o: hmp-commands.h qmp-commands.h
+
++LIBS += -lGL -lGLU
++
+ $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
+
+ obj-y += $(addprefix ../, $(common-obj-y))
+Index: qemu-0.14.0/hw/pixel_ops.h
+===================================================================
+--- qemu-0.14.0.orig/hw/pixel_ops.h
++++ qemu-0.14.0/hw/pixel_ops.h
+@@ -4,6 +4,12 @@ static inline unsigned int rgb_to_pixel8
+ 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.14.0/hw/vmware_vga.c
+===================================================================
+--- qemu-0.14.0.orig/hw/vmware_vga.c
++++ qemu-0.14.0/hw/vmware_vga.c
+@@ -517,6 +517,8 @@ static inline void vmsvga_cursor_define(
+
+ #define CMD(f) le32_to_cpu(s->cmd->f)
+
++static uint32_t last_cmd;
++
+ static inline int vmsvga_fifo_length(struct vmsvga_state_s *s)
+ {
+ int num;
+@@ -530,11 +532,18 @@ static inline int vmsvga_fifo_length(str
+
+ 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)
+@@ -544,7 +553,7 @@ static inline uint32_t vmsvga_fifo_read(
+
+ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
+ {
+- uint32_t cmd, colour;
++ uint32_t colour;
+ int args, len;
+ int x, y, dx, dy, width, height;
+ struct vmsvga_cursor_definition_s cursor;
+@@ -555,7 +564,7 @@ static void vmsvga_fifo_run(struct vmsvg
+ /* May need to go back to the start of the command if incomplete */
+ cmd_start = s->cmd->stop;
+
+- switch (cmd = vmsvga_fifo_read(s)) {
++ switch (last_cmd = vmsvga_fifo_read(s)) {
+ case SVGA_CMD_UPDATE:
+ case SVGA_CMD_UPDATE_VERBOSE:
+ len -= 5;
+@@ -695,7 +704,7 @@ static void vmsvga_fifo_run(struct vmsvg
+ while (args --)
+ vmsvga_fifo_read(s);
+ printf("%s: Unknown command 0x%02x in SVGA command FIFO\n",
+- __FUNCTION__, cmd);
++ __FUNCTION__, last_cmd);
+ break;
+
+ rewind:
+@@ -1216,6 +1225,11 @@ static void vmsvga_init(struct vmsvga_st
+ vga_common_init(&s->vga, vga_ram_size);
+ vga_init(&s->vga);
+ vmstate_register(NULL, 0, &vmstate_vga_common, &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
+
+ vmsvga_reset(s);
+ }
+Index: qemu-0.14.0/qemu-char.c
+===================================================================
+--- qemu-0.14.0.orig/qemu-char.c
++++ qemu-0.14.0/qemu-char.c
+@@ -2334,6 +2334,69 @@ size_t qemu_chr_mem_osize(const CharDriv
+ return d->outbuf_size;
+ }
+
++#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];
+@@ -2452,6 +2515,10 @@ QemuOpts *qemu_chr_parse_compat(const ch
+ 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);
+@@ -2467,6 +2534,7 @@ static const struct {
+ { .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.14.0/slirp/udp.c
+===================================================================
+--- qemu-0.14.0.orig/slirp/udp.c
++++ qemu-0.14.0/slirp/udp.c
+@@ -40,6 +40,7 @@
+
+ #include <slirp.h>
+ #include "ip_icmp.h"
++#include "bswap.h"
+
+ static uint8_t udp_tos(struct socket *so);
+
+@@ -125,6 +126,11 @@ udp_input(register struct mbuf *m, int i
+ 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.14.0/sysemu.h
+===================================================================
+--- qemu-0.14.0.orig/sysemu.h
++++ qemu-0.14.0/sysemu.h
+@@ -136,6 +136,7 @@ extern int semihosting_enabled;
+ 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.14.0/target-i386/beginend_funcs.sh
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-i386/beginend_funcs.sh
+@@ -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.14.0/target-i386/ghash.c
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-i386/ghash.c
+@@ -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 <stdlib.h>
++
++#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.14.0/target-i386/ghash.h
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-i386/ghash.h
+@@ -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.14.0/target-i386/gl_func_perso.h
+===================================================================
+--- /dev/null
++++ qemu-0.14.0/target-i386/gl_func_perso.h
+@@ -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),