summaryrefslogtreecommitdiff
path: root/lib/thread
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-28 20:49:37 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-28 20:49:59 -0700
commite841ef7c45f5ed30368c5070d52e1cf5912a1a41 (patch)
treed5feed38195351396f806766cc4470c32665176c /lib/thread
parent10a209f1937d161e1ff5409deb06253facff73a6 (diff)
downloadmc-e841ef7c45f5ed30368c5070d52e1cf5912a1a41.tar.gz
Move to use libsys's fnclone.
We had our own. We don't need it any more.
Diffstat (limited to 'lib/thread')
-rw-r--r--lib/thread/bld.proj1
-rw-r--r--lib/thread/clone+linux-x64.s27
-rw-r--r--lib/thread/spawn+linux.myr10
3 files changed, 1 insertions, 37 deletions
diff --git a/lib/thread/bld.proj b/lib/thread/bld.proj
index 0e51b03..d93d7b4 100644
--- a/lib/thread/bld.proj
+++ b/lib/thread/bld.proj
@@ -1,6 +1,5 @@
lib thread =
spawn+linux.myr
- clone+linux-x64.s
atomic-impl+x64.s
atomic.myr
;;
diff --git a/lib/thread/clone+linux-x64.s b/lib/thread/clone+linux-x64.s
deleted file mode 100644
index 4ac1cbb..0000000
--- a/lib/thread/clone+linux-x64.s
+++ /dev/null
@@ -1,27 +0,0 @@
-.globl thread$clone
-thread$clone:
- pushq %r15
- movq 16(%rsp),%r15
- /* clone(flags, stack, ptid, tls, ctid, regs) */
- movq $56,%rax /* syscall num */
- /* %rdi: flags */
- /* %rsi: stack */
- /* %rdx: ptid */
- movq %rcx,%r10 /* tls */
- /* %r8: ctid */
- /* %r9: regs */
- syscall
-
- /* fn() */
- testl %eax,%eax
- jnz parent
- call *%r15
-
- /* exit(0) */
- movq $60, %rax /* exit */
- movq $0, %rdi /* arg: 0 */
- syscall
-
-parent:
- popq %r15
- ret
diff --git a/lib/thread/spawn+linux.myr b/lib/thread/spawn+linux.myr
index 13b073a..680f899 100644
--- a/lib/thread/spawn+linux.myr
+++ b/lib/thread/spawn+linux.myr
@@ -7,14 +7,6 @@ pkg thread =
const spawn : (fn : (-> void) -> std.result(tid, byte[:]))
;;
-extern const clone : ( flags : sys.cloneopt, \
- stk : byte#, \
- ptid : sys.pid#, \
- tls : byte#, \
- ctid : sys.pid#, \
- ptreg : byte#, \
- fn : (-> void) \
- -> sys.pid)
/* Holy shit flag mania. */
const Thrflag = sys.Clonevm | sys.Clonefs | sys.Clonefiles | \
sys.Clonesighand | sys.Clonethread |sys.Clonesysvsem | \
@@ -34,7 +26,7 @@ const spawnstk = {fn, sz
-> `std.Fail "couldn't get stack"
;;
- ret = clone(Thrflag, stk, &tid, 0 castto(byte#), &ctid, 0 castto(byte#), fn) castto(tid)
+ ret = sys.fnclone(Thrflag, stk, &tid, 0 castto(byte#), &ctid, 0 castto(byte#), fn) castto(tid)
if ret < 0
std.put("errno={}\n", -ret)
-> `std.Fail "couldn't spawn thread"