[Mesa-dev] [PATCH 2/4] mapi: Fix x86-64 asm for global-dynamic TLS model

christopher.halse.rogers at canonical.com christopher.halse.rogers at canonical.com
Wed Mar 23 16:33:37 PDT 2011


From: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>

---
 src/mapi/glapi/gen/gl_x86-64_asm.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
index 11cd9af..cfe4238 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -153,8 +153,12 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 		print ''
 		print '\t.p2align\t4,,15'
 		print '_x86_64_get_dispatch:'
-		print '\tmovq\t_glapi_tls_Dispatch at GOTTPOFF(%rip), %rax'
-		print '\tmovq\t%fs:(%rax), %rax'
+		print '\t.byte\t0x66'
+		print '\tleaq\t_glapi_tls_Dispatch at tlsgd(%rip), %rdi'
+		print '\t.word\t0x6666'
+		print '\trex64'
+		print '\tcall\t__tls_get_addr at plt'
+		print '\tmovq\t(%rax), %rax'
 		print '\tret'
 		print '\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch'
 		print ''
@@ -248,7 +252,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 			print '\tHIDDEN(GL_PREFIX(%s))' % (name)
 		print 'GL_PREFIX(%s):' % (name)
 		print '#if defined(GLX_USE_TLS)'
+		save_all_regs(registers)
 		print '\tcall\t_x86_64_get_dispatch at PLT'
+		restore_all_regs(registers)
 		print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
 		print '\tjmp\t*%r11'
 		print '#elif defined(PTHREADS)'
-- 
1.7.4.1



More information about the mesa-dev mailing list