diff options
Diffstat (limited to 'lib/libc/powerpc/sys')
-rw-r--r-- | lib/libc/powerpc/sys/Makefile.inc | 11 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/brk.S | 73 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/cerror.S | 57 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/exect.S | 39 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/pipe.S | 43 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/ptrace.S | 58 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/sbrk.S | 70 | ||||
-rw-r--r-- | lib/libc/powerpc/sys/setlogin.S | 49 |
8 files changed, 400 insertions, 0 deletions
diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc new file mode 100644 index 0000000..84579ae --- /dev/null +++ b/lib/libc/powerpc/sys/Makefile.inc @@ -0,0 +1,11 @@ +# $FreeBSD$ + +MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S + +# Don't generate default code for these syscalls: +NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ + pwrite.o setdomainname.o sstk.o truncate.o uname.o yield.o + +PSEUDO= _getlogin.o _exit.o + diff --git a/lib/libc/powerpc/sys/brk.S b/lib/libc/powerpc/sys/brk.S new file mode 100644 index 0000000..9223db3 --- /dev/null +++ b/lib/libc/powerpc/sys/brk.S @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: brk.S,v 1.9 2000/06/26 06:25:43 kleink Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + + .globl HIDENAME(curbrk) + .globl HIDENAME(minbrk) + .globl CNAME(_end) + + .data +HIDENAME(minbrk): + .long CNAME(_end) + + .text + +ENTRY(brk) +#ifdef PIC + mflr %r10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr %r9 + mtlr %r10 + lwz %r5,HIDENAME(minbrk)@got(%r9) + lwz %r6,0(%r5) +#else + lis %r5,HIDENAME(minbrk)@ha + lwz %r6,HIDENAME(minbrk)@l(%r5) +#endif + cmplw %r6,%r3 /* if (minbrk <= r3) */ + bgt 0f + mr %r6,%r3 /* r6 = r3 */ +0: + mr %r3,%r6 /* new break value */ + li %r0,SYS_break + sc /* assume, that r5 is kept */ + bso 1f +#ifdef PIC + lwz %r7,HIDENAME(curbrk)@got(%r9) + stw %r6,0(%r7) +#else + lis %r7,HIDENAME(curbrk)@ha /* record new break */ + stw %r6,HIDENAME(curbrk)@l(%r7) +#endif + blr /* return 0 */ + +1: + b PIC_PLT(HIDENAME(cerror)) diff --git a/lib/libc/powerpc/sys/cerror.S b/lib/libc/powerpc/sys/cerror.S new file mode 100644 index 0000000..91a3006 --- /dev/null +++ b/lib/libc/powerpc/sys/cerror.S @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: cerror.S,v 1.5 2000/01/27 14:58:48 kleink Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + + .globl HIDENAME(cerror) + .globl CNAME(__error) + + /* + * The __error() function is thread aware. For non-threaded + * programs and the initial threaded in threaded programs, + * it returns a pointer to the global errno variable. + */ +HIDENAME(cerror): + mflr %r0 + stwu %r1,-16(%r1) /* allocate new stack frame */ + stw %r0,20(%r1) /* and save lr, r31 */ + stw %r31,8(%r1) + mr %r31,%r3 /* stash errval in callee-saved register */ + bl PIC_PLT(CNAME(__error)) + stw %r31,0(%r3) /* store errval into &errno */ + lwz %r0,20(%r1) + lwz %r31,8(%r1) + mtlr %r0 + la %r1,16(%r1) + li %r3,-1 + li %r4,-1 + blr /* return to callers caller */ + + diff --git a/lib/libc/powerpc/sys/exect.S b/lib/libc/powerpc/sys/exect.S new file mode 100644 index 0000000..d5f9c20 --- /dev/null +++ b/lib/libc/powerpc/sys/exect.S @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: exect.S,v 1.3 1998/05/25 15:28:03 ws Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + +ENTRY(exect) + li %r0,SYS_execve + sc + bso 1f + blr +1: + b PIC_PLT(HIDENAME(cerror)) diff --git a/lib/libc/powerpc/sys/pipe.S b/lib/libc/powerpc/sys/pipe.S new file mode 100644 index 0000000..3ca2358 --- /dev/null +++ b/lib/libc/powerpc/sys/pipe.S @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: pipe.S,v 1.6 2000/09/28 08:38:54 kleink Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + +ENTRY(pipe) + mr %r5,%r3 /* save pointer */ + li %r0,SYS_pipe + sc /* r5 is preserved */ + bso 1f + stw %r3,0(%r5) /* success, store fds */ + stw %r4,4(%r5) + li %r3,0 + blr /* and return 0 */ +1: + b PIC_PLT(HIDENAME(cerror)) diff --git a/lib/libc/powerpc/sys/ptrace.S b/lib/libc/powerpc/sys/ptrace.S new file mode 100644 index 0000000..f47fc67 --- /dev/null +++ b/lib/libc/powerpc/sys/ptrace.S @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: ptrace.S,v 1.3 2000/02/23 20:16:57 kleink Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + +ENTRY(ptrace) + mflr %r0 + stwu %r1,-32(%r1) + stw %r0,36(%r1) + stw %r3,8(%r1) + stw %r4,12(%r1) + stw %r5,16(%r1) + stw %r6,20(%r1) + + bl PIC_PLT(CNAME(__error)) + li %r7,0 + stw %r7,0(%r3) + + lwz %r3,8(%r1) + lwz %r4,12(%r1) + lwz %r5,16(%r1) + lwz %r0,36(%r1) + lwz %r6,20(%r1) + mtlr %r0 + la %r1,32(%r1) + li %r0,SYS_ptrace + sc + bso 1f + blr +1: + b PIC_PLT(HIDENAME(cerror)) diff --git a/lib/libc/powerpc/sys/sbrk.S b/lib/libc/powerpc/sys/sbrk.S new file mode 100644 index 0000000..47fc0fe --- /dev/null +++ b/lib/libc/powerpc/sys/sbrk.S @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: sbrk.S,v 1.8 2000/06/26 06:25:44 kleink Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + + .globl HIDENAME(curbrk) + .globl CNAME(_end) + + .data +HIDENAME(curbrk): + .long CNAME(_end) + + .text +ENTRY(sbrk) + +#ifdef PIC + mflr %r10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr %r5 + mtlr %r10 + lwz %r5,HIDENAME(curbrk)@got(%r5) + lwz %r6,0(%r5) +#else + lis %r5,HIDENAME(curbrk)@ha + lwz %r6,HIDENAME(curbrk)@l(%r5) /* r6 = old break */ +#endif + cmpwi %r3,0 /* sbrk(0) - return curbrk */ + beq 1f + add %r3,%r3,%r6 + mr %r7,%r3 /* r7 = new break */ + li %r0,SYS_break + sc /* break(new_break) */ + bso 2f +#ifdef PIC + stw %r7,0(%r5) +#else + stw %r7,HIDENAME(curbrk)@l(%r5) /* record new break */ +#endif +1: + mr %r3,%r6 /* set return value */ + blr +2: + b PIC_PLT(HIDENAME(cerror)) diff --git a/lib/libc/powerpc/sys/setlogin.S b/lib/libc/powerpc/sys/setlogin.S new file mode 100644 index 0000000..c65e639 --- /dev/null +++ b/lib/libc/powerpc/sys/setlogin.S @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2002 Peter Grehan. + * 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. + */ +/* $NetBSD: setlogin.S,v 1.3 1998/11/24 11:14:57 tsubai Exp $ */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +#include "SYS.h" + + .globl CNAME(_logname_valid) /* in _getlogin() */ + +SYSCALL(setlogin) +#ifdef PIC + mflr %r10 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr %r4 + lwz %r4,CNAME(_logname_valid)@got(%r4) + li %r5,%r0 + stw %r5,0(%r4) + mtlr %r10 +#else + lis %r4,CNAME(_logname_valid)@ha + li %r5,0 + stw %r5,CNAME(_logname_valid)@l(%r4) +#endif + blr |