Fix TEXREL issues when using GLX_USE_TLS (see bug 7459).

This commit is contained in:
Brian
2007-06-12 09:47:03 -06:00
parent c1ba308e64
commit edf07417be
3 changed files with 34 additions and 15 deletions

View File

@@ -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) */