summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhai Edwin <edwin.zhai@intel.com>2012-02-28 16:00:49 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-28 12:27:53 +0000
commit93d157b7245182d88395b2e361db28528dd3af19 (patch)
treebb18925a26039085d7ed41dd117cd92d7cc1899b
parent3152baea3e1f95c37688a92d6641d3c12e03bfb6 (diff)
downloadpoky-93d157b7245182d88395b2e361db28528dd3af19.tar.gz
qemugl: Fix gl apps failure on qemu-x86-64
Extend commit 028968 to qemu x86-64, where stack disorder happen due to register handling via push/pop. [YOCTO #1927] fixed (From OE-Core rev: 70c224d80c2330cbb0fa8213b0c0d5a1c87459f6) Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch40
-rw-r--r--meta/recipes-graphics/mesa/qemugl_git.bb2
2 files changed, 39 insertions, 3 deletions
diff --git a/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch
index c5e3592a74..342f49b717 100644
--- a/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch
+++ b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch
@@ -16,8 +16,8 @@ Upstream-Status: Pending
16Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> 16Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
17Index: git/opengl_client.c 17Index: git/opengl_client.c
18=================================================================== 18===================================================================
19--- git.orig/opengl_client.c 2011-09-19 19:44:51.000000000 +0800 19--- git.orig/opengl_client.c 2012-02-28 15:26:28.000000000 +0800
20+++ git/opengl_client.c 2011-09-22 10:11:04.000000000 +0800 20+++ git/opengl_client.c 2012-02-28 15:29:18.000000000 +0800
21@@ -1076,23 +1076,29 @@ 21@@ -1076,23 +1076,29 @@
22 { 22 {
23 #if defined(__i386__) 23 #if defined(__i386__)
@@ -56,3 +56,39 @@ Index: git/opengl_client.c
56 __asm__ ("mov %%eax, %0"::"m"(ret)); 56 __asm__ ("mov %%eax, %0"::"m"(ret));
57 #ifdef WIN32 57 #ifdef WIN32
58 __asm__ ("movl (%%esp),%%ecx;movl %%ecx,%%fs:0;addl $8,%%esp;" : : : "%ecx"); 58 __asm__ ("movl (%%esp),%%ecx;movl %%ecx,%%fs:0;addl $8,%%esp;" : : : "%ecx");
59@@ -1100,20 +1106,27 @@
60 return ret;
61 #elif defined(__x86_64__)
62 int ret;
63- __asm__ ("push %rbx");
64- __asm__ ("push %rcx");
65- __asm__ ("push %rdx");
66- __asm__ ("push %rsi");
67+ long bx, cx, dx, si;
68+
69+ /* save registers before opengl call */
70+ __asm__ ("mov %%rbx, %0"::"m"(bx));
71+ __asm__ ("mov %%rcx, %0"::"m"(cx));
72+ __asm__ ("mov %%rdx, %0"::"m"(dx));
73+ __asm__ ("mov %%rsi, %0"::"m"(si));
74+
75 __asm__ ("mov %0, %%eax"::"m"(func_number));
76 __asm__ ("mov %0, %%ebx"::"m"(pid));
77 __asm__ ("mov %0, %%rcx"::"m"(ret_string));
78 __asm__ ("mov %0, %%rdx"::"m"(args));
79 __asm__ ("mov %0, %%rsi"::"m"(args_size));
80 __asm__ ("int $0x99");
81- __asm__ ("pop %rsi");
82- __asm__ ("pop %rdx");
83- __asm__ ("pop %rcx");
84- __asm__ ("pop %rbx");
85+
86+ /* restore registers */
87+ __asm__ ("mov %0, %%rbx"::"m"(bx));
88+ __asm__ ("mov %0, %%rcx"::"m"(cx));
89+ __asm__ ("mov %0, %%rdx"::"m"(dx));
90+ __asm__ ("mov %0, %%rsi"::"m"(si));
91+
92 __asm__ ("mov %%eax, %0"::"m"(ret));
93 return ret;
94 #else
diff --git a/meta/recipes-graphics/mesa/qemugl_git.bb b/meta/recipes-graphics/mesa/qemugl_git.bb
index e3552eceb5..66f4e17beb 100644
--- a/meta/recipes-graphics/mesa/qemugl_git.bb
+++ b/meta/recipes-graphics/mesa/qemugl_git.bb
@@ -18,7 +18,7 @@ S = "${WORKDIR}/git"
18SRCREV = "d888bbc723c00d197d34a39b5b7448660ec1b1c0" 18SRCREV = "d888bbc723c00d197d34a39b5b7448660ec1b1c0"
19 19
20PV = "0.0+git${SRCPV}" 20PV = "0.0+git${SRCPV}"
21PR = "r8" 21PR = "r9"
22 22
23DEFAULT_PREFERENCE = "-1" 23DEFAULT_PREFERENCE = "-1"
24 24