summaryrefslogtreecommitdiffstats
path: root/src/mesa/x86/glapi_x86.S
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-06-12 09:47:03 -0600
committerBrian <[email protected]>2007-06-12 09:47:03 -0600
commitedf07417be431ec36c340e21c6c4b6d51eb74363 (patch)
tree65ebde8f1fab55b4a928c151faae42f92ae12e88 /src/mesa/x86/glapi_x86.S
parentc1ba308e6499a6eb3f970b81a3f25d63da988d1c (diff)
Fix TEXREL issues when using GLX_USE_TLS (see bug 7459).
Diffstat (limited to 'src/mesa/x86/glapi_x86.S')
-rw-r--r--src/mesa/x86/glapi_x86.S14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S
index bdf42ac0887..74e93721bc3 100644
--- a/src/mesa/x86/glapi_x86.S
+++ b/src/mesa/x86/glapi_x86.S
@@ -58,12 +58,17 @@
#ifdef GLX_USE_TLS
+#ifdef GLX_X86_READONLY_TEXT
+# define CTX_INSNS MOV_L(GS:(EAX), EAX)
+#else
+# define CTX_INSNS NOP /* Pad for init_glapi_relocs() */
+#endif
# define GL_STUB(fn,off,fn_alt) \
ALIGNTEXT16; \
GLOBL_FN(GL_PREFIX(fn, fn_alt)); \
GL_PREFIX(fn, fn_alt): \
CALL(_x86_get_dispatch) ; \
- NOP ; \
+ CTX_INSNS ; \
JMP(GL_OFFSET(off))
#elif defined(PTHREADS)
@@ -114,7 +119,10 @@ SEG_TEXT
HIDDEN(GLNAME(_x86_get_dispatch))
ALIGNTEXT16
GLNAME(_x86_get_dispatch):
- movl %gs:_glapi_tls_Dispatch@NTPOFF, %eax
+ call 1f
+1: popl %eax
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax
+ movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax
ret
#elif defined(PTHREADS)
@@ -133,7 +141,7 @@ GLNAME(_x86_get_dispatch):
EXTERN GLNAME(_glapi_get_dispatch)
#endif
-#if defined( GLX_USE_TLS )
+#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT )
.section wtext, "awx", @progbits
#endif /* defined( GLX_USE_TLS ) */