summaryrefslogtreecommitdiff
path: root/src/mesa/glapi/glapi.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-06-12 09:47:03 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-06-12 09:47:03 -0600
commitedf07417be431ec36c340e21c6c4b6d51eb74363 (patch)
tree65ebde8f1fab55b4a928c151faae42f92ae12e88 /src/mesa/glapi/glapi.c
parentc1ba308e6499a6eb3f970b81a3f25d63da988d1c (diff)
Fix TEXREL issues when using GLX_USE_TLS (see bug 7459).
Diffstat (limited to 'src/mesa/glapi/glapi.c')
-rw-r--r--src/mesa/glapi/glapi.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index 5815dbff84..47c5782273 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -1028,22 +1028,24 @@ _glapi_check_table(const struct _glapi_table *table)
#if defined(PTHREADS) || defined(GLX_USE_TLS)
/**
* Perform platform-specific GL API entry-point fixups.
- *
- *
*/
static void
init_glapi_relocs( void )
{
-#if defined( USE_X86_ASM ) && defined( GLX_USE_TLS )
- extern void * _x86_get_dispatch(void);
- const GLubyte * const get_disp = (const GLubyte *) _x86_get_dispatch;
+#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
+ extern unsigned long _x86_get_dispatch(void);
+ char run_time_patch[] = {
+ 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
+ };
+ GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
+ const GLubyte * const get_disp = (const GLubyte *) run_time_patch;
GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start;
-
+ *offset = _x86_get_dispatch();
while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
- (void) memcpy( curr_func, get_disp, 6 );
+ (void) memcpy( curr_func, get_disp, sizeof(run_time_patch));
curr_func += DISPATCH_FUNCTION_SIZE;
}
-#endif /* defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) */
-}
#endif
+}
+#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */