summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/thread/i386
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/thread/i386')
-rw-r--r--libc-top-half/musl/src/thread/i386/__set_thread_area.s47
-rw-r--r--libc-top-half/musl/src/thread/i386/__unmapself.s11
-rw-r--r--libc-top-half/musl/src/thread/i386/clone.s49
-rw-r--r--libc-top-half/musl/src/thread/i386/syscall_cp.s41
-rw-r--r--libc-top-half/musl/src/thread/i386/tls.s9
5 files changed, 157 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/thread/i386/__set_thread_area.s b/libc-top-half/musl/src/thread/i386/__set_thread_area.s
new file mode 100644
index 0000000..aa6852b
--- /dev/null
+++ b/libc-top-half/musl/src/thread/i386/__set_thread_area.s
@@ -0,0 +1,47 @@
+.text
+.global __set_thread_area
+.hidden __set_thread_area
+.type __set_thread_area,@function
+__set_thread_area:
+ push %ebx
+ push $0x51
+ push $0xfffff
+ push 16(%esp)
+ call 1f
+1: addl $4f-1b,(%esp)
+ pop %ecx
+ mov (%ecx),%edx
+ push %edx
+ mov %esp,%ebx
+ xor %eax,%eax
+ mov $243,%al
+ int $128
+ testl %eax,%eax
+ jnz 2f
+ movl (%esp),%edx
+ movl %edx,(%ecx)
+ leal 3(,%edx,8),%edx
+3: movw %dx,%gs
+1:
+ addl $16,%esp
+ popl %ebx
+ ret
+2:
+ mov %ebx,%ecx
+ xor %eax,%eax
+ xor %ebx,%ebx
+ xor %edx,%edx
+ mov %ebx,(%esp)
+ mov $1,%bl
+ mov $16,%dl
+ mov $123,%al
+ int $128
+ testl %eax,%eax
+ jnz 1b
+ mov $7,%dl
+ inc %al
+ jmp 3b
+
+.data
+ .align 4
+4: .long -1
diff --git a/libc-top-half/musl/src/thread/i386/__unmapself.s b/libc-top-half/musl/src/thread/i386/__unmapself.s
new file mode 100644
index 0000000..d656959
--- /dev/null
+++ b/libc-top-half/musl/src/thread/i386/__unmapself.s
@@ -0,0 +1,11 @@
+.text
+.global __unmapself
+.type __unmapself,@function
+__unmapself:
+ movl $91,%eax
+ movl 4(%esp),%ebx
+ movl 8(%esp),%ecx
+ int $128
+ xorl %ebx,%ebx
+ movl $1,%eax
+ int $128
diff --git a/libc-top-half/musl/src/thread/i386/clone.s b/libc-top-half/musl/src/thread/i386/clone.s
new file mode 100644
index 0000000..e237d3c
--- /dev/null
+++ b/libc-top-half/musl/src/thread/i386/clone.s
@@ -0,0 +1,49 @@
+.text
+.global __clone
+.hidden __clone
+.type __clone,@function
+__clone:
+ push %ebp
+ mov %esp,%ebp
+ push %ebx
+ push %esi
+ push %edi
+
+ xor %eax,%eax
+ push $0x51
+ mov %gs,%ax
+ push $0xfffff
+ shr $3,%eax
+ push 28(%ebp)
+ push %eax
+ mov $120,%al
+
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%ebx
+ and $-16,%ecx
+ sub $16,%ecx
+ mov 20(%ebp),%edi
+ mov %edi,(%ecx)
+ mov 24(%ebp),%edx
+ mov %esp,%esi
+ mov 32(%ebp),%edi
+ mov 8(%ebp),%ebp
+ int $128
+ test %eax,%eax
+ jnz 1f
+
+ mov %ebp,%eax
+ xor %ebp,%ebp
+ call *%eax
+ mov %eax,%ebx
+ xor %eax,%eax
+ inc %eax
+ int $128
+ hlt
+
+1: add $16,%esp
+ pop %edi
+ pop %esi
+ pop %ebx
+ pop %ebp
+ ret
diff --git a/libc-top-half/musl/src/thread/i386/syscall_cp.s b/libc-top-half/musl/src/thread/i386/syscall_cp.s
new file mode 100644
index 0000000..7dce1eb
--- /dev/null
+++ b/libc-top-half/musl/src/thread/i386/syscall_cp.s
@@ -0,0 +1,41 @@
+.text
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
+.global __syscall_cp_asm
+.hidden __syscall_cp_asm
+.type __syscall_cp_asm,@function
+__syscall_cp_asm:
+ mov 4(%esp),%ecx
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+ pushl %ebp
+__cp_begin:
+ movl (%ecx),%eax
+ testl %eax,%eax
+ jnz __cp_cancel
+ movl 24(%esp),%eax
+ movl 28(%esp),%ebx
+ movl 32(%esp),%ecx
+ movl 36(%esp),%edx
+ movl 40(%esp),%esi
+ movl 44(%esp),%edi
+ movl 48(%esp),%ebp
+ int $128
+__cp_end:
+ popl %ebp
+ popl %edi
+ popl %esi
+ popl %ebx
+ ret
+__cp_cancel:
+ popl %ebp
+ popl %edi
+ popl %esi
+ popl %ebx
+ jmp __cancel
diff --git a/libc-top-half/musl/src/thread/i386/tls.s b/libc-top-half/musl/src/thread/i386/tls.s
new file mode 100644
index 0000000..6e4c4cb
--- /dev/null
+++ b/libc-top-half/musl/src/thread/i386/tls.s
@@ -0,0 +1,9 @@
+.text
+.global ___tls_get_addr
+.type ___tls_get_addr,@function
+___tls_get_addr:
+ mov %gs:4,%edx
+ mov (%eax),%ecx
+ mov 4(%eax),%eax
+ add (%edx,%ecx,4),%eax
+ ret