summaryrefslogtreecommitdiff
path: root/src/ldso/i386/tlsdesc.s
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-19 02:50:45 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-19 02:50:45 -0400
commit4e0b4a5de735ecb241fadb1e15381c947e16e71f (patch)
treedbb3a6aa3356296b8e66b59ed3fe05e93ef5361c /src/ldso/i386/tlsdesc.s
parent880c479f0e3a798d826c1c91b38d33e2b3e36580 (diff)
downloadmusl-4e0b4a5de735ecb241fadb1e15381c947e16e71f.tar.gz
add tlsdesc support for i386
Diffstat (limited to 'src/ldso/i386/tlsdesc.s')
-rw-r--r--src/ldso/i386/tlsdesc.s27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ldso/i386/tlsdesc.s b/src/ldso/i386/tlsdesc.s
new file mode 100644
index 00000000..3ac61297
--- /dev/null
+++ b/src/ldso/i386/tlsdesc.s
@@ -0,0 +1,27 @@
+.text
+.global __tlsdesc_static
+.type __tlsdesc_static,@function
+__tlsdesc_static:
+ mov 4(%eax),%eax
+ ret
+
+.global __tlsdesc_dynamic
+.type __tlsdesc_dynamic,@function
+__tlsdesc_dynamic:
+ mov 4(%eax),%eax
+ push %edx
+ mov %gs:4,%edx
+ push %ecx
+ mov (%eax),%ecx
+ cmp %ecx,(%edx)
+ jc 1f
+ mov 4(%eax),%eax
+ add (%edx,%ecx,4),%eax
+2: pop %ecx
+ sub %gs:0,%eax
+ pop %edx
+ ret
+1: push %eax
+ call __tls_get_addr
+ pop %ecx
+ jmp 2b