diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-01-28 01:44:46 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-01-28 01:44:46 +0000 |
commit | 87a384e9c6d214761684102b8f24c7a04c59906d (patch) | |
tree | 2b2f6adedb045eef2cc80bb2f6a417c2458e4686 /lib/libc/arch/x86_64/sys | |
parent | eb2015b73fc7e8f74be0338c16e873a01653fe03 (diff) |
things for amd64; from art@
Diffstat (limited to 'lib/libc/arch/x86_64/sys')
-rw-r--r-- | lib/libc/arch/x86_64/sys/Ovfork.S | 67 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/brk.S | 87 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/cerror.S | 55 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/exect.S | 57 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/fork.S | 49 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/rfork.S | 48 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/sbrk.S | 82 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/sigpending.S | 49 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/sigprocmask.S | 66 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/sigreturn.S | 60 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/sigsuspend.S | 58 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/syscall.S | 57 |
12 files changed, 735 insertions, 0 deletions
diff --git a/lib/libc/arch/x86_64/sys/Ovfork.S b/lib/libc/arch/x86_64/sys/Ovfork.S new file mode 100644 index 00000000000..865d460014f --- /dev/null +++ b/lib/libc/arch/x86_64/sys/Ovfork.S @@ -0,0 +1,67 @@ +/* $OpenBSD: Ovfork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: Ovfork.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +/* + * pid = vfork(); + * + * %edx == 0 in parent process, %edx == 1 in child process. + * %eax == pid of child in parent, %eax == pid of parent in child. + * + */ +SYSENTRY(vfork) + popq %r9 /* my rta into r9 */ + SYSTRAP(vfork) + jc err + decl %edx + andl %edx,%eax + jmp *%r9 +err: + pushq %r9 +#ifdef PIC + movq PIC_GOT(CERROR), %rcx + jmp *%rcx +#else + jmp CERROR +#endif diff --git a/lib/libc/arch/x86_64/sys/brk.S b/lib/libc/arch/x86_64/sys/brk.S new file mode 100644 index 00000000000..1563091c7f3 --- /dev/null +++ b/lib/libc/arch/x86_64/sys/brk.S @@ -0,0 +1,87 @@ +/* $OpenBSD: brk.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: brk.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)brk.s 5.2 (Berkeley) 12/17/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + + .globl _end + .globl _C_LABEL(__minbrk) + .globl CURBRK + +#ifdef WEAK_ALIAS +WEAK_ALIAS(brk, _brk) +#endif + + .data +_C_LABEL(__minbrk): + .quad _end + .text + +SYSENTRY(_brk) +#ifdef PIC + movq PIC_GOT(_C_LABEL(__minbrk)),%rdx + cmpq %rdi,(%rdx) + jb 1f + movq (%rdx),%rdi +1: + SYSTRAP(break) + jc err + movq PIC_GOT(CURBRK),%rdx # set up GOT addressing + movq %rdi,(%rdx) + xorl %eax,%eax + ret +err: + movq PIC_GOT(CERROR),%rdx + jmp *%rdx +#else + cmpq %rdi,_C_LABEL(__minbrk)(%rip) + jb 1f + movq _C_LABEL(__minbrk)(%rip),%rdi +1: + SYSTRAP(break) + jc err + movq %rdi,CURBRK(%rip) + xorl %eax,%eax + ret +err: + jmp CERROR +#endif diff --git a/lib/libc/arch/x86_64/sys/cerror.S b/lib/libc/arch/x86_64/sys/cerror.S new file mode 100644 index 00000000000..400bb5d81e0 --- /dev/null +++ b/lib/libc/arch/x86_64/sys/cerror.S @@ -0,0 +1,55 @@ +/* $OpenBSD: cerror.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: cerror.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)cerror.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + + .globl _C_LABEL(errno) + +_ENTRY(CERROR) +#ifdef PIC + movq %rax, PIC_GOT(_C_LABEL(errno)) +#else + movq %rax, _C_LABEL(errno)(%rip) +#endif /* PIC */ + movq $-1,%rax + ret diff --git a/lib/libc/arch/x86_64/sys/exect.S b/lib/libc/arch/x86_64/sys/exect.S new file mode 100644 index 00000000000..31028402b6a --- /dev/null +++ b/lib/libc/arch/x86_64/sys/exect.S @@ -0,0 +1,57 @@ +/* $OpenBSD: exect.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: exect.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)exect.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" +#include <machine/psl.h> + +SYSENTRY(exect) + pushfq + orb $(PSL_T>>8),1(%rsp) + popfq + SYSTRAP(execve) +#ifdef PIC + movq PIC_GOT(CERROR), %rcx + jmp *%rcx +#else + jmp CERROR +#endif diff --git a/lib/libc/arch/x86_64/sys/fork.S b/lib/libc/arch/x86_64/sys/fork.S new file mode 100644 index 00000000000..155ee7227d6 --- /dev/null +++ b/lib/libc/arch/x86_64/sys/fork.S @@ -0,0 +1,49 @@ +/* $OpenBSD: fork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: fork.S,v 1.2 2003/02/13 02:50:51 nathanw Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)fork.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +SYSCALL(fork) + decl %edx /* from 1 to 0 in child, 0 to -1 in parent */ + andl %edx,%eax + ret /* pid = fork(); */ diff --git a/lib/libc/arch/x86_64/sys/rfork.S b/lib/libc/arch/x86_64/sys/rfork.S new file mode 100644 index 00000000000..caedbbd9aff --- /dev/null +++ b/lib/libc/arch/x86_64/sys/rfork.S @@ -0,0 +1,48 @@ +/* $OpenBSD: rfork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)fork.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +SYSCALL(rfork) + decl %edx /* from 1 to 0 in child, 0 to -1 in parent */ + andl %edx,%eax + ret /* pid = rfork(); */ diff --git a/lib/libc/arch/x86_64/sys/sbrk.S b/lib/libc/arch/x86_64/sys/sbrk.S new file mode 100644 index 00000000000..aad5f89d7d8 --- /dev/null +++ b/lib/libc/arch/x86_64/sys/sbrk.S @@ -0,0 +1,82 @@ +/* $OpenBSD: sbrk.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: sbrk.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)sbrk.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + + .globl _end + .globl CURBRK + +#ifdef WEAK_ALIAS +WEAK_ALIAS(sbrk, _sbrk) +#endif + + .data +CURBRK: .quad _end + .text + +SYSENTRY(_sbrk) +#ifdef PIC + movq PIC_GOT(CURBRK),%rdx + movq (%rdx),%rax + addq %rax,%rdi + SYSTRAP(break) + jc err + movq PIC_GOT(CURBRK),%rdx + movq (%rdx),%rax + movq %rdi,(%rdx) + ret +err: + mov PIC_GOT(CERROR),%rdx + jmp *%rdx +#else + movq CURBRK(%rip),%rax + movq %rdi,%rsi + addq %rax,%rdi + SYSTRAP(break) + jc err + movq CURBRK(%rip),%rax + addq %rsi,CURBRK(%rip) + ret +err: + jmp CERROR +#endif diff --git a/lib/libc/arch/x86_64/sys/sigpending.S b/lib/libc/arch/x86_64/sys/sigpending.S new file mode 100644 index 00000000000..bbebd47c6bf --- /dev/null +++ b/lib/libc/arch/x86_64/sys/sigpending.S @@ -0,0 +1,49 @@ +/* $OpenBSD: sigpending.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: sigpending.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)sigpending.s 5.1 (Berkeley) 7/1/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +SYSCALL(sigpending) + movl %eax,(%rdi) # store old mask + xorl %eax,%eax + ret diff --git a/lib/libc/arch/x86_64/sys/sigprocmask.S b/lib/libc/arch/x86_64/sys/sigprocmask.S new file mode 100644 index 00000000000..3718f8de3ae --- /dev/null +++ b/lib/libc/arch/x86_64/sys/sigprocmask.S @@ -0,0 +1,66 @@ +/* $OpenBSD: sigprocmask.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: sigprocmask.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +SYSENTRY(sigprocmask) + testq %rsi,%rsi # check new sigset pointer + jnz 1f # if not null, indirect + movl $1,%edi # SIG_BLOCK + jmp 2f +1: movl (%rsi),%esi # fetch indirect ... +2: SYSTRAP(sigprocmask) + jc err + testq %rdx,%rdx # test if old mask requested + jz out + movq %rax,(%rdx) # store old mask +out: + xorl %eax,%eax + ret +err: +#ifdef PIC + movq PIC_GOT(CERROR), %rcx + jmp *%rcx +#else + jmp CERROR +#endif diff --git a/lib/libc/arch/x86_64/sys/sigreturn.S b/lib/libc/arch/x86_64/sys/sigreturn.S new file mode 100644 index 00000000000..e065cbc894d --- /dev/null +++ b/lib/libc/arch/x86_64/sys/sigreturn.S @@ -0,0 +1,60 @@ +/* $OpenBSD: sigreturn.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: __sigreturn14.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90" + */ + +#include <machine/asm.h> + +#include "SYS.h" + +/* + * We must preserve the state of the registers as the user has set them up. + */ +#if 0 /* XXXfvdl fix later, but this one is really low priority */ +#ifdef GPROF +#undef ENTRY +#define MCOUNT_SYMBOL __mcount +#define ENTRY(x) \ + .globl _/**/x; _ALIGN_TEXT; _/**/x: pusha ; \ + .data; 1:; .long 0; .text; movl $1b,%eax; call MCOUNT_SYMBOL; popa ; nop +#endif /* GPROF */ +#endif + +SYSCALL(sigreturn) + ret diff --git a/lib/libc/arch/x86_64/sys/sigsuspend.S b/lib/libc/arch/x86_64/sys/sigsuspend.S new file mode 100644 index 00000000000..985bf61b99d --- /dev/null +++ b/lib/libc/arch/x86_64/sys/sigsuspend.S @@ -0,0 +1,58 @@ +/* $OpenBSD: sigsuspend.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: sigsuspend.S,v 1.1 2001/06/19 00:25:07 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +SYSENTRY(sigsuspend) + movl (%rdi),%edi # indirect to mask arg + SYSTRAP(sigsuspend) + jc err + xorl %eax,%eax # shouldn t happen + ret +err: +#ifdef PIC + movq PIC_GOT(CERROR), %rcx + jmp *%rcx +#else + jmp CERROR +#endif diff --git a/lib/libc/arch/x86_64/sys/syscall.S b/lib/libc/arch/x86_64/sys/syscall.S new file mode 100644 index 00000000000..19b798dbc92 --- /dev/null +++ b/lib/libc/arch/x86_64/sys/syscall.S @@ -0,0 +1,57 @@ +/* $OpenBSD: syscall.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $NetBSD: syscall.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)syscall.s 5.1 (Berkeley) 4/23/90 + */ + +#include <machine/asm.h> + +#include "SYS.h" + +SYSENTRY(syscall) + movl %edi,%eax + syscall + jc err + ret +err: +#ifdef PIC + movq PIC_GOT(CERROR), %rcx + jmp *%rcx +#else + jmp CERROR +#endif |