summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch')
-rw-r--r--meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch94
1 files changed, 0 insertions, 94 deletions
diff --git a/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch
deleted file mode 100644
index 342f49b717..0000000000
--- a/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch
+++ /dev/null
@@ -1,94 +0,0 @@
1Save registers via local variables instead of simple "push", so that gcc become
2aware of this operation and avoid stack disorder.
3
4opengl calling (in call_opengl_qemu) includes 4 steps:
51. prepare opengl parameters on stack
62. save some "input" register by push
73. load "input" register with parameters on stack via same index as step 1
84. issue "int 0x99" to trap into qemu, who will get parameter in the registers
9
10New gcc uses "%esp" rather than "%ebp" to index local variable in stack, which
11leads wrong index in step 3, as push decrease "%esp" automatically. Saving
12registers via local variables to fix it.
13
14Upstream-Status: Pending
15
16Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
17Index: git/opengl_client.c
18===================================================================
19--- git.orig/opengl_client.c 2012-02-28 15:26:28.000000000 +0800
20+++ git/opengl_client.c 2012-02-28 15:29:18.000000000 +0800
21@@ -1076,23 +1076,29 @@
22 {
23 #if defined(__i386__)
24 int ret;
25+ int bx, cx, dx, si;
26 #ifdef WIN32
27 __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (win32_sigsegv_handler));
28 #endif
29- __asm__ ("push %ebx");
30- __asm__ ("push %ecx");
31- __asm__ ("push %edx");
32- __asm__ ("push %esi");
33+ /* save registers before opengl call */
34+ __asm__ ("mov %%ebx, %0"::"m"(bx));
35+ __asm__ ("mov %%ecx, %0"::"m"(cx));
36+ __asm__ ("mov %%edx, %0"::"m"(dx));
37+ __asm__ ("mov %%esi, %0"::"m"(si));
38+
39 __asm__ ("mov %0, %%eax"::"m"(func_number));
40 __asm__ ("mov %0, %%ebx"::"m"(pid));
41 __asm__ ("mov %0, %%ecx"::"m"(ret_string));
42 __asm__ ("mov %0, %%edx"::"m"(args));
43 __asm__ ("mov %0, %%esi"::"m"(args_size));
44 __asm__ ("int $0x99");
45- __asm__ ("pop %esi");
46- __asm__ ("pop %edx");
47- __asm__ ("pop %ecx");
48- __asm__ ("pop %ebx");
49+
50+ /* restore registers */
51+ __asm__ ("mov %0, %%ebx"::"m"(bx));
52+ __asm__ ("mov %0, %%ecx"::"m"(cx));
53+ __asm__ ("mov %0, %%edx"::"m"(dx));
54+ __asm__ ("mov %0, %%esi"::"m"(si));
55+
56 __asm__ ("mov %%eax, %0"::"m"(ret));
57 #ifdef WIN32
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