diff options
author | 2011-10-13 01:07:01 +0000 | |
---|---|---|
committer | 2011-10-13 01:07:01 +0000 | |
commit | ad44604659a153ad59c1934b8711fa15b1a7fa0c (patch) | |
tree | 4a67b2aad4d5f5825767c9f44665c2f56b679c3a /lib/librthread/arch | |
parent | Localize _new_pexp unconditionally, or rc_read_runfile() (diff) | |
download | wireguard-openbsd-ad44604659a153ad59c1934b8711fa15b1a7fa0c.tar.xz wireguard-openbsd-ad44604659a153ad59c1934b8711fa15b1a7fa0c.zip |
Convert rfork_thread() from int$80 to syscall.
Tune the asm slightly to avoid using the stack and use smaller instructions.
Pass threxit() a NULL pointer.
seemed okay to kettenis@
Diffstat (limited to 'lib/librthread/arch')
-rw-r--r-- | lib/librthread/arch/amd64/rfork_thread.S | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/lib/librthread/arch/amd64/rfork_thread.S b/lib/librthread/arch/amd64/rfork_thread.S index 26a6f9bcc56..636e60724f7 100644 --- a/lib/librthread/arch/amd64/rfork_thread.S +++ b/lib/librthread/arch/amd64/rfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: rfork_thread.S,v 1.3 2009/09/24 19:47:35 guenther Exp $ */ +/* $OpenBSD: rfork_thread.S,v 1.4 2011/10/13 01:07:01 guenther Exp $ */ /*- * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu> @@ -48,16 +48,14 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/amd64/gen/rfork_thread.S,v 1.1 */ ENTRY(rfork_thread) - pushq %rbx - pushq %r12 - movq %rdx, %rbx - movq %rcx, %r12 + movq %rdx, %r8 + movq %rcx, %r9 /* * Prepare and execute the thread creation syscall */ - movq $SYS_rfork, %rax - int $0x80 + movl $SYS_rfork, %eax + syscall jb 2f /* @@ -65,33 +63,29 @@ ENTRY(rfork_thread) */ cmpl $0, %edx jnz 1f - popq %r12 - popq %rbx ret /* * If we are in the child (new thread), then * set-up the call to the internal subroutine. If it - * returns, then call __exit. + * returns, then call threxit. */ 1: movq %rsi, %rsp - movq %r12, %rdi - call *%rbx - movl %eax, %edi + movq %r9, %rdi + call *%r8 /* - * Exit system call + * Thread exit system call */ - movq $SYS_threxit, %rax - int $0x80 + movl $SYS_threxit, %eax + xorl %edi, %edi + syscall /* * Branch here if the thread creation fails: */ 2: - popq %r12 - popq %rbx #ifdef PIC movq PIC_GOT(CERROR), %rcx jmp *%rcx |