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>
This commit is contained in:
Zhai Edwin
2012-02-28 16:00:49 +08:00
committed by Richard Purdie
parent 3152baea3e
commit 93d157b724
2 changed files with 39 additions and 3 deletions

View File

@@ -16,8 +16,8 @@ Upstream-Status: Pending
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Index: git/opengl_client.c
===================================================================
--- git.orig/opengl_client.c 2011-09-19 19:44:51.000000000 +0800
+++ git/opengl_client.c 2011-09-22 10:11:04.000000000 +0800
--- git.orig/opengl_client.c 2012-02-28 15:26:28.000000000 +0800
+++ git/opengl_client.c 2012-02-28 15:29:18.000000000 +0800
@@ -1076,23 +1076,29 @@
{
#if defined(__i386__)
@@ -56,3 +56,39 @@ Index: git/opengl_client.c
__asm__ ("mov %%eax, %0"::"m"(ret));
#ifdef WIN32
__asm__ ("movl (%%esp),%%ecx;movl %%ecx,%%fs:0;addl $8,%%esp;" : : : "%ecx");
@@ -1100,20 +1106,27 @@
return ret;
#elif defined(__x86_64__)
int ret;
- __asm__ ("push %rbx");
- __asm__ ("push %rcx");
- __asm__ ("push %rdx");
- __asm__ ("push %rsi");
+ long bx, cx, dx, si;
+
+ /* save registers before opengl call */
+ __asm__ ("mov %%rbx, %0"::"m"(bx));
+ __asm__ ("mov %%rcx, %0"::"m"(cx));
+ __asm__ ("mov %%rdx, %0"::"m"(dx));
+ __asm__ ("mov %%rsi, %0"::"m"(si));
+
__asm__ ("mov %0, %%eax"::"m"(func_number));
__asm__ ("mov %0, %%ebx"::"m"(pid));
__asm__ ("mov %0, %%rcx"::"m"(ret_string));
__asm__ ("mov %0, %%rdx"::"m"(args));
__asm__ ("mov %0, %%rsi"::"m"(args_size));
__asm__ ("int $0x99");
- __asm__ ("pop %rsi");
- __asm__ ("pop %rdx");
- __asm__ ("pop %rcx");
- __asm__ ("pop %rbx");
+
+ /* restore registers */
+ __asm__ ("mov %0, %%rbx"::"m"(bx));
+ __asm__ ("mov %0, %%rcx"::"m"(cx));
+ __asm__ ("mov %0, %%rdx"::"m"(dx));
+ __asm__ ("mov %0, %%rsi"::"m"(si));
+
__asm__ ("mov %%eax, %0"::"m"(ret));
return ret;
#else

View File

@@ -18,7 +18,7 @@ S = "${WORKDIR}/git"
SRCREV = "d888bbc723c00d197d34a39b5b7448660ec1b1c0"
PV = "0.0+git${SRCPV}"
PR = "r8"
PR = "r9"
DEFAULT_PREFERENCE = "-1"