summaryrefslogtreecommitdiff
path: root/src/ldso/x86_64
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-19 15:26:04 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-19 15:26:04 -0400
commit39201d07e41ca4cf5f8c35d4663767aa3f75208f (patch)
tree1e9a074237e67621534ae9d0c4fb1521968b35db /src/ldso/x86_64
parent5ba238e1e48d2fe4107e09903b26b2b36aa9e9ff (diff)
downloadmusl-39201d07e41ca4cf5f8c35d4663767aa3f75208f.tar.gz
musl-39201d07e41ca4cf5f8c35d4663767aa3f75208f.tar.bz2
musl-39201d07e41ca4cf5f8c35d4663767aa3f75208f.tar.xz
musl-39201d07e41ca4cf5f8c35d4663767aa3f75208f.zip
add tlsdesc support for x86_64
Diffstat (limited to 'src/ldso/x86_64')
-rw-r--r--src/ldso/x86_64/tlsdesc.s40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ldso/x86_64/tlsdesc.s b/src/ldso/x86_64/tlsdesc.s
new file mode 100644
index 00000000..57b78e0b
--- /dev/null
+++ b/src/ldso/x86_64/tlsdesc.s
@@ -0,0 +1,40 @@
+.text
+.global __tlsdesc_static
+.type __tlsdesc_static,@function
+__tlsdesc_static:
+ mov 8(%rax),%rax
+ ret
+
+.global __tlsdesc_dynamic
+.type __tlsdesc_dynamic,@function
+__tlsdesc_dynamic:
+ mov 8(%rax),%rax
+ push %rdx
+ mov %fs:8,%rdx
+ push %rcx
+ mov (%rax),%rcx
+ cmp %rcx,(%rdx)
+ jc 1f
+ mov 8(%rax),%rax
+ add (%rdx,%rcx,8),%rax
+2: pop %rcx
+ sub %fs:0,%rax
+ pop %rdx
+ ret
+1: push %rdi
+ push %rdi
+ push %rsi
+ push %r8
+ push %r9
+ push %r10
+ push %r11
+ mov %rax,%rdi
+ call __tls_get_addr
+ pop %r11
+ pop %r10
+ pop %r9
+ pop %r8
+ pop %rsi
+ pop %rdi
+ pop %rdi
+ jmp 2b