diff options
Diffstat (limited to 'lib/libc/amd64/sys')
-rw-r--r-- | lib/libc/amd64/sys/Makefile.inc | 12 | ||||
-rw-r--r-- | lib/libc/amd64/sys/amd64_get_fsbase.c | 64 | ||||
-rw-r--r-- | lib/libc/amd64/sys/amd64_get_gsbase.c | 64 | ||||
-rw-r--r-- | lib/libc/amd64/sys/amd64_set_fsbase.c | 64 | ||||
-rw-r--r-- | lib/libc/amd64/sys/amd64_set_gsbase.c | 64 | ||||
-rw-r--r-- | lib/libc/amd64/sys/cerror.S | 58 | ||||
-rw-r--r-- | lib/libc/amd64/sys/getcontext.S | 46 | ||||
-rw-r--r-- | lib/libc/amd64/sys/vfork.S | 52 |
8 files changed, 0 insertions, 424 deletions
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc deleted file mode 100644 index 43af1d2a85a2..000000000000 --- a/lib/libc/amd64/sys/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -# from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp - -SRCS+= \ - amd64_get_fsbase.c \ - amd64_get_gsbase.c \ - amd64_set_fsbase.c \ - amd64_set_gsbase.c - -MDASM= vfork.S cerror.S getcontext.S - -# Don't generate default code for these syscalls: -NOASM+= sbrk.o vfork.o diff --git a/lib/libc/amd64/sys/amd64_get_fsbase.c b/lib/libc/amd64/sys/amd64_get_fsbase.c deleted file mode 100644 index 4784bb0baf42..000000000000 --- a/lib/libc/amd64/sys/amd64_get_fsbase.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2017, 2018 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * 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 <sys/cdefs.h> -#define _WANT_P_OSREL -#include <sys/param.h> -#include <machine/cpufunc.h> -#include <machine/specialreg.h> -#include <machine/sysarch.h> -#include <x86/ifunc.h> -#include "libc_private.h" - -static int -amd64_get_fsbase_cpu(void **addr) -{ - - *addr = (void *)rdfsbase(); - return (0); -} - -static int -amd64_get_fsbase_syscall(void **addr) -{ - - return (sysarch(AMD64_GET_FSBASE, addr)); -} - -DEFINE_UIFUNC(, int, amd64_get_fsbase, (void **)) -{ - - if (__getosreldate() >= P_OSREL_WRFSBASE && - (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) - return (amd64_get_fsbase_cpu); - return (amd64_get_fsbase_syscall); -} diff --git a/lib/libc/amd64/sys/amd64_get_gsbase.c b/lib/libc/amd64/sys/amd64_get_gsbase.c deleted file mode 100644 index c81773c4b78c..000000000000 --- a/lib/libc/amd64/sys/amd64_get_gsbase.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2017, 2018 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * 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 <sys/cdefs.h> -#define _WANT_P_OSREL -#include <sys/param.h> -#include <machine/cpufunc.h> -#include <machine/specialreg.h> -#include <machine/sysarch.h> -#include <x86/ifunc.h> -#include "libc_private.h" - -static int -amd64_get_gsbase_cpu(void **addr) -{ - - *addr = (void *)rdgsbase(); - return (0); -} - -static int -amd64_get_gsbase_syscall(void **addr) -{ - - return (sysarch(AMD64_GET_GSBASE, addr)); -} - -DEFINE_UIFUNC(, int, amd64_get_gsbase, (void **)) -{ - - if (__getosreldate() >= P_OSREL_WRFSBASE && - (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) - return (amd64_get_gsbase_cpu); - return (amd64_get_gsbase_syscall); -} diff --git a/lib/libc/amd64/sys/amd64_set_fsbase.c b/lib/libc/amd64/sys/amd64_set_fsbase.c deleted file mode 100644 index 24dddcad48f8..000000000000 --- a/lib/libc/amd64/sys/amd64_set_fsbase.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2017, 2018 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * 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 <sys/cdefs.h> -#define _WANT_P_OSREL -#include <sys/param.h> -#include <machine/cpufunc.h> -#include <machine/specialreg.h> -#include <machine/sysarch.h> -#include <x86/ifunc.h> -#include "libc_private.h" - -static int -amd64_set_fsbase_cpu(void *addr) -{ - - wrfsbase((uintptr_t)addr); - return (0); -} - -static int -amd64_set_fsbase_syscall(void *addr) -{ - - return (sysarch(AMD64_SET_FSBASE, &addr)); -} - -DEFINE_UIFUNC(, int, amd64_set_fsbase, (void *)) -{ - - if (__getosreldate() >= P_OSREL_WRFSBASE && - (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) - return (amd64_set_fsbase_cpu); - return (amd64_set_fsbase_syscall); -} diff --git a/lib/libc/amd64/sys/amd64_set_gsbase.c b/lib/libc/amd64/sys/amd64_set_gsbase.c deleted file mode 100644 index 10004afe8234..000000000000 --- a/lib/libc/amd64/sys/amd64_set_gsbase.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2017, 2018 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * 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 <sys/cdefs.h> -#define _WANT_P_OSREL -#include <sys/param.h> -#include <machine/cpufunc.h> -#include <machine/specialreg.h> -#include <machine/sysarch.h> -#include <x86/ifunc.h> -#include "libc_private.h" - -static int -amd64_set_gsbase_cpu(void *addr) -{ - - wrgsbase((uintptr_t)addr); - return (0); -} - -static int -amd64_set_gsbase_syscall(void *addr) -{ - - return (sysarch(AMD64_SET_GSBASE, &addr)); -} - -DEFINE_UIFUNC(, int, amd64_set_gsbase, (void *)) -{ - - if (__getosreldate() >= P_OSREL_WRFSBASE && - (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) - return (amd64_set_gsbase_cpu); - return (amd64_set_gsbase_syscall); -} diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S deleted file mode 100644 index d0b11888562e..000000000000 --- a/lib/libc/amd64/sys/cerror.S +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * 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. 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. - */ - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)cerror.s 5.1 (Berkeley) 4/23/90" -#endif /* SYSLIBC_SCCS and not lint */ -#include <machine/asm.h> -#include "SYS.h" - - .globl HIDENAME(cerror) - .hidden HIDENAME(cerror) - - /* - * The __error() function is thread aware. For non-threaded - * programs and the initial thread in threaded programs, - * it returns a pointer to the global errno variable. - */ - .globl CNAME(__error) - .type CNAME(__error),@function -HIDENAME(cerror): - pushq %rax - call PIC_PLT(CNAME(__error)) - popq %rcx - movl %ecx,(%rax) - movq $-1,%rax - movq $-1,%rdx - ret - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/amd64/sys/getcontext.S b/lib/libc/amd64/sys/getcontext.S deleted file mode 100644 index 6860a3cf9bef..000000000000 --- a/lib/libc/amd64/sys/getcontext.S +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2003 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> -#include <SYS.h> - -/* - * This has to be magic to handle the multiple returns. - * Otherwise, the setcontext() syscall will return here and we'll - * pop off the return address and go to the *setcontext* call. - */ - WEAK_REFERENCE(__sys_getcontext, _getcontext) - WEAK_REFERENCE(__sys_getcontext, getcontext) -ENTRY(__sys_getcontext) - movq (%rsp),%rsi /* save getcontext return address */ - mov $SYS_getcontext,%rax - KERNCALL - jb HIDENAME(cerror) - addq $8,%rsp /* remove stale (setcontext) return address */ - jmp *%rsi /* restore return address */ -END(__sys_getcontext) - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/amd64/sys/vfork.S b/lib/libc/amd64/sys/vfork.S deleted file mode 100644 index 11faadc6b310..000000000000 --- a/lib/libc/amd64/sys/vfork.S +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * 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. 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. - */ - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)Ovfork.s 5.1 (Berkeley) 4/23/90" -#endif /* SYSLIBC_SCCS and not lint */ -#include <machine/asm.h> -#include "SYS.h" - - WEAK_REFERENCE(__sys_vfork, _vfork) - WEAK_REFERENCE(__sys_vfork, vfork) -ENTRY(__sys_vfork) - popq %rsi /* fetch return address (%rsi preserved) */ - mov $SYS_vfork,%rax - KERNCALL - jb 1f - jmp *%rsi -1: - pushq %rsi - jmp HIDENAME(cerror) -END(__sys_vfork) - - .section .note.GNU-stack,"",%progbits |