diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-03-22 01:10:49 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-03-22 01:10:49 +0000 |
commit | 5e512e21e744a8ded6342b83ce1efafb3dae1598 (patch) | |
tree | 66396110801f5b874064a8075f2342d4c1508095 /lib | |
parent | 96feab4382d7262087879bf0625f9d9383b270cf (diff) |
tfork_thread has been moved to libc
Diffstat (limited to 'lib')
-rw-r--r-- | lib/librthread/arch/alpha/rfork_thread.S | 57 | ||||
-rw-r--r-- | lib/librthread/arch/amd64/rfork_thread.S | 94 | ||||
-rw-r--r-- | lib/librthread/arch/arm/rfork_thread.S | 48 | ||||
-rw-r--r-- | lib/librthread/arch/hppa/rfork_thread.S | 65 | ||||
-rw-r--r-- | lib/librthread/arch/i386/rfork_thread.S | 122 | ||||
-rw-r--r-- | lib/librthread/arch/m68k/rfork_thread.S | 70 | ||||
-rw-r--r-- | lib/librthread/arch/m88k/rfork_thread.S | 55 | ||||
-rw-r--r-- | lib/librthread/arch/mips64/rfork_thread.S | 80 | ||||
-rw-r--r-- | lib/librthread/arch/powerpc/rfork_thread.S | 53 | ||||
-rw-r--r-- | lib/librthread/arch/sh/rfork_thread.S | 61 | ||||
-rw-r--r-- | lib/librthread/arch/sparc/rfork_thread.S | 74 | ||||
-rw-r--r-- | lib/librthread/arch/sparc64/rfork_thread.S | 73 | ||||
-rw-r--r-- | lib/librthread/arch/vax/rfork_thread.S | 69 |
13 files changed, 0 insertions, 921 deletions
diff --git a/lib/librthread/arch/alpha/rfork_thread.S b/lib/librthread/arch/alpha/rfork_thread.S deleted file mode 100644 index 3cd2ab68106..00000000000 --- a/lib/librthread/arch/alpha/rfork_thread.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.4 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/alpha/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -LEAF(__tfork_thread,0) - /* a0 = flags, a1 = stack, a2 = func, a3 = arg */ - mov a3, a5 - CALLSYS_ERROR(__tfork) - - beq v0, 1f - - /* - * In parent process: just return. - */ - RET - -1: - /* - * In child process: switch stack, invoke function, then exit. - */ - mov a1, sp /* stack */ - mov a5, a0 /* arg */ - mov a2, pv /* func */ - jsr ra, (pv) - - mov zero, a0 - CALLSYS_NOERROR(__threxit) - -END(__tfork_thread) diff --git a/lib/librthread/arch/amd64/rfork_thread.S b/lib/librthread/arch/amd64/rfork_thread.S deleted file mode 100644 index d5bd9a428eb..00000000000 --- a/lib/librthread/arch/amd64/rfork_thread.S +++ /dev/null @@ -1,94 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.6 2012/01/17 02:34:18 guenther Exp $ */ -/*- - * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> - * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -#if 0 -__FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/amd64/gen/rfork_thread.S,v 1.1 2003/10/13 20:32:33 alc Exp $"); -#endif - -/* - * With thanks to John Dyson for the original version of this. - */ - -#include "../../../libc/arch/amd64/SYS.h" - -/* - * %rdi %rsi %rdx %rcx - * __tfork_thread(param, stack_addr, start_fnc, start_arg); - * - * param: Argument to pass to the actual kernel call. - * stack_addr: Top of stack for thread. - * start_fnc: Address of thread function to call in child. - * start_arg: Argument to pass to the thread function in child. - */ - -ENTRY(__tfork_thread) - movq %rdx, %r8 - movq %rcx, %r9 - - /* - * Prepare and execute the thread creation syscall - */ - movl $SYS___tfork, %eax - syscall - jb 2f - - /* - * Check to see if we are in the parent or child - */ - cmpl $0, %edx - jnz 1f - ret - - /* - * If we are in the child (new thread), then - * set-up the call to the internal subroutine. If it - * returns, then call __threxit. - */ -1: - movq %rsi, %rsp - movq %r9, %rdi - call *%r8 - - /* - * Thread exit system call - */ - movl $SYS___threxit, %eax - xorl %edi, %edi - syscall - - /* - * Branch here if the thread creation fails: - */ -2: -#ifdef PIC - movq PIC_GOT(CERROR), %rcx - jmp *%rcx -#else - jmp CERROR -#endif diff --git a/lib/librthread/arch/arm/rfork_thread.S b/lib/librthread/arch/arm/rfork_thread.S deleted file mode 100644 index 749ba0490fa..00000000000 --- a/lib/librthread/arch/arm/rfork_thread.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.4 2012/01/17 02:34:18 guenther Exp $ */ -/* - * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include <sys/syscall.h> -#include <machine/asm.h> -#include "../../../libc/arch/arm/SYS.h" - -/* - * r0 r1 r2 r3 - * __tfork_thread(param, stack_addr, start_fnc, start_arg); - */ - -ENTRY(__tfork_thread) - stmdb sp!, {r4} - mov r4, r1 - - - SYSTRAP(__tfork) - bcs 1f - - /* check if we are parent or child */ - cmp r0, #0 - ldmneia sp!, {r4} - movne pc, lr - - /* child */ - mov sp, r4 - mov r0, r3 - mov lr, pc - mov pc, r2 - nop - SYSTRAP(__threxit) -1: - ldmia sp!, {r4} - b PIC_SYM(CERROR, PLT) diff --git a/lib/librthread/arch/hppa/rfork_thread.S b/lib/librthread/arch/hppa/rfork_thread.S deleted file mode 100644 index e29488db4d1..00000000000 --- a/lib/librthread/arch/hppa/rfork_thread.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.3 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/hppa/SYS.h" - -/* - * int __tfork_thread(param, void *stack, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread, 0) - SYSCALL(__tfork) - comb,<> r0, ret0, 1f - nop - - /* - * In child process: switch stack, invoke function, then exit. - */ - - /* - * PIC code expects 32 bytes of room available below sp. - * Then the regular procedure invocation requires us to allocate - * 64 bytes as well. - */ - copy arg1, sp - ldo 0(sp), r3 - stw,ma r0, HPPA_FRAME_SIZE(sp) - stw r0, HPPA_FRAME_CRP(sp) - stw r0, HPPA_FRAME_PSP(sp) - - copy arg3, arg0 /* arg */ - copy arg2, t1 - bl $$dyncall, r31 - copy r31, rp - - copy r0, arg0 - SYSCALL(__threxit) - -1: - bv r0(rp) - nop - -EXIT(__tfork_thread) diff --git a/lib/librthread/arch/i386/rfork_thread.S b/lib/librthread/arch/i386/rfork_thread.S deleted file mode 100644 index 9fe8da9310c..00000000000 --- a/lib/librthread/arch/i386/rfork_thread.S +++ /dev/null @@ -1,122 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.5 2012/01/17 02:34:18 guenther Exp $ */ -/*- - * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/asm.h> -#if 0 -__FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/i386/gen/rfork_thread.S,v 1.5 2003/05/07 17:23:25 jhb Exp $"); -#endif - -/* - * With thanks to John Dyson for the original version of this. - */ - -#include "../../../libc/arch/i386/SYS.h" - -/* - * 8 12 16 20 - * __tfork_thread(param, stack_addr, start_fnc, start_arg); - * - * param: Arguments to actual system call. - * stack_addr: Top of stack for thread. - * start_fnc: Address of thread function to call in child. - * start_arg: Argument to pass to the thread function in child. - */ - -ENTRY(__tfork_thread) - pushl %ebp - movl %esp, %ebp - pushl %esi - - /* - * Push thread info onto the new thread's stack - */ - movl 12(%ebp), %esi # get stack addr - - subl $4, %esi - movl 20(%ebp), %eax # get start argument - movl %eax, (%esi) - - subl $4, %esi - movl 16(%ebp), %eax # get start thread address - movl %eax, (%esi) - - /* - * Prepare and execute the thread creation syscall - */ - pushl 8(%ebp) - pushl $0 - movl $SYS___tfork, %eax - int $0x80 - jb 2f - - /* - * Check to see if we are in the parent or child - */ - cmpl $0, %edx - jnz 1f - addl $8, %esp - popl %esi - movl %ebp, %esp - popl %ebp - ret - .p2align 2 - - /* - * If we are in the child (new thread), then - * set-up the call to the internal subroutine. If it - * returns, then call __exit. - */ -1: - movl %esi,%esp - popl %eax - call *%eax - addl $4, %esp - - /* - * Exit system call - */ - pushl %eax - pushl $0 - movl $SYS___threxit, %eax - int $0x80 - - /* - * Branch here if the thread creation fails: - */ -2: - addl $8, %esp - popl %esi - movl %ebp, %esp - popl %ebp -#ifdef PIC - PIC_PROLOGUE - movl PIC_GOT(CERROR), %ecx - PIC_EPILOGUE - jmp *%ecx -#else - jmp CERROR -#endif diff --git a/lib/librthread/arch/m68k/rfork_thread.S b/lib/librthread/arch/m68k/rfork_thread.S deleted file mode 100644 index 3931a4a8eb1..00000000000 --- a/lib/librthread/arch/m68k/rfork_thread.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.3 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/m68k/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread) - /* - * Set up the new thread's stack. - */ - movl sp@(8), a0 /* stack */ - movl sp@(16), a0@- /* arg */ - movl sp@(12), a1 /* func */ - - /* - * We did not create a frame, so the stack is ready for an immediate - * system call invocation. - */ - __DO_SYSCALL(__tfork) - jcs 9f - - tstl d0 - jeq 1f - - /* - * parent process: just return. - */ - rts - -1: - /* - * child process: switch stacks, invoke function, then exit. - */ - movl a0, sp /* stack with arg pushed on it */ - jsr a1@ /* func */ - addq #4, sp - - __DO_SYSCALL(__threxit) - -9: - /* - * system call failure. - */ - jra __cerror diff --git a/lib/librthread/arch/m88k/rfork_thread.S b/lib/librthread/arch/m88k/rfork_thread.S deleted file mode 100644 index d8f7657bd30..00000000000 --- a/lib/librthread/arch/m88k/rfork_thread.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.3 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/m88k/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread) - or r6, r3, r0 /* save stack */ - or r13, r0, __SYSCALLNAME(SYS_,__tfork) - tb0 0, r0, 128 /* corrupts r2 and r3 in the child */ - br __cerror - - bcnd eq0, r2, 1f - - /* - * In parent process: just return. - */ - jmp r1 - -1: - /* - * In child process: switch stack, invoke function, then exit. - */ - or r31, r6, r0 /* stack */ - jsr.n r4 /* func */ - or r2, r5, r0 /* arg */ - - or r13, r0, __SYSCALLNAME(SYS_,__threxit) - tb0 0, r0, 128 diff --git a/lib/librthread/arch/mips64/rfork_thread.S b/lib/librthread/arch/mips64/rfork_thread.S deleted file mode 100644 index 500f9a19495..00000000000 --- a/lib/librthread/arch/mips64/rfork_thread.S +++ /dev/null @@ -1,80 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.4 2012/02/17 18:02:18 miod Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/mips64/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -FRAMESZ=4*REGSZ -GPOFF=FRAMESZ-2*REGSZ -LEAF(__tfork_thread, FRAMESZ) - /* a0 = param, a1 = stack, a2 = func, a3 = arg */ - PTR_SUBU sp, FRAMESZ - SETUP_GP64(GPOFF, _C_LABEL(__tfork_thread)) - .set reorder - - move t0, a1 /* stack */ - move t1, a3 /* arg */ - - __DO_SYSCALL(__tfork) - bnez a3, 9f - - RESTORE_GP64 - PTR_ADDU sp, FRAMESZ - - beqz v0, 1f - - /* - * In parent process: just return. - */ - j ra - -1: - /* - * In child process: switch stack, invoke function, then exit. - */ - - move sp, t0 /* stack */ - move t9, a2 /* func */ - move a0, t1 /* arg */ - move v0, zero - jal ra, t9 - - move a0, zero - __DO_SYSCALL(__threxit) - -9: - /* - * System call failure. - */ - LA t9, CERROR - - RESTORE_GP64 - PTR_ADDU sp, FRAMESZ - jr t9 -END(__tfork_thread) diff --git a/lib/librthread/arch/powerpc/rfork_thread.S b/lib/librthread/arch/powerpc/rfork_thread.S deleted file mode 100644 index 103ff9f10a0..00000000000 --- a/lib/librthread/arch/powerpc/rfork_thread.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.5 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005 Tim Wiess <tim@nop.cx> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/syscall.h> -#include <machine/asm.h> - -ENTRY(__tfork_thread) - /* sanity check */ - cmpwi %r4, 0 - beq 1f - cmpwi %r5, 0 - beq 1f - - mr %r7,%r4 - - /* call __tfork */ - li %r0, SYS___tfork - sc - cmpwi %r0, 0 - bne 2f - - /* check if we are parent or child */ - cmpwi %r3, 0 - bnelr - - /* child */ - mtlr %r5 /* fp */ - mr %r3, %r6 /* arg */ - subi %r1, %r7, 16 /* fixup sp to get headroom */ - blrl - - /* child returned, call _exit */ - li %r0, SYS___threxit - sc -1: - li %r3, -1 -2: - b PIC_PLT(_C_LABEL(__cerror)) diff --git a/lib/librthread/arch/sh/rfork_thread.S b/lib/librthread/arch/sh/rfork_thread.S deleted file mode 100644 index 51100162285..00000000000 --- a/lib/librthread/arch/sh/rfork_thread.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.3 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2007 Miodrag Vallat. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice, this permission notice, and the disclaimer below - * appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "../../../libc/arch/sh/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - * r4 r5 r6 r7 - */ -ENTRY(__tfork_thread) - mov.l .LSYS___tfork, r0 - .word 0xc380 /* trapa #0x80 */ - bf 9f - - tst r0, r0 - bt 1f - - /* - * In parent process: just return. - */ - rts - nop - -1: - /* - * In child process: switch stack, invoke function, then exit. - */ - mov r5, sp - jsr @r6 - mov r7, r4 - - mov.l .LSYS___threxit, r0 - .word 0xc380 /* trapa #0x80 */ - -9: - /* - * System call failure. - */ - JUMP_CERROR - - .align 2 -.LSYS___tfork: .long SYS___tfork -.LSYS___threxit: .long SYS___threxit - - SET_ENTRY_SIZE(__tfork_thread) diff --git a/lib/librthread/arch/sparc/rfork_thread.S b/lib/librthread/arch/sparc/rfork_thread.S deleted file mode 100644 index 2feac006077..00000000000 --- a/lib/librthread/arch/sparc/rfork_thread.S +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.3 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/sparc/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread) - mov %o1, %o4 /* save stack */ - - /* - * We can not invoke __tfork as a G2-style system call since we want - * different return paths. - */ - mov SYS___tfork, %g1 - t ST_SYSCALL - bcs 9f - nop - - cmp %o0, 0 - be 1f - nop - - /* - * In parent process: just return. - */ - retl - nop - -1: - /* - * In child process: switch stack, invoke function, then exit. - * Don't forget to allocate room for a window save on the new - * stack! - */ - sub %g0, %g0, %fp - sub %o4, 96, %sp /* stack */ - call %o2 /* func */ - mov %o3, %o0 /* arg */ - - mov SYS___threxit, %g1 - clr %o0 - t ST_SYSCALL /* will not return */ - -9: - /* - * System call failure. - */ - ERROR() diff --git a/lib/librthread/arch/sparc64/rfork_thread.S b/lib/librthread/arch/sparc64/rfork_thread.S deleted file mode 100644 index 86b876db714..00000000000 --- a/lib/librthread/arch/sparc64/rfork_thread.S +++ /dev/null @@ -1,73 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.4 2012/01/17 02:34:18 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/sparc64/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread) - mov %o1, %o4 /* save stack */ - - /* - * We can not invoke __tfork as a G2-style system call since we want - * different return paths. - */ - mov SYS___tfork, %g1 - t ST_SYSCALL - bcs 9f - nop - - cmp %o0, 0 - be 1f - nop - - /* - * In parent process: just return. - */ - retl - nop - -1: - /* - * In child process: switch stack, invoke function, then exit. - */ - - mov %g0, %fp /* clear frame pointer */ - sub %o4, (BIAS + CC64FSZ), %sp /* stack */ - call %o2 /* func */ - mov %o3, %o0 /* arg */ - - mov SYS___threxit, %g1 - clr %o0 - t ST_SYSCALL /* will not return */ - -9: - /* - * System call failure. - */ - ERROR() diff --git a/lib/librthread/arch/vax/rfork_thread.S b/lib/librthread/arch/vax/rfork_thread.S deleted file mode 100644 index 63ff948ad3e..00000000000 --- a/lib/librthread/arch/vax/rfork_thread.S +++ /dev/null @@ -1,69 +0,0 @@ -/* $OpenBSD: rfork_thread.S,v 1.5 2012/02/26 13:13:22 miod Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "../../../libc/arch/vax/SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, void *stack, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread, R2|R3|R4) - /* - * Save thread creation arguments into registers. - */ - movl 8(ap), r2 /* stack */ - movl 12(ap), r3 /* func */ - movl 16(ap), r4 /* arg */ - - __DO_SYSCALL(__tfork) - jcs 9f - - cmpl r0, $0 - beql 1f - - /* - * In parent process: just return. - */ - ret - -1: - /* - * In child process: switch stack, invoke function, then exit. - * Note that since we can not pass a register to calls, we need - * to waste 4 bytes of stack in every thread. - */ - movl r2, sp /* stack */ - pushl r3 /* func */ - pushl r4 /* arg */ - calls $1, *4(sp) /* func */ - - __DO_SYSCALL(__threxit) - -9: - /* - * system call failed. - */ - jmp _C_LABEL(_cerror) |