diff options
Diffstat (limited to 'lib/libsys')
-rw-r--r-- | lib/libsys/Makefile | 7 | ||||
-rw-r--r-- | lib/libsys/Symbol.thr.map | 3 | ||||
-rw-r--r-- | lib/libsys/_umtx_op_err.c | 39 | ||||
-rw-r--r-- | lib/libsys/amd64/Makefile.thr | 1 | ||||
-rw-r--r-- | lib/libsys/amd64/_umtx_op_err.S | 40 | ||||
-rw-r--r-- | lib/libsys/i386/Makefile.thr | 1 | ||||
-rw-r--r-- | lib/libsys/i386/_umtx_op_err.S | 39 | ||||
-rw-r--r-- | lib/libsys/powerpc/Makefile.thr | 1 | ||||
-rw-r--r-- | lib/libsys/powerpc/_umtx_op_err.S | 39 |
9 files changed, 170 insertions, 0 deletions
diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 45d3fec14300..b51f44025748 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -59,6 +59,13 @@ NOASM= .include "${LIBSYS_SRCTOP}/Makefile.sys" +SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.thr.map +.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH} +.sinclude "${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/Makefile.thr" +.if !${SRCS:M_umtx_op_err.S} +SRCS+=_umtx_op_err.c +.endif + VERSION_DEF=${LIBC_SRCTOP}/Versions.def SYMBOL_MAPS=${SYM_MAPS} diff --git a/lib/libsys/Symbol.thr.map b/lib/libsys/Symbol.thr.map new file mode 100644 index 000000000000..a245de2e547a --- /dev/null +++ b/lib/libsys/Symbol.thr.map @@ -0,0 +1,3 @@ +FBSDprivate_1.0 { + _umtx_op_err; +}; diff --git a/lib/libsys/_umtx_op_err.c b/lib/libsys/_umtx_op_err.c new file mode 100644 index 000000000000..8281b8af7110 --- /dev/null +++ b/lib/libsys/_umtx_op_err.c @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2005 David Xu <davidxu@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 unmodified, 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 <sys/types.h> +#include <sys/errno.h> +#include <sys/umtx.h> + +int +_umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2) +{ + if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1) + return (errno); + return (0); +} diff --git a/lib/libsys/amd64/Makefile.thr b/lib/libsys/amd64/Makefile.thr new file mode 100644 index 000000000000..52e861709faf --- /dev/null +++ b/lib/libsys/amd64/Makefile.thr @@ -0,0 +1 @@ +SRCS+= _umtx_op_err.S diff --git a/lib/libsys/amd64/_umtx_op_err.S b/lib/libsys/amd64/_umtx_op_err.S new file mode 100644 index 000000000000..c5fb2f26d6f6 --- /dev/null +++ b/lib/libsys/amd64/_umtx_op_err.S @@ -0,0 +1,40 @@ +/*- + * Copyright (C) 2008 David Xu <davidxu@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. Neither the name of the author 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 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/syscall.h> +#include <machine/asm.h> + +#define RSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \ + mov __CONCAT($SYS_,x),%rax; \ + KERNCALL; \ + ret; \ + END(__CONCAT(x, _err)); + +#define KERNCALL movq %rcx, %r10; syscall + +RSYSCALL_ERR(_umtx_op) + + .section .note.GNU-stack,"",%progbits diff --git a/lib/libsys/i386/Makefile.thr b/lib/libsys/i386/Makefile.thr new file mode 100644 index 000000000000..52e861709faf --- /dev/null +++ b/lib/libsys/i386/Makefile.thr @@ -0,0 +1 @@ +SRCS+= _umtx_op_err.S diff --git a/lib/libsys/i386/_umtx_op_err.S b/lib/libsys/i386/_umtx_op_err.S new file mode 100644 index 000000000000..460bd72604aa --- /dev/null +++ b/lib/libsys/i386/_umtx_op_err.S @@ -0,0 +1,39 @@ +/*- + * Copyright (C) 2008 David Xu <davidxu@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. Neither the name of the author 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 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/syscall.h> + +#define SYSCALL_ERR(x) \ + ENTRY(__CONCAT(x, _err)); \ + mov __CONCAT($SYS_,x),%eax; \ + int $0x80; \ + ret; \ + END(__CONCAT(x, _err)) + +SYSCALL_ERR(_umtx_op) + + .section .note.GNU-stack,"",%progbits diff --git a/lib/libsys/powerpc/Makefile.thr b/lib/libsys/powerpc/Makefile.thr new file mode 100644 index 000000000000..52e861709faf --- /dev/null +++ b/lib/libsys/powerpc/Makefile.thr @@ -0,0 +1 @@ +SRCS+= _umtx_op_err.S diff --git a/lib/libsys/powerpc/_umtx_op_err.S b/lib/libsys/powerpc/_umtx_op_err.S new file mode 100644 index 000000000000..a954962515f6 --- /dev/null +++ b/lib/libsys/powerpc/_umtx_op_err.S @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Brandon Bergren <bdragon@FreeBSD.org> + * + * 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/syscall.h> + + .text + .align 2 +ENTRY(_umtx_op_err) + li %r0, SYS__umtx_op + sc + blr +END(_umtx_op_err) + + .section .note.GNU-stack,"",%progbits |