diff options
author | Zhai Edwin <edwin.zhai@intel.com> | 2011-09-22 13:51:24 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-22 08:49:10 +0100 |
commit | 0289683798bb3b6d1cfbf7cccb834b4b78d9bdab (patch) | |
tree | 6157238ed51fd2230931bef0370ed9b6bde75413 /meta/recipes-graphics | |
parent | f800862555b81dec65f3de09a2f7b1a0c97a09c1 (diff) | |
download | poky-0289683798bb3b6d1cfbf7cccb834b4b78d9bdab.tar.gz |
qemugl: Use local variable rather than "push" to save register
New gcc uses "%esp" rather than "%ebp" to index local variable in stack, and
push between save-to/restore-from stack decrease "%esp", which leads wrong
index. Saving registers via local variables to make gcc aware of this and avoid
stack disorder.
[YOCTO #1442] got fixed
(From OE-Core rev: afc9edc27e77e80fdd24b4c8c538f91672940e75)
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics')
-rw-r--r-- | meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch | 58 | ||||
-rw-r--r-- | meta/recipes-graphics/mesa/qemugl_git.bb | 5 |
2 files changed, 61 insertions, 2 deletions
diff --git a/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch new file mode 100644 index 0000000000..c5e3592a74 --- /dev/null +++ b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | Save registers via local variables instead of simple "push", so that gcc become | ||
2 | aware of this operation and avoid stack disorder. | ||
3 | |||
4 | opengl calling (in call_opengl_qemu) includes 4 steps: | ||
5 | 1. prepare opengl parameters on stack | ||
6 | 2. save some "input" register by push | ||
7 | 3. load "input" register with parameters on stack via same index as step 1 | ||
8 | 4. issue "int 0x99" to trap into qemu, who will get parameter in the registers | ||
9 | |||
10 | New gcc uses "%esp" rather than "%ebp" to index local variable in stack, which | ||
11 | leads wrong index in step 3, as push decrease "%esp" automatically. Saving | ||
12 | registers via local variables to fix it. | ||
13 | |||
14 | Upstream-Status: Pending | ||
15 | |||
16 | Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> | ||
17 | Index: git/opengl_client.c | ||
18 | =================================================================== | ||
19 | --- git.orig/opengl_client.c 2011-09-19 19:44:51.000000000 +0800 | ||
20 | +++ git/opengl_client.c 2011-09-22 10:11:04.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"); | ||
diff --git a/meta/recipes-graphics/mesa/qemugl_git.bb b/meta/recipes-graphics/mesa/qemugl_git.bb index 9d5115f43d..1658759258 100644 --- a/meta/recipes-graphics/mesa/qemugl_git.bb +++ b/meta/recipes-graphics/mesa/qemugl_git.bb | |||
@@ -11,13 +11,14 @@ COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)' | |||
11 | 11 | ||
12 | SRC_URI = "git://git.o-hand.com/qemugl.git;protocol=git \ | 12 | SRC_URI = "git://git.o-hand.com/qemugl.git;protocol=git \ |
13 | file://versionfix.patch \ | 13 | file://versionfix.patch \ |
14 | file://remove-x11r6-lib-dir.patch" | 14 | file://remove-x11r6-lib-dir.patch \ |
15 | file://call_opengl_fix.patch" | ||
15 | S = "${WORKDIR}/git" | 16 | S = "${WORKDIR}/git" |
16 | 17 | ||
17 | SRCREV = "d888bbc723c00d197d34a39b5b7448660ec1b1c0" | 18 | SRCREV = "d888bbc723c00d197d34a39b5b7448660ec1b1c0" |
18 | 19 | ||
19 | PV = "0.0+git${SRCPV}" | 20 | PV = "0.0+git${SRCPV}" |
20 | PR = "r7" | 21 | PR = "r8" |
21 | 22 | ||
22 | DEFAULT_PREFERENCE = "-1" | 23 | DEFAULT_PREFERENCE = "-1" |
23 | 24 | ||