summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/packages/qemu/qemu-git/06_exit_segfault.patch45
-rw-r--r--meta/packages/qemu/qemu-git/11_signal_sigaction.patch21
-rw-r--r--meta/packages/qemu/qemu-git/22_net_tuntap_stall.patch18
-rw-r--r--meta/packages/qemu/qemu-git/31_syscalls.patch27
-rw-r--r--meta/packages/qemu/qemu-git/52_ne2000_return.patch17
-rw-r--r--meta/packages/qemu/qemu-git/63_sparc_build.patch18
-rw-r--r--meta/packages/qemu/qemu-git/64_ppc_asm_constraints.patch18
-rw-r--r--meta/packages/qemu/qemu-git/66_tls_ld.patch55
-rw-r--r--meta/packages/qemu/qemu-git/91-oh-sdl-cursor.patch18
-rw-r--r--meta/packages/qemu/qemu-git/fix-nogl.patch40
-rw-r--r--meta/packages/qemu/qemu-git/qemu-amd64-32b-mapping-0.9.0.patch37
-rw-r--r--meta/packages/qemu/qemu-git/qemu-git-qemugl-host.patch (renamed from meta/packages/qemu/qemu-git/qemu-add-gl-host-code.patch)966
-rw-r--r--meta/packages/qemu/qemu_git.bb15
13 files changed, 849 insertions, 446 deletions
diff --git a/meta/packages/qemu/qemu-git/06_exit_segfault.patch b/meta/packages/qemu/qemu-git/06_exit_segfault.patch
deleted file mode 100644
index 06123d062..000000000
--- a/meta/packages/qemu/qemu-git/06_exit_segfault.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-#DPATCHLEVEL=0
----
-# linux-user/main.c | 8 ++++----
-# 1 file changed, 4 insertions(+), 4 deletions(-)
-#
-Index: linux-user/main.c
-===================================================================
---- linux-user/main.c.orig 2007-12-03 23:47:25.000000000 +0000
-+++ linux-user/main.c 2007-12-03 23:47:41.000000000 +0000
-@@ -714,7 +714,7 @@ void cpu_loop (CPUSPARCState *env)
- default:
- printf ("Unhandled trap: 0x%x\n", trapnr);
- cpu_dump_state(env, stderr, fprintf, 0);
-- exit (1);
-+ _exit (1);
- }
- process_pending_signals (env);
- }
-@@ -1634,7 +1634,7 @@ void cpu_loop (CPUState *env)
- default:
- printf ("Unhandled trap: 0x%x\n", trapnr);
- cpu_dump_state(env, stderr, fprintf, 0);
-- exit (1);
-+ _exit (1);
- }
- process_pending_signals (env);
- }
-@@ -1954,7 +1954,7 @@ int main(int argc, char **argv)
- for(item = cpu_log_items; item->mask != 0; item++) {
- printf("%-10s %s\n", item->name, item->help);
- }
-- exit(1);
-+ _exit(1);
- }
- cpu_set_log(mask);
- } else if (!strcmp(r, "s")) {
-@@ -1973,7 +1973,7 @@ int main(int argc, char **argv)
- if (qemu_host_page_size == 0 ||
- (qemu_host_page_size & (qemu_host_page_size - 1)) != 0) {
- fprintf(stderr, "page size must be a power of two\n");
-- exit(1);
-+ _exit(1);
- }
- } else if (!strcmp(r, "g")) {
- gdbstub_port = atoi(argv[optind++]);
diff --git a/meta/packages/qemu/qemu-git/11_signal_sigaction.patch b/meta/packages/qemu/qemu-git/11_signal_sigaction.patch
deleted file mode 100644
index 33c5e8b12..000000000
--- a/meta/packages/qemu/qemu-git/11_signal_sigaction.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-#DPATCHLEVEL=0
----
-# linux-user/signal.c | 5 +++++
-# 1 file changed, 5 insertions(+)
-#
-Index: linux-user/signal.c
-===================================================================
---- linux-user/signal.c.orig 2007-12-03 23:47:44.000000000 +0000
-+++ linux-user/signal.c 2007-12-03 23:47:46.000000000 +0000
-@@ -512,6 +512,11 @@ int do_sigaction(int sig, const struct t
-
- if (sig < 1 || sig > TARGET_NSIG || sig == SIGKILL || sig == SIGSTOP)
- return -EINVAL;
-+
-+ /* no point doing the stuff as those are not allowed for sigaction */
-+ if ((sig == TARGET_SIGKILL) || (sig == TARGET_SIGSTOP))
-+ return -EINVAL;
-+
- k = &sigact_table[sig - 1];
- #if defined(DEBUG_SIGNAL)
- fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n",
diff --git a/meta/packages/qemu/qemu-git/22_net_tuntap_stall.patch b/meta/packages/qemu/qemu-git/22_net_tuntap_stall.patch
deleted file mode 100644
index f2bfbc910..000000000
--- a/meta/packages/qemu/qemu-git/22_net_tuntap_stall.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-#DPATCHLEVEL=0
----
-# vl.c | 2 +-
-# 1 file changed, 1 insertion(+), 1 deletion(-)
-#
-Index: net.c
-===================================================================
---- net.c.orig 2009-01-05 11:27:29.000000000 +0000
-+++ net.c 2009-01-05 11:27:40.000000000 +0000
-@@ -852,7 +852,7 @@
- return -1;
- }
- memset(&ifr, 0, sizeof(ifr));
-- ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
-+ ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE;;
- if (ifname[0] != '\0')
- pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname);
- else
diff --git a/meta/packages/qemu/qemu-git/31_syscalls.patch b/meta/packages/qemu/qemu-git/31_syscalls.patch
deleted file mode 100644
index df2aa84bb..000000000
--- a/meta/packages/qemu/qemu-git/31_syscalls.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-#DPATCHLEVEL=0
----
-# linux-user/syscall.c | 11 ++++++++---
-# 1 file changed, 8 insertions(+), 3 deletions(-)
-#
-Index: linux-user/syscall.c
-===================================================================
---- linux-user/syscall.c.orig 2009-01-05 12:32:37.000000000 +0000
-+++ linux-user/syscall.c 2009-01-05 12:32:37.000000000 +0000
-@@ -298,6 +298,7 @@
- extern int setfsuid(int);
- extern int setfsgid(int);
- extern int setgroups(int, gid_t *);
-+extern int uselib(const char*);
-
- #define ERRNO_TABLE_SIZE 1200
-
-@@ -4397,7 +4398,8 @@
- #endif
- #ifdef TARGET_NR_uselib
- case TARGET_NR_uselib:
-- goto unimplemented;
-+ ret = get_errno(uselib(path((const char*)arg1)));
-+ break;
- #endif
- #ifdef TARGET_NR_swapon
- case TARGET_NR_swapon:
diff --git a/meta/packages/qemu/qemu-git/52_ne2000_return.patch b/meta/packages/qemu/qemu-git/52_ne2000_return.patch
deleted file mode 100644
index e4ea33f2c..000000000
--- a/meta/packages/qemu/qemu-git/52_ne2000_return.patch
+++ /dev/null
@@ -1,17 +0,0 @@
----
- hw/ne2000.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: qemu/hw/ne2000.c
-===================================================================
---- qemu.orig/hw/ne2000.c 2007-12-03 19:32:52.000000000 +0000
-+++ qemu/hw/ne2000.c 2007-12-03 19:33:55.000000000 +0000
-@@ -217,7 +217,7 @@ static int ne2000_can_receive(void *opaq
- NE2000State *s = opaque;
-
- if (s->cmd & E8390_STOP)
-- return 1;
-+ return 0;
- return !ne2000_buffer_full(s);
- }
-
diff --git a/meta/packages/qemu/qemu-git/63_sparc_build.patch b/meta/packages/qemu/qemu-git/63_sparc_build.patch
deleted file mode 100644
index 37b38f641..000000000
--- a/meta/packages/qemu/qemu-git/63_sparc_build.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-#DPATCHLEVEL=0
----
-# sparc.ld | 2 +-
-# 1 file changed, 1 insertion(+), 1 deletion(-)
-#
-Index: sparc.ld
-===================================================================
---- sparc.ld.orig 2007-12-03 15:40:26.000000000 +0000
-+++ sparc.ld 2007-12-03 16:05:06.000000000 +0000
-@@ -6,7 +6,7 @@ ENTRY(_start)
- SECTIONS
- {
- /* Read-only sections, merged into text segment: */
-- . = 0x60000000 + SIZEOF_HEADERS;
-+ . = 0x60000000 + 0x400;
- .interp : { *(.interp) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
diff --git a/meta/packages/qemu/qemu-git/64_ppc_asm_constraints.patch b/meta/packages/qemu/qemu-git/64_ppc_asm_constraints.patch
deleted file mode 100644
index e4858b79d..000000000
--- a/meta/packages/qemu/qemu-git/64_ppc_asm_constraints.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-#DPATCHLEVEL=1
----
-# cpu-all.h | 2 +-
-# 1 file changed, 1 insertion(+), 1 deletion(-)
-#
-Index: qemu/cpu-all.h
-===================================================================
---- qemu.orig/cpu-all.h 2007-06-13 11:48:22.000000000 +0100
-+++ qemu/cpu-all.h 2007-06-13 11:51:56.000000000 +0100
-@@ -250,7 +250,7 @@ static inline void stw_le_p(void *ptr, i
- static inline void stl_le_p(void *ptr, int v)
- {
- #ifdef __powerpc__
-- __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" (v), "r" (ptr));
-+ __asm__ __volatile__ ("stwbrx %0,0,%1" : : "r" (v), "r" (ptr) : "memory");
- #else
- uint8_t *p = ptr;
- p[0] = v;
diff --git a/meta/packages/qemu/qemu-git/66_tls_ld.patch b/meta/packages/qemu/qemu-git/66_tls_ld.patch
deleted file mode 100644
index 54e02eff8..000000000
--- a/meta/packages/qemu/qemu-git/66_tls_ld.patch
+++ /dev/null
@@ -1,55 +0,0 @@
----
- arm.ld | 7 +++++++
- i386.ld | 7 +++++++
- 2 files changed, 14 insertions(+)
-
-Index: arm.ld
-===================================================================
---- arm.ld.orig 2007-06-13 11:48:22.000000000 +0100
-+++ arm.ld 2007-06-13 11:51:56.000000000 +0100
-@@ -26,6 +26,10 @@ SECTIONS
- { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
- .rela.rodata :
- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
-+ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
-+ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
-+ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
-+ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
- .rel.got : { *(.rel.got) }
- .rela.got : { *(.rela.got) }
- .rel.ctors : { *(.rel.ctors) }
-@@ -58,6 +62,9 @@ SECTIONS
- .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
- __exidx_end = .;
- .reginfo : { *(.reginfo) }
-+ /* Thread Local Storage sections */
-+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
-+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- /* Adjust the address for the data segment. We want to adjust up to
- the same address within the page on the next page up. */
- . = ALIGN(0x100000) + (. & (0x100000 - 1));
-Index: i386.ld
-===================================================================
---- i386.ld.orig 2007-06-13 11:48:22.000000000 +0100
-+++ i386.ld 2007-06-13 11:51:56.000000000 +0100
-@@ -28,6 +28,10 @@ SECTIONS
- { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
- .rela.rodata :
- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
-+ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
-+ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
-+ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
-+ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
- .rel.got : { *(.rel.got) }
- .rela.got : { *(.rela.got) }
- .rel.ctors : { *(.rel.ctors) }
-@@ -53,6 +57,9 @@ SECTIONS
- _etext = .;
- PROVIDE (etext = .);
- .fini : { *(.fini) } =0x47ff041f
-+ /* Thread Local Storage sections */
-+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
-+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- . = ALIGN(32 / 8);
- PROVIDE (__preinit_array_start = .);
- .preinit_array : { *(.preinit_array) }
diff --git a/meta/packages/qemu/qemu-git/91-oh-sdl-cursor.patch b/meta/packages/qemu/qemu-git/91-oh-sdl-cursor.patch
deleted file mode 100644
index 0d60c1c30..000000000
--- a/meta/packages/qemu/qemu-git/91-oh-sdl-cursor.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-=== modified file 'sdl.c'
----
- sdl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: sdl.c
-===================================================================
---- sdl.c.orig 2007-12-03 19:32:15.000000000 +0000
-+++ sdl.c 2007-12-03 19:34:04.000000000 +0000
-@@ -247,7 +247,7 @@ static void sdl_hide_cursor(void)
-
- if (kbd_mouse_is_absolute()) {
- SDL_ShowCursor(1);
-- SDL_SetCursor(sdl_cursor_hidden);
-+ /* SDL_SetCursor(sdl_cursor_hidden); */
- } else {
- SDL_ShowCursor(0);
- }
diff --git a/meta/packages/qemu/qemu-git/fix-nogl.patch b/meta/packages/qemu/qemu-git/fix-nogl.patch
new file mode 100644
index 000000000..f1f9bcf00
--- /dev/null
+++ b/meta/packages/qemu/qemu-git/fix-nogl.patch
@@ -0,0 +1,40 @@
+Index: git/Makefile.target
+===================================================================
+--- git.orig/Makefile.target 2009-06-09 22:05:27.000000000 +0100
++++ git/Makefile.target 2009-06-09 22:05:28.000000000 +0100
+@@ -155,6 +155,8 @@
+
+ ifeq ($(TARGET_BASE_ARCH), i386)
+ LIBOBJS+=helper_opengl.o opengl_exec.o
++else
++LIBOBJS+=dummygl.o
+ endif
+
+ ifeq ($(TARGET_BASE_ARCH), arm)
+Index: git/target-arm/dummygl.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/target-arm/dummygl.c 2009-06-09 22:15:55.000000000 +0100
+@@ -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/packages/qemu/qemu-git/qemu-amd64-32b-mapping-0.9.0.patch b/meta/packages/qemu/qemu-git/qemu-amd64-32b-mapping-0.9.0.patch
deleted file mode 100644
index 40ab59c76..000000000
--- a/meta/packages/qemu/qemu-git/qemu-amd64-32b-mapping-0.9.0.patch
+++ /dev/null
@@ -1,37 +0,0 @@
----
- linux-user/mmap.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-Index: trunk/linux-user/mmap.c
-===================================================================
---- trunk.orig/linux-user/mmap.c 2009-01-05 11:09:58.000000000 +0000
-+++ trunk/linux-user/mmap.c 2009-01-05 12:46:33.000000000 +0000
-@@ -122,6 +122,10 @@
- munmap(p, *p);
- }
-
-+#ifndef MAP_32BIT
-+#define MAP_32BIT 0
-+#endif
-+
- /* NOTE: all the constants are the HOST ones, but addresses are target. */
- int target_mprotect(abi_ulong start, abi_ulong len, int prot)
- {
-@@ -365,7 +369,7 @@
- especially important if qemu_host_page_size >
- qemu_real_host_page_size */
- p = mmap(g2h(mmap_start),
-- host_len, prot, flags | MAP_FIXED, fd, host_offset);
-+ host_len, prot, flags | MAP_FIXED | MAP_32BIT, fd, host_offset);
- if (p == MAP_FAILED)
- goto fail;
- /* update start so that it points to the file position at 'offset' */
-@@ -567,7 +571,7 @@
- flags | MREMAP_FIXED,
- g2h(mmap_start));
- } else {
-- host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
-+ host_addr = mremap(g2h(old_addr), old_size, new_size, flags | MAP_32BIT);
- /* Check if address fits target address space */
- if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {
- /* Revert mremap() changes */
diff --git a/meta/packages/qemu/qemu-git/qemu-add-gl-host-code.patch b/meta/packages/qemu/qemu-git/qemu-git-qemugl-host.patch
index 25ee37925..3ad5c081f 100644
--- a/meta/packages/qemu/qemu-git/qemu-add-gl-host-code.patch
+++ b/meta/packages/qemu/qemu-git/qemu-git-qemugl-host.patch
@@ -1,21 +1,19 @@
-Index: git/Makefile.target
-===================================================================
---- git.orig/Makefile.target 2009-05-23 11:22:16.000000000 +0100
-+++ git/Makefile.target 2009-05-23 11:59:35.000000000 +0100
-@@ -153,6 +153,12 @@
+diff --git a/Makefile.target b/Makefile.target
+index f33f762..d1eb876 100644
+--- a/Makefile.target
++++ b/Makefile.target
+@@ -153,6 +153,10 @@ endif
CPPFLAGS+=-I$(SRC_PATH)/fpu
LIBOBJS+= op_helper.o helper.o
+ifeq ($(TARGET_BASE_ARCH), i386)
+LIBOBJS+=helper_opengl.o opengl_exec.o
-+else
-+LIBOBJS+=opengl_dummy.o
+endif
+
ifeq ($(TARGET_BASE_ARCH), arm)
LIBOBJS+= neon_helper.o iwmmxt_helper.o
endif
-@@ -224,6 +230,21 @@
+@@ -224,6 +228,21 @@ op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
@@ -37,20 +35,46 @@ Index: git/Makefile.target
#########################################################
# Linux user emulator target
-@@ -724,7 +745,7 @@
- main.o: CFLAGS+=-p
+@@ -584,7 +603,7 @@ OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
+ OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
+ OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
+ OBJS += device-hotplug.o pci-hotplug.o
+-CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
++CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE -DTARGET_OPENGL_OK
endif
-
--$(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
-+$(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) -lGL -lGLU
+ ifeq ($(TARGET_BASE_ARCH), ppc)
+ CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
+@@ -727,7 +746,7 @@ endif
+ $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
- $(LINK)
-Index: git/hw/vmware_vga.c
-===================================================================
---- git.orig/hw/vmware_vga.c 2009-05-23 11:22:16.000000000 +0100
-+++ git/hw/vmware_vga.c 2009-05-23 11:22:17.000000000 +0100
-@@ -484,6 +484,8 @@
+- $(LINK)
++ $(LINK) -lGL -lGLU
+
+ endif # !CONFIG_USER_ONLY
+
+diff --git a/hw/pixel_ops.h b/hw/pixel_ops.h
+index d390adf..9100b5c 100644
+--- a/hw/pixel_ops.h
++++ b/hw/pixel_ops.h
+@@ -4,6 +4,12 @@ static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g,
+ 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)
+ {
+diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
+index d1cba28..c918afb 100644
+--- a/hw/vmware_vga.c
++++ b/hw/vmware_vga.c
+@@ -484,6 +484,8 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
#define CMD(f) le32_to_cpu(s->cmd->f)
@@ -59,7 +83,7 @@ Index: git/hw/vmware_vga.c
static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s)
{
if (!s->config || !s->enable)
-@@ -493,11 +495,18 @@
+@@ -493,11 +495,18 @@ static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s)
static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s)
{
@@ -82,7 +106,7 @@ Index: git/hw/vmware_vga.c
}
static inline uint32_t vmsvga_fifo_read(struct vmsvga_state_s *s)
-@@ -507,12 +516,12 @@
+@@ -507,12 +516,12 @@ static inline uint32_t vmsvga_fifo_read(struct vmsvga_state_s *s)
static void vmsvga_fifo_run(struct vmsvga_state_s *s)
{
@@ -97,7 +121,7 @@ Index: git/hw/vmware_vga.c
case SVGA_CMD_UPDATE:
case SVGA_CMD_UPDATE_VERBOSE:
x = vmsvga_fifo_read(s);
-@@ -612,7 +621,7 @@
+@@ -612,7 +621,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
while (args --)
vmsvga_fifo_read(s);
printf("%s: Unknown command 0x%02x in SVGA command FIFO\n",
@@ -106,11 +130,35 @@ Index: git/hw/vmware_vga.c
break;
}
-Index: git/kqemu.c
-===================================================================
---- git.orig/kqemu.c 2009-05-23 11:22:16.000000000 +0100
-+++ git/kqemu.c 2009-05-23 11:22:17.000000000 +0100
-@@ -93,6 +93,8 @@
+@@ -914,8 +923,9 @@ static void vmsvga_reset(struct vmsvga_state_s *s)
+ s->width = -1;
+ s->height = -1;
+ s->svgaid = SVGA_ID;
+- s->depth = 24;
++ s->depth = 32;
+ s->bypp = (s->depth + 7) >> 3;
++ s->bypp = 4; /* XXX: until we can get host's actual depth */
+ s->cursor.on = 0;
+ s->redraw_fifo_first = 0;
+ s->redraw_fifo_last = 0;
+@@ -1140,6 +1150,12 @@ static void vmsvga_init(struct vmsvga_state_s *s,
+ /* XXX: use optimized standard vga accesses */
+ cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
+ vga_ram_size, vga_ram_offset);
++
++#ifdef EMBED_STDVGA
++ s->map_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
++ s->map_end = VBE_DISPI_LFB_PHYSICAL_ADDRESS + vga_ram_size;
++ vga_dirty_log_start((VGAState *) s);
++#endif
+ #endif
+ }
+
+diff --git a/kqemu.c b/kqemu.c
+index 25f4ea7..09c761a 100644
+--- a/kqemu.c
++++ b/kqemu.c
+@@ -93,6 +93,8 @@ uint8_t *modified_ram_pages_table;
int qpi_io_memory;
uint32_t kqemu_comm_base; /* physical address of the QPI communication page */
@@ -119,7 +167,7 @@ Index: git/kqemu.c
#define cpuid(index, eax, ebx, ecx, edx) \
asm volatile ("cpuid" \
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
-@@ -860,6 +862,22 @@
+@@ -860,6 +862,22 @@ int kqemu_cpu_exec(CPUState *env)
else
env->hflags &= ~HF_OSFXSR_MASK;
@@ -134,7 +182,7 @@ Index: git/kqemu.c
+
+ if (env->tlb_table[1][index].addend) {
+ unsigned char *ptr = env->eip + env->tlb_table[1][index].addend;
-+ if (ptr[0] == 0xCD && ptr[1] == 0x99)
++ if (ptr[0] == 0xcd && ptr[1] == 0x99)
+ helper_opengl();
+ }
+ }
@@ -142,10 +190,271 @@ Index: git/kqemu.c
LOG_INT("kqemu: kqemu_cpu_exec: ret=0x%x\n", ret);
if (ret == KQEMU_RET_SYSCALL) {
/* syscall instruction */
-Index: git/target-i386/beginend_funcs.sh
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/beginend_funcs.sh 2009-05-23 11:22:17.000000000 +0100
+diff --git a/qemu-char.c b/qemu-char.c
+index 64d41d0..424ea9b 100644
+--- a/qemu-char.c
++++ b/qemu-char.c
+@@ -2112,6 +2112,69 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str,
+ 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_reset(chr);
++
++ return chr;
++}
++#else
++#define qemu_chr_open_opengl() 0
++#endif
++
+ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s))
+ {
+ const char *p;
+@@ -2192,6 +2255,9 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i
+ chr = chr_baum_init();
+ } else
+ #endif
++ if (!strcmp(filename, "opengl")) {
++ chr = qemu_chr_open_opengl();
++ } else
+ {
+ chr = NULL;
+ }
+diff --git a/sdl.c b/sdl.c
+index 74f084c..b78f754 100644
+--- a/sdl.c
++++ b/sdl.c
+@@ -54,6 +54,8 @@ static int guest_cursor = 0;
+ static int guest_x, guest_y;
+ static SDL_Cursor *guest_sprite = 0;
+
++extern void opengl_exec_set_parent_window(Display* _dpy, Window _parent_window);
++
+ static void sdl_update(DisplayState *ds, int x, int y, int w, int h)
+ {
+ SDL_Rect rec;
+@@ -85,7 +87,9 @@ static void sdl_setdata(DisplayState *ds)
+
+ static void sdl_resize(DisplayState *ds)
+ {
++ SDL_SysWMinfo info;
+ int flags;
++ static Display *dpy;
+
+ // printf("resizing to %d %d\n", w, h);
+
+@@ -104,6 +108,13 @@ static void sdl_resize(DisplayState *ds)
+ }
+
+ sdl_setdata(ds);
++
++ SDL_GetWMInfo(&info);
++ if (info.subsystem == SDL_SYSWM_X11 && info.info.x11.display &&
++ (!dpy || dpy == info.info.x11.display)) {
++ dpy = info.info.x11.display;
++ opengl_exec_set_parent_window(dpy, info.info.x11.window);
++ }
+ }
+
+ /* generic keyboard conversion */
+@@ -320,7 +331,7 @@ static void sdl_show_cursor(void)
+
+ if (!kbd_mouse_is_absolute()) {
+ SDL_ShowCursor(1);
+- if (guest_cursor &&
++ if (guest_cursor && !force_pointer &&
+ (gui_grab || kbd_mouse_is_absolute() || absolute_enabled))
+ SDL_SetCursor(guest_sprite);
+ else
+@@ -331,7 +342,8 @@ static void sdl_show_cursor(void)
+ static void sdl_grab_start(void)
+ {
+ if (guest_cursor) {
+- SDL_SetCursor(guest_sprite);
++ if (!force_pointer)
++ SDL_SetCursor(guest_sprite);
+ if (!kbd_mouse_is_absolute() && !absolute_enabled)
+ SDL_WarpMouse(guest_x, guest_y);
+ } else
+@@ -372,8 +384,8 @@ static void sdl_send_mouse_event(int dx, int dy, int dz, int x, int y, int state
+ absolute_enabled = 1;
+ }
+
+- dx = x * 0x7FFF / (width - 1);
+- dy = y * 0x7FFF / (height - 1);
++ dx = x * 0x7FFF / (width - 1);
++ dy = y * 0x7FFF / (height - 1);
+ } else if (absolute_enabled) {
+ sdl_show_cursor();
+ absolute_enabled = 0;
+@@ -603,7 +615,8 @@ static void sdl_mouse_warp(int x, int y, int on)
+ if (!guest_cursor)
+ sdl_show_cursor();
+ if (gui_grab || kbd_mouse_is_absolute() || absolute_enabled) {
+- SDL_SetCursor(guest_sprite);
++ if (!force_pointer)
++ SDL_SetCursor(guest_sprite);
+ if (!kbd_mouse_is_absolute() && !absolute_enabled)
+ SDL_WarpMouse(x, y);
+ }
+@@ -628,6 +641,10 @@ static void sdl_mouse_define(int width, int height, int bpp,
+ line = image;
+ for (x = 0; x < width; x ++, dst ++) {
+ switch (bpp) {
++ case 32:
++ src = *(line ++); src |= *(line ++);
++ src = *(line ++); src |= *(line ++);
++ break;
+ case 24:
+ src = *(line ++); src |= *(line ++); src |= *(line ++);
+ break;
+@@ -654,7 +671,7 @@ static void sdl_mouse_define(int width, int height, int bpp,
+ }
+ guest_sprite = SDL_CreateCursor(sprite, mask, width, height, hot_x, hot_y);
+
+- if (guest_cursor &&
++ if (guest_cursor && !force_pointer &&
+ (gui_grab || kbd_mouse_is_absolute() || absolute_enabled))
+ SDL_SetCursor(guest_sprite);
+ }
+@@ -670,6 +687,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
+ {
+ int flags;
+ uint8_t data = 0;
++ SDL_SysWMinfo info;
+
+ #if defined(__APPLE__)
+ /* always use generic keymaps */
+@@ -691,6 +709,12 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
+ exit(1);
+ }
+
++ SDL_GetWMInfo(&info);
++ if (info.subsystem == SDL_SYSWM_X11 && info.info.x11.display)
++ opengl_exec_set_parent_window(info.info.x11.display,
++ RootWindow(info.info.x11.display,
++ DefaultScreen(info.info.x11.display)));
++
+ dcl = qemu_mallocz(sizeof(DisplayChangeListener));
+ dcl->dpy_update = sdl_update;
+ dcl->dpy_resize = sdl_resize;
+@@ -714,4 +738,9 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
+ gui_fullscreen_initial_grab = 1;
+ sdl_grab_start();
+ }
++
++ SDL_GetWMInfo(&info);
++ if (info.subsystem == SDL_SYSWM_X11 && info.info.x11.display)
++ opengl_exec_set_parent_window(info.info.x11.display,
++ info.info.x11.window);
+ }
+diff --git a/slirp/ctl.h b/slirp/ctl.h
+index 4a8576d..201ae4b 100644
+--- a/slirp/ctl.h
++++ b/slirp/ctl.h
+@@ -2,6 +2,7 @@
+ #define CTL_EXEC 1
+ #define CTL_ALIAS 2
+ #define CTL_DNS 3
++#define CTL_OPENGL 6
+
+ #define CTL_SPECIAL "10.0.2.0"
+ #define CTL_LOCAL "10.0.2.15"
+diff --git a/slirp/udp.c b/slirp/udp.c
+index 8d3bdd2..e5f40cc 100644
+--- a/slirp/udp.c
++++ b/slirp/udp.c
+@@ -40,6 +40,7 @@
+
+ #include <slirp.h>
+ #include "ip_icmp.h"
++#include "bswap.h"
+
+ #ifdef LOG_ENABLED
+ struct udpstat udpstat;
+@@ -153,6 +154,11 @@ udp_input(m, iphlen)
+ 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_restrict)
+ goto bad;
+
+diff --git a/sysemu.h b/sysemu.h
+index 57217c1..f0a48cd 100644
+--- a/sysemu.h
++++ b/sysemu.h
+@@ -96,6 +96,7 @@ extern int graphic_rotate;
+ extern int no_quit;
+ extern int semihosting_enabled;
+ extern int old_param;
++extern int force_pointer;
+ extern const char *bootp_filename;
+
+ #ifdef USE_KQEMU
+diff --git a/target-i386/beginend_funcs.sh b/target-i386/beginend_funcs.sh
+new file mode 100755
+index 0000000..bdd7684
+--- /dev/null
++++ b/target-i386/beginend_funcs.sh
@@ -0,0 +1,23 @@
+#! /bin/sh
+# Copyright 2008 (C) Intel Corporation
@@ -170,10 +479,11 @@ Index: git/target-i386/beginend_funcs.sh
+echo -e MAGIC_MACRO\(glCallList\)\\n
+echo -e MAGIC_MACRO\(glCallLists\)\\n
+echo -e MAGIC_MACRO\(glEdgeFlag{,v}\)\\n
-Index: git/target-i386/ghash.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/ghash.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/ghash.c b/target-i386/ghash.c
+new file mode 100644
+index 0000000..1f0c380
+--- /dev/null
++++ b/target-i386/ghash.c
@@ -0,0 +1,347 @@
+/* This is a modified and simplified version of original ghash.c */
+
@@ -522,10 +832,11 @@ Index: git/target-i386/ghash.c
+ hash_node = next;
+ }
+}
-Index: git/target-i386/ghash.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/ghash.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/ghash.h b/target-i386/ghash.h
+new file mode 100644
+index 0000000..7f34436
+--- /dev/null
++++ b/target-i386/ghash.h
@@ -0,0 +1,59 @@
+/* This is a modified and simplified version of original ghash.h */
+
@@ -586,10 +897,11 @@ Index: git/target-i386/ghash.h
+
+#endif /* __SIMPLE_HASH_H__ */
+
-Index: git/target-i386/gl_func_perso.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/gl_func_perso.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/gl_func_perso.h b/target-i386/gl_func_perso.h
+new file mode 100644
+index 0000000..401c0a8
+--- /dev/null
++++ b/target-i386/gl_func_perso.h
@@ -0,0 +1,135 @@
+/*
+ * Hand-implemented GL/GLX API
@@ -726,22 +1038,36 @@ Index: git/target-i386/gl_func_perso.h
+MAGIC_MACRO(_glGetSelectBuffer_fake),
+MAGIC_MACRO(_glFeedbackBuffer_fake),
+MAGIC_MACRO(_glGetFeedbackBuffer_fake),
-Index: git/target-i386/helper.h
-===================================================================
---- git.orig/target-i386/helper.h 2009-05-23 11:22:16.000000000 +0100
-+++ git/target-i386/helper.h 2009-05-23 11:22:17.000000000 +0100
-@@ -214,4 +214,6 @@
+diff --git a/target-i386/helper.c b/target-i386/helper.c
+index e714994..7354220 100644
+--- a/target-i386/helper.c
++++ b/target-i386/helper.c
+@@ -1320,7 +1320,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
+ }
+
+ 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;
+ }
+
+diff --git a/target-i386/helper.h b/target-i386/helper.h
+index 0c36783..b247b35 100644
+--- a/target-i386/helper.h
++++ b/target-i386/helper.h
+@@ -214,4 +214,6 @@ DEF_HELPER_2(rclq, tl, tl, tl)
DEF_HELPER_2(rcrq, tl, tl, tl)
#endif
+DEF_HELPER_0(opengl, void)
+
#include "def-helper.h"
-Index: git/target-i386/helper_opengl.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/helper_opengl.c 2009-05-23 11:22:17.000000000 +0100
-@@ -0,0 +1,979 @@
+diff --git a/target-i386/helper_opengl.c b/target-i386/helper_opengl.c
+new file mode 100644
+index 0000000..f83d02b
+--- /dev/null
++++ b/target-i386/helper_opengl.c
+@@ -0,0 +1,1205 @@
+/*
+ * Host-side implementation of GL/GLX API
+ *
@@ -796,13 +1122,16 @@ Index: git/target-i386/helper_opengl.c
+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);
-+ if (is_user == 0) {
++ /* A sanity check for the int0x99 case */
++ if (unlikely(is_user == 0 && !allow_kernel)) {
+ fprintf(stderr, "not in userland !!!\n");
+ return NULL;
+ }
@@ -830,7 +1159,7 @@ Index: git/target-i386/helper_opengl.c
+ } else {
+ fprintf(stderr,
+ "cpu_get_phys_page_debug(env, " TARGET_FMT_lx ") == "
-+ TARGET_FMT_lx "p\n", addr, ret);
++ TARGET_FMT_lx "\n", addr, ret);
+ fprintf(stderr,
+ "ret=" TARGET_FMT_lx " phys_ram_size= " TARGET_FMT_lx
+ "\n", ret, (target_ulong) phys_ram_size);
@@ -1222,7 +1551,19 @@ Index: git/target-i386/helper_opengl.c
+ if (unlikely(func_number == _exit_process_func))
+ last_process_id = 0;
+
-+ argcpy:
++ if (!wordsize) {
++ if (func_number == _init32_func || func_number == _init64_func) {
++ if (func_number == _init32_func) {
++ wordsize = 32;
++ argcpy_target_to_host = memcpy_target32_to_host;
++ } else {
++ wordsize = 64;
++ argcpy_target_to_host = memcpy_target64_to_host;
++ }
++ } else
++ fprintf(stderr, "commands submitted before initialisation done\n");
++ }
++
+ reset_host_offset();
+
+ if (nb_args) {
@@ -1606,24 +1947,12 @@ Index: git/target-i386/helper_opengl.c
+
+ if (func_number == _init32_func || func_number == _init64_func) {
+ if (func_number == _init32_func) {
-+ if (!wordsize) {
-+ wordsize = 32;
-+ argcpy_target_to_host = memcpy_target32_to_host;
-+ goto argcpy;
-+ }
-+
+ if (wordsize != 32) {
+ fprintf(stderr,
+ "clients with different ABIs not supported\n");
+ exit(-1);
+ }
+ } else {
-+ if (!wordsize) {
-+ wordsize = 64;
-+ argcpy_target_to_host = memcpy_target64_to_host;
-+ goto argcpy;
-+ }
-+
+ if (wordsize != 64) {
+ fprintf(stderr,
+ "clients with different ABIs not supported\n");
@@ -1720,11 +2049,248 @@ Index: git/target-i386/helper_opengl.c
+ env->regs[R_EDX], env->regs[R_ESI]);
+ doing_opengl = 0;
+}
++
++void mem_opengl(uint64_t ptr)
++{
++ uint64_t *params = get_phys_mem_addr(env, ptr);
++ int ret;
++
++ /* Execute */
++ doing_opengl = 1;
++ ret = decode_call(env, le64_to_cpu(params[0]),
++ le64_to_cpu(params[1]), le64_to_cpu(params[2]),
++ le64_to_cpu(params[3]), le64_to_cpu(params[4]));
++ doing_opengl = 0;
++
++ params[0] = cpu_to_le64(ret);
++ params[5] = 0;
++}
++
++#define THREADINFO_TASK_OFFSET 0x0 //// 0x0
++#define THREADSTRUCT_IOPL_OFFSET 0x78 //// 0x80
++#define TASKSTRUCT_NEXT_OFFSET 0x1a0 //// 0x1e8
++#define TASKSTRUCT_PREV_OFFSET 0x1a4 //// 0x1ec
++#define TASKSTRUCT_RCRED_OFFSET 0x29c //// 0x2b4
++#define TASKSTRUCT_CRED_OFFSET 0x2a0 //// 0x2b8
++#define TASKSTRUCT_COMM_OFFSET 0x2c0 //// 0x2fc
++#define TASKSTRUCT_THREAD_OFFSET 0x2e4 //// 0x318
++#define TASKSTRUCT_IO_CTX_OFFSET 0x40c //// 0x428
++#define CRED_CAPINH_OFFSET 0x28
++#define CRED_CAPPER_OFFSET 0x30
++#define CRED_CAPEFF_OFFSET 0x38
++#define CRED_CAPBST_OFFSET 0x40
++/* How to obtain the numbers:
++ * $ gbd vmlinux
++ * ...
++ * (gdb) print &((struct task_struct *) 0)->real_cred
++ * $22 = (const struct cred **) 0x29c
++ * (gdb) print &((struct task_struct *) 0)->cred
++ * $23 = (const struct cred **) 0x2a0
++ * (gbd) ...
++ * ...
++ * (gdb) ^D
++ * $ vim target-i386/helper_opengl.c
++ * ...
++ * :wq
++ * $ make
++ * ...
++ *
++ * Testing:
++ * $ x86_64-softmmu/qemu-system-x86_64 -s -hda ...
++ * ^Z
++ * [1]+ Stopped x86_64-softmmu/qemu-system-x86_64 -s -hda ...
++ * $ bg
++ * [1]+ x86_64-softmmu/qemu-system-x86_64 -s -hda ...
++ * $ gdb
++ * ...
++ * (gdb) target remote localhost:1234
++ * ...
++ * (gdb) print ((char *) *(unsigned int *) ((unsigned int) $rsp & ~8191)) +
++ * 0x2c0
++ * $9 = 0xc094062c "swapper"
++ * (gdb) print (char *) (*(unsigned int *) (((char *) *(unsigned int *)
++ * ((unsigned int) $rsp & ~8191)) + 0x1a0) - 0x1a0) + 0x2c0
++ * $10 = 0xdf87cee0 "init"
++ * ...
++ */
++
++#define CAP_SYS_RAWIO 17
++
++#define THREAD_SIZE (TARGET_PAGE_SIZE << 1)
++static ram_addr_t x86_current_thread(void)
++{
++ return env->regs[R_ESP] & ~(THREAD_SIZE - 1);
++}
++
++static ram_addr_t x86_current_task(void)
++{
++ return *(uint32_t *) get_phys_mem_addr(env,
++ x86_current_thread() + THREADINFO_TASK_OFFSET);
++}
++
++static ram_addr_t x86_current_io_ctx(void)
++{
++ return *(uint32_t *) get_phys_mem_addr(env,
++ x86_current_task() + TASKSTRUCT_IO_CTX_OFFSET);
++}
++
++static ram_addr_t x86_task_name(ram_addr_t proc)
++{
++ return x86_current_task() + TASKSTRUCT_COMM_OFFSET;
++}
++
++static ram_addr_t x86_task_next(ram_addr_t proc)
++{
++ return *(uint32_t *) get_phys_mem_addr(env,
++ x86_current_task() + TASKSTRUCT_NEXT_OFFSET) -
++ TASKSTRUCT_NEXT_OFFSET;
++}
++
++static void x86_cap_set(ram_addr_t caps, int cap)
++{
++ int offset = cap >> 5;
++ int mask = 1 << (cap & 31);
++
++ *(uint32_t *) get_phys_mem_addr(env, caps + offset) |= mask;
++}
++
++static void x86_cred_cap_set(ram_addr_t creds, int cap)
++{
++ x86_cap_set(creds + CRED_CAPINH_OFFSET, cap);
++ x86_cap_set(creds + CRED_CAPPER_OFFSET, cap);
++ x86_cap_set(creds + CRED_CAPEFF_OFFSET, cap);
++ x86_cap_set(creds + CRED_CAPBST_OFFSET, cap);
++}
++
++static void x86_task_cap_set(ram_addr_t proc, int cap)
++{
++ x86_cred_cap_set(*(uint32_t *) get_phys_mem_addr(env,
++ proc + TASKSTRUCT_RCRED_OFFSET), cap);
++ x86_cred_cap_set(*(uint32_t *) get_phys_mem_addr(env,
++ proc + TASKSTRUCT_CRED_OFFSET), cap);
++}
++
++#include "kvm.h"
++
++/* The putting and getting of the register set seems to incure a too
++ * high overhead. It's at least 4 ioctl's each. */
++#if 0
++static void opengl_ioport_write(void *data, uint32_t addr, uint32_t val)
++{
++ /* Ignore the first outb after iopl which is emulated by the kernel. */
++ if (val == (uint8_t) -1)
++ return;
++
++ if (kvm_enabled())
++ kvm_arch_get_registers(env);
++ doing_opengl = 1;
++ env->regs[R_EAX] =
++ decode_call(env, env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX],
++ env->regs[R_ESI], env->regs[R_EDI]);
++ doing_opengl = 0;
++ if (kvm_enabled())
++ kvm_arch_put_registers(env);
++}
++#else
++static void get_regs(void)
++{
++ /* We only really need the eflags and cr[0..4] */
++ if (kvm_enabled())
++ kvm_get_sregs(env);
++}
++
++static void opengl_ioport_write(void *data, uint32_t addr, uint32_t val)
++{
++ uint64_t *params;
++ int ret;
++
++ /* Only need to fetch the registers after a guest's context switch...
++ * the problem is, to find out about context switches we already need
++ * to fetch rsp
++ * TODO: pass the pid in val. the params pointer doesn't need to be
++ * passed on all calls because it can be a global and be constant.
++ */
++ get_regs();
++
++ params = get_phys_mem_addr(env, (target_ulong) val);
++
++ /* Execute */
++ doing_opengl = 1;
++ ret = decode_call(env, le64_to_cpu(params[0]),
++ le64_to_cpu(params[1]), le64_to_cpu(params[2]),
++ le64_to_cpu(params[3]), le64_to_cpu(params[4]));
++ doing_opengl = 0;
++
++ params[0] = cpu_to_le64(ret);
++ params[5] = 0;
++}
+#endif
-Index: git/target-i386/mesa_enums.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_enums.c 2009-05-23 11:22:17.000000000 +0100
++
++static void opengl_ioport_write_first(void *data, uint32_t addr, uint32_t val)
++{
++ if (val != (uint32_t) -1)
++ return;
++
++ /* Ignore the first outb after iopl which is emulated by the kernel. */
++
++ register_ioport_write(9996, 4, 4, opengl_ioport_write, (void *) 1);
++}
++
++void io_register(void)
++{
++ register_ioport_write(9996, 4, 4, opengl_ioport_write_first, (void *) 1);
++}
++
++void opengl_process_enable(void)
++{
++ ram_addr_t task;
++ char *name;
++ int newlevel = 3;
++ uint32_t iopl = newlevel << 12;
++ void *ioplptr;
++
++ if (kvm_enabled())
++ kvm_arch_get_registers(env);
++ allow_kernel = 1;
++
++ task = x86_current_task();
++ x86_task_cap_set(task, CAP_SYS_RAWIO);
++ name = get_phys_mem_addr(env, x86_task_name(task));
++
++ ioplptr = get_phys_mem_addr(env, task +
++ TASKSTRUCT_THREAD_OFFSET + THREADSTRUCT_IOPL_OFFSET);
++ ((uint32_t *) ioplptr)[0] = cpu_to_le32(iopl);
++
++ env->eflags &= ~0x3000;
++ env->eflags |= newlevel << 12;
++
++ allow_kernel = 0;
++ if (kvm_enabled())
++ kvm_arch_put_registers(env);
++
++ printf("Granted OpenGL access to process '%s'\n", name);
++
++ io_register();
++}
++#endif
+diff --git a/target-i386/kvm.c b/target-i386/kvm.c
+index eb61598..5c6fbae 100644
+--- a/target-i386/kvm.c
++++ b/target-i386/kvm.c
+@@ -480,7 +480,7 @@ static int kvm_get_fpu(CPUState *env)
+ return 0;
+ }
+
+-static int kvm_get_sregs(CPUState *env)
++int kvm_get_sregs(CPUState *env)
+ {
+ struct kvm_sregs sregs;
+ uint32_t hflags;
+diff --git a/target-i386/mesa_enums.c b/target-i386/mesa_enums.c
+new file mode 100644
+index 0000000..61a540c
+--- /dev/null
++++ b/target-i386/mesa_enums.c
@@ -0,0 +1,4890 @@
+/* DO NOT EDIT - This file generated automatically by gl_enums.py (from Mesa) script */
+
@@ -6616,10 +7182,11 @@ Index: git/target-i386/mesa_enums.c
+}
+
+
-Index: git/target-i386/mesa_get.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_get.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_get.c b/target-i386/mesa_get.c
+new file mode 100644
+index 0000000..3b4c9aa
+--- /dev/null
++++ b/target-i386/mesa_get.c
@@ -0,0 +1,5563 @@
+
+/***
@@ -12184,10 +12751,11 @@ Index: git/target-i386/mesa_get.c
+ params[i] = (GLdouble) values[i];
+}
+
-Index: git/target-i386/mesa_gl.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_gl.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_gl.h b/target-i386/mesa_gl.h
+new file mode 100644
+index 0000000..dc2047c
+--- /dev/null
++++ b/target-i386/mesa_gl.h
@@ -0,0 +1,2251 @@
+/*
+ * Mesa 3-D graphics library
@@ -14440,10 +15008,11 @@ Index: git/target-i386/mesa_gl.h
+#endif
+
+#endif /* __gl_h_ */
-Index: git/target-i386/mesa_glext.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_glext.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_glext.h b/target-i386/mesa_glext.h
+new file mode 100644
+index 0000000..f8cf2d2
+--- /dev/null
++++ b/target-i386/mesa_glext.h
@@ -0,0 +1,7279 @@
+#ifndef __glext_h_
+#define __glext_h_
@@ -21724,10 +22293,11 @@ Index: git/target-i386/mesa_glext.h
+
+/* ERO */
+GLAPI void GLAPIENTRY fake_gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data);
-Index: git/target-i386/mesa_glu.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_glu.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_glu.h b/target-i386/mesa_glu.h
+new file mode 100644
+index 0000000..f1a704b
+--- /dev/null
++++ b/target-i386/mesa_glu.h
@@ -0,0 +1,354 @@
+/*
+** License Applicability. Except to the extent portions of this file are
@@ -22083,10 +22653,11 @@ Index: git/target-i386/mesa_glu.h
+#endif
+
+#endif /* __glu_h__ */
-Index: git/target-i386/mesa_glx.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_glx.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_glx.h b/target-i386/mesa_glx.h
+new file mode 100644
+index 0000000..2930461
+--- /dev/null
++++ b/target-i386/mesa_glx.h
@@ -0,0 +1,510 @@
+/*
+ * Mesa 3-D graphics library
@@ -22598,10 +23169,11 @@ Index: git/target-i386/mesa_glx.h
+#endif
+
+#endif
-Index: git/target-i386/mesa_glxext.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_glxext.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_glxext.h b/target-i386/mesa_glxext.h
+new file mode 100644
+index 0000000..0f66df6
+--- /dev/null
++++ b/target-i386/mesa_glxext.h
@@ -0,0 +1,785 @@
+#ifndef __glxext_h_
+#define __glxext_h_
@@ -23388,10 +23960,11 @@ Index: git/target-i386/mesa_glxext.h
+#endif
+
+#endif
-Index: git/target-i386/mesa_mipmap.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/mesa_mipmap.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/mesa_mipmap.c b/target-i386/mesa_mipmap.c
+new file mode 100644
+index 0000000..f623ea1
+--- /dev/null
++++ b/target-i386/mesa_mipmap.c
@@ -0,0 +1,824 @@
+
+/*
@@ -24217,10 +24790,11 @@ Index: git/target-i386/mesa_mipmap.c
+
+ return retval;
+}
-Index: git/target-i386/opengl_exec.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/opengl_exec.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/opengl_exec.c b/target-i386/opengl_exec.c
+new file mode 100644
+index 0000000..4a69b9b
+--- /dev/null
++++ b/target-i386/opengl_exec.c
@@ -0,0 +1,3931 @@
+/*
+ * Host-side implementation of GL/GLX API
@@ -28153,10 +28727,11 @@ Index: git/target-i386/opengl_exec.c
+
+ return ret_int;
+}
-Index: git/target-i386/opengl_func.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/opengl_func.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/opengl_func.h b/target-i386/opengl_func.h
+new file mode 100644
+index 0000000..d1b50fd
+--- /dev/null
++++ b/target-i386/opengl_func.h
@@ -0,0 +1,1108 @@
+/*
+ * Main header for both host and guest sides
@@ -29266,10 +29841,11 @@ Index: git/target-i386/opengl_func.h
+#error Unsupported ABI
+#endif
+#endif
-Index: git/target-i386/opengl_player.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/opengl_player.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/opengl_player.c b/target-i386/opengl_player.c
+new file mode 100644
+index 0000000..f071b7f
+--- /dev/null
++++ b/target-i386/opengl_player.c
@@ -0,0 +1,1461 @@
+/*
+ * Plays a sequence of OpenGL calls recorded either under qemu or with opengl_server
@@ -30732,10 +31308,11 @@ Index: git/target-i386/opengl_player.c
+ }
+ return 0;
+}
-Index: git/target-i386/opengl_server.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/opengl_server.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/opengl_server.c b/target-i386/opengl_server.c
+new file mode 100644
+index 0000000..80060ba
+--- /dev/null
++++ b/target-i386/opengl_server.c
@@ -0,0 +1,826 @@
+/*
+ * TCP/IP OpenGL server
@@ -31563,10 +32140,11 @@ Index: git/target-i386/opengl_server.c
+
+ return 0;
+}
-Index: git/target-i386/opengl_utils.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/opengl_utils.h 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/opengl_utils.h b/target-i386/opengl_utils.h
+new file mode 100644
+index 0000000..01077ff
+--- /dev/null
++++ b/target-i386/opengl_utils.h
@@ -0,0 +1,453 @@
+/*
+ * Functions used by host & client sides
@@ -32021,10 +32599,11 @@ Index: git/target-i386/opengl_utils.h
+}
+
+#endif
-Index: git/target-i386/parse_gl_h.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/parse_gl_h.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/parse_gl_h.c b/target-i386/parse_gl_h.c
+new file mode 100644
+index 0000000..f1e93ec
+--- /dev/null
++++ b/target-i386/parse_gl_h.c
@@ -0,0 +1,1496 @@
+/*
+ * Parse gl.h et glx.h to auto-generate source code
@@ -33522,10 +34101,11 @@ Index: git/target-i386/parse_gl_h.c
+
+ return 0;
+}
-Index: git/target-i386/parse_mesa_get_c.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/target-i386/parse_mesa_get_c.c 2009-05-23 11:22:17.000000000 +0100
+diff --git a/target-i386/parse_mesa_get_c.c b/target-i386/parse_mesa_get_c.c
+new file mode 100644
+index 0000000..b214358
+--- /dev/null
++++ b/target-i386/parse_mesa_get_c.c
@@ -0,0 +1,225 @@
+/*
+ * Parse the "get.c" from mesa source tree to generate "glgetv_cst.h"
@@ -33752,11 +34332,20 @@ Index: git/target-i386/parse_mesa_get_c.c
+ fclose(outf);
+ return 0;
+}
-Index: git/target-i386/translate.c
-===================================================================
---- git.orig/target-i386/translate.c 2009-05-23 11:22:16.000000000 +0100
-+++ git/target-i386/translate.c 2009-05-23 11:22:17.000000000 +0100
-@@ -2592,11 +2592,18 @@
+diff --git a/target-i386/translate.c b/target-i386/translate.c
+index 4b894fd..10920a7 100644
+--- a/target-i386/translate.c
++++ b/target-i386/translate.c
+@@ -741,6 +741,8 @@ static void gen_check_io(DisasContext *s, int ot, target_ulong cur_eip,
+ int state_saved;
+ target_ulong next_eip;
+
++ return;
++
+ state_saved = 0;
+ if (s->pe && (s->cpl > s->iopl || s->vm86)) {
+ if (s->cc_op != CC_OP_DYNAMIC)
+@@ -2592,11 +2594,18 @@ static void gen_exception(DisasContext *s, int trapno, target_ulong cur_eip)
s->is_jmp = 3;
}
@@ -33775,11 +34364,19 @@ Index: git/target-i386/translate.c
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_jmp_im(cur_eip);
-Index: git/vl.c
-===================================================================
---- git.orig/vl.c 2009-05-23 11:22:16.000000000 +0100
-+++ git/vl.c 2009-05-23 11:23:18.000000000 +0100
-@@ -253,6 +253,7 @@
+diff --git a/vl.c b/vl.c
+index 56623fb..095da54 100644
+--- a/vl.c
++++ b/vl.c
+@@ -245,6 +245,7 @@ int semihosting_enabled = 0;
+ #ifdef TARGET_ARM
+ int old_param = 0;
+ #endif
++int force_pointer = 0;
+ const char *qemu_name;
+ int alt_grab = 0;
+ #if defined(TARGET_SPARC) || defined(TARGET_PPC)
+@@ -253,6 +254,7 @@ const char *prom_envs[MAX_PROM_ENVS];
#endif
int nb_drives_opt;
struct drive_opt drives_opt[MAX_DRIVES];
@@ -33787,23 +34384,68 @@ Index: git/vl.c
static CPUState *cur_cpu;
static CPUState *next_cpu;
-@@ -4214,6 +4215,7 @@
+@@ -4208,12 +4210,14 @@ enum {
+ QEMU_OPTION_clock,
+ QEMU_OPTION_localtime,
+ QEMU_OPTION_startdate,
++ QEMU_OPTION_enable_gl,
+ QEMU_OPTION_icount,
+ QEMU_OPTION_echr,
+ QEMU_OPTION_virtiocon,
QEMU_OPTION_show_cursor,
QEMU_OPTION_semihosting,
QEMU_OPTION_old_param,
-+ QEMU_OPTION_enable_gl,
++ QEMU_OPTION_force_pointer,
QEMU_OPTION_tb_size,
QEMU_OPTION_incoming,
QEMU_OPTION_chroot,
-@@ -4345,6 +4347,7 @@
+@@ -4344,6 +4348,8 @@ static const QEMUOption qemu_options[] = {
+ #if defined(TARGET_ARM)
{ "old-param", 0, QEMU_OPTION_old_param },
#endif
- { "tb-size", HAS_ARG, QEMU_OPTION_tb_size },
++ { "force-pointer", 0, QEMU_OPTION_force_pointer },
+ { "enable-gl", 0, QEMU_OPTION_enable_gl },
+ { "tb-size", HAS_ARG, QEMU_OPTION_tb_size },
{ "incoming", HAS_ARG, QEMU_OPTION_incoming },
{ "chroot", HAS_ARG, QEMU_OPTION_chroot },
- { "runas", HAS_ARG, QEMU_OPTION_runas },
-@@ -5261,6 +5264,11 @@
+@@ -4496,22 +4502,17 @@ static void select_vgahw (const char *p)
+ {
+ const char *opts;
+
++ std_vga_enabled = 0;
++ cirrus_vga_enabled = 0;
++ vmsvga_enabled = 0;
++
+ if (strstart(p, "std", &opts)) {
+ std_vga_enabled = 1;
+- cirrus_vga_enabled = 0;
+- vmsvga_enabled = 0;
+ } else if (strstart(p, "cirrus", &opts)) {
+ cirrus_vga_enabled = 1;
+- std_vga_enabled = 0;
+- vmsvga_enabled = 0;
+ } else if (strstart(p, "vmware", &opts)) {
+- cirrus_vga_enabled = 0;
+- std_vga_enabled = 0;
+ vmsvga_enabled = 1;
+ } else if (strstart(p, "none", &opts)) {
+- cirrus_vga_enabled = 0;
+- std_vga_enabled = 0;
+- vmsvga_enabled = 0;
+ } else {
+ invalid_vga:
+ fprintf(stderr, "Unknown vga type: %s\n", p);
+@@ -5220,6 +5221,9 @@ int main(int argc, char **argv, char **envp)
+ old_param = 1;
+ break;
+ #endif
++ case QEMU_OPTION_force_pointer:
++ force_pointer = 1;
++ break;
+ case QEMU_OPTION_clock:
+ configure_alarms(optarg);
+ break;
+@@ -5261,6 +5265,11 @@ int main(int argc, char **argv, char **envp)
}
}
break;
@@ -33815,17 +34457,21 @@ Index: git/vl.c
case QEMU_OPTION_tb_size:
tb_size = strtol(optarg, NULL, 0);
if (tb_size < 0)
-Index: git/hw/opengl_dummy.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ git/hw/opengl_dummy.c 2009-05-23 11:22:17.000000000 +0100
-@@ -0,0 +1,9 @@
-+#include "../qemu-common.h"
-+
-+#include <X11/Xlib.h>
-+#include <X11/Xutil.h>
-+
-+void opengl_exec_set_parent_window(Display *_dpy, Window _parent_window)
-+{
-+ return;
-+}
+@@ -5545,6 +5554,17 @@ int main(int argc, char **argv, char **envp)
+ exit(1);
+ }
+ }
++#ifdef TARGET_OPENGL_OK
++ if (enable_gl) {
++ /* Use second serial port */
++ int opengl_serial = 1;
++
++ if (serial_devices[opengl_serial])
++ fprintf(stderr, "overriding second serial "
++ "port for OpenGL use\n");
++ serial_devices[opengl_serial] = "opengl";
++ }
++#endif
+
+ if (monitor_device) {
+ monitor_hd = qemu_chr_open("monitor", monitor_device, NULL);
diff --git a/meta/packages/qemu/qemu_git.bb b/meta/packages/qemu/qemu_git.bb
index b92ecf552..bdd18e8fc 100644
--- a/meta/packages/qemu/qemu_git.bb
+++ b/meta/packages/qemu/qemu_git.bb
@@ -1,28 +1,19 @@
LICENSE = "GPL"
DEPENDS = "zlib"
PV = "0.10.2+git${SRCREV}"
-PR = "r1"
+PR = "r4"
FILESPATH = "${FILE_DIRNAME}/qemu-${PV}/:${FILE_DIRNAME}/qemu-git/"
SRC_URI = "\
git://git.sv.gnu.org/qemu.git;protocol=git \
- file://06_exit_segfault.patch;patch=1;pnum=0 \
- file://11_signal_sigaction.patch;patch=1;pnum=0 \
- file://22_net_tuntap_stall.patch;patch=1;pnum=0 \
- file://31_syscalls.patch;patch=1;pnum=0 \
- file://52_ne2000_return.patch;patch=1;pnum=1 \
- file://63_sparc_build.patch;patch=1;pnum=0 \
- file://66_tls_ld.patch;patch=1;pnum=0 \
- file://91-oh-sdl-cursor.patch;patch=1;pnum=0 \
file://workaround_bad_futex_headers.patch;patch=1 \
- file://qemu-add-gl-host-code.patch;patch=1 \
+ file://qemu-git-qemugl-host.patch;patch=1 \
file://no-strip.patch;patch=1 \
file://fix-dirent.patch;patch=1 \
+ file://fix-nogl.patch;patch=1 \
file://zlibsearch.patch;patch=1 "
-# file://qemu-amd64-32b-mapping-0.9.0.patch;patch=1
-
S = "${WORKDIR}/git"
#EXTRA_OECONF += "--disable-sdl"