summaryrefslogtreecommitdiff
path: root/src/mesa/glapi/glapi.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-07-05 11:36:44 -0700
committerEric Anholt <eric@anholt.net>2007-07-05 11:36:44 -0700
commit3cf20ddbfc9d3a1dad4c058050595c54589257d3 (patch)
tree57de53410bb0fb40979eed20d3c80d4c0ed68664 /src/mesa/glapi/glapi.c
parent2ac17c68e2d64260168a54a275e839775828f534 (diff)
parent4fe48b4e8568896cdbc822323aeec0a41c72ff2a (diff)
Merge branch 'i915-unification' of git+ssh://people.freedesktop.org/~anholt/mesa into i915-unification
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) */