diff --git a/lib/libc/powerpc/gen/Makefile.common b/lib/libc/powerpc/gen/Makefile.common new file mode 100644 index 000000000000..4ba72799a5cf --- /dev/null +++ b/lib/libc/powerpc/gen/Makefile.common @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.PATH: ${LIBC_SRCTOP}/powerpc/gen + +SRCS += _ctx_start.S eabi.S infinity.c ldexp.c makecontext.c \ + signalcontext.c syncicache.c _set_tp.c trivial-getcontextx.c diff --git a/lib/libc/powerpc/gen/Makefile.inc b/lib/libc/powerpc/gen/Makefile.inc index 2a00ba332b94..368887e1ac9e 100644 --- a/lib/libc/powerpc/gen/Makefile.inc +++ b/lib/libc/powerpc/gen/Makefile.inc @@ -1,11 +1,7 @@ # $FreeBSD$ -SRCS += _ctx_start.S eabi.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ +.include "${LIBC_SRC}/powerpc/gen/Makefile.common" + +SRCS += fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c _setjmp.S \ - setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ - _set_tp.c \ - trivial-getcontextx.c - - - + _setjmp.S setjmp.S sigsetjmp.S diff --git a/lib/libc/powerpcspe/Makefile.inc b/lib/libc/powerpcspe/Makefile.inc index 05d1e44f8b82..c5cb1ba47245 100644 --- a/lib/libc/powerpcspe/Makefile.inc +++ b/lib/libc/powerpcspe/Makefile.inc @@ -1,5 +1,6 @@ # $FreeBSD$ +CFLAGS+= -I${LIBC_SRCTOP}/powerpc SRCS+= trivial-vdso_tc.c # Long double is 64-bits diff --git a/lib/libc/powerpcspe/SYS.h b/lib/libc/powerpcspe/SYS.h deleted file mode 100644 index f0665c09c144..000000000000 --- a/lib/libc/powerpcspe/SYS.h +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * Copyright (c) 2002 Benno Rice. All rights reserved. - * Copyright (c) 2002 David E. O'Brien. 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. - * 3. Neither the name of the author nor the names of any 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 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. - * - * $NetBSD: SYS.h,v 1.8 2002/01/14 00:55:56 thorpej Exp $ - * $FreeBSD$ - */ - -#include -#include - -#define _SYSCALL(name) \ - .text; \ - .align 2; \ - li 0,(SYS_##name); \ - sc - -#define SYSCALL(name) \ - .text; \ - .align 2; \ -2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - bso 2b - -#define PSEUDO(name) \ - .text; \ - .align 2; \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - bnslr; \ - b PIC_PLT(CNAME(HIDENAME(cerror))) - -#define RSYSCALL(name) \ - .text; \ - .align 2; \ -2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - bnslr; \ - b PIC_PLT(CNAME(HIDENAME(cerror))) diff --git a/lib/libc/powerpcspe/_fpmath.h b/lib/libc/powerpcspe/_fpmath.h deleted file mode 100644 index 6d80eb4bdf4e..000000000000 --- a/lib/libc/powerpcspe/_fpmath.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 2003 David Schultz - * 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. - * - * $FreeBSD$ - */ - -union IEEEl2bits { - long double e; - struct { - unsigned int sign :1; - unsigned int exp :11; - unsigned int manh :20; - unsigned int manl :32; - } bits; -}; - -#define mask_nbit_l(u) ((void)0) -#define LDBL_IMPLICIT_NBIT -#define LDBL_NBIT 0 - -#define LDBL_MANH_SIZE 20 -#define LDBL_MANL_SIZE 32 - -#define LDBL_TO_ARRAY32(u, a) do { \ - (a)[0] = (uint32_t)(u).bits.manl; \ - (a)[1] = (uint32_t)(u).bits.manh; \ -} while(0) diff --git a/lib/libc/powerpcspe/arith.h b/lib/libc/powerpcspe/arith.h deleted file mode 100644 index 8e2c9ec597b3..000000000000 --- a/lib/libc/powerpcspe/arith.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * MD header for contrib/gdtoa - * - * $FreeBSD$ - */ - -/* - * NOTE: The definitions in this file must be correct or strtod(3) and - * floating point formats in printf(3) will break! The file can be - * generated by running contrib/gdtoa/arithchk.c on the target - * architecture. See contrib/gdtoa/gdtoaimp.h for details. - */ - -#define IEEE_MC68k -#define Arith_Kind_ASL 2 -#define Double_Align diff --git a/lib/libc/powerpcspe/gd_qnan.h b/lib/libc/powerpcspe/gd_qnan.h deleted file mode 100644 index d70d8c318c4c..000000000000 --- a/lib/libc/powerpcspe/gd_qnan.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * MD header for contrib/gdtoa - * - * This file can be generated by compiling and running contrib/gdtoa/qnan.c - * on the target architecture after arith.h has been generated. - * - * $FreeBSD$ - */ - -#define f_QNAN 0x7fc00000 -#define d_QNAN0 0x7ff80000 -#define d_QNAN1 0x0 -#define ld_QNAN0 0x7ff80000 -#define ld_QNAN1 0x0 -#define ld_QNAN2 0x0 -#define ld_QNAN3 0x0 -#define ldus_QNAN0 0x7ff8 -#define ldus_QNAN1 0x0 -#define ldus_QNAN2 0x0 -#define ldus_QNAN3 0x0 -#define ldus_QNAN4 0x0 diff --git a/lib/libc/powerpcspe/gen/Makefile.inc b/lib/libc/powerpcspe/gen/Makefile.inc index 2a00ba332b94..f96ad9fb0a6f 100644 --- a/lib/libc/powerpcspe/gen/Makefile.inc +++ b/lib/libc/powerpcspe/gen/Makefile.inc @@ -1,11 +1,7 @@ # $FreeBSD$ -SRCS += _ctx_start.S eabi.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ +.include "${LIBC_SRCTOP}/powerpc/gen/Makefile.common" + +SRCS += fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c _setjmp.S \ - setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ - _set_tp.c \ - trivial-getcontextx.c - - - + _setjmp.S setjmp.S sigsetjmp.S diff --git a/lib/libc/powerpcspe/gen/_ctx_start.S b/lib/libc/powerpcspe/gen/_ctx_start.S deleted file mode 100644 index 4b9fc1d53ae0..000000000000 --- a/lib/libc/powerpcspe/gen/_ctx_start.S +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004 Suleiman Souhlal - * 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 - - __FBSDID("$FreeBSD$"); - - .globl CNAME(_ctx_done) - .globl CNAME(abort) - - ENTRY(_ctx_start) - mtlr %r14 - blrl /* branch to start function */ - mr %r3,%r15 /* pass pointer to ucontext as argument */ - bl PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */ - /* - * we should never return from the - * above branch. - */ - bl PIC_PLT(CNAME(abort)) /* abort */ - END(_cts_start) - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/powerpcspe/gen/_set_tp.c b/lib/libc/powerpcspe/gen/_set_tp.c deleted file mode 100644 index eeb062f30217..000000000000 --- a/lib/libc/powerpcspe/gen/_set_tp.c +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2004 Doug Rabson - * 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. - * - * $FreeBSD$ - */ -#include "libc_private.h" - -void -_set_tp(void *tpval) -{ - - __asm __volatile("mr 2,%0" :: "r"((char*)tpval + 0x7008)); -} diff --git a/lib/libc/powerpcspe/gen/eabi.S b/lib/libc/powerpcspe/gen/eabi.S deleted file mode 100644 index 3296af88a4d1..000000000000 --- a/lib/libc/powerpcspe/gen/eabi.S +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2011 Marcel Moolenaar - * 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 -__FBSDID("$FreeBSD$"); - -ENTRY(__eabi) - blr -END(__eabi) - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/powerpcspe/gen/infinity.c b/lib/libc/powerpcspe/gen/infinity.c deleted file mode 100644 index cf1695e68028..000000000000 --- a/lib/libc/powerpcspe/gen/infinity.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#if 0 -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: infinity.c,v 1.2 1998/11/14 19:31:02 christos Exp $"); -#endif /* LIBC_SCCS and not lint */ -#endif -__FBSDID("$FreeBSD$"); - -/* infinity.c */ - -#include - -/* bytes for +Infinity on powerpc */ -const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; - -/* bytes for NaN */ -const union __nan_un __nan = { { 0xff, 0xc0, 0, 0 } }; diff --git a/lib/libc/powerpcspe/gen/makecontext.c b/lib/libc/powerpcspe/gen/makecontext.c deleted file mode 100644 index d66e82457a4e..000000000000 --- a/lib/libc/powerpcspe/gen/makecontext.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2004 Suleiman Souhlal - * 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 -__FBSDID("$FreeBSD$"); - -#include - -#include -#include -#include -#include -#include - -__weak_reference(__makecontext, makecontext); - -void _ctx_done(ucontext_t *ucp); -void _ctx_start(void); - -void -_ctx_done(ucontext_t *ucp) -{ - if (ucp->uc_link == NULL) - exit(0); - else { - /* invalidate context */ - ucp->uc_mcontext.mc_len = 0; - - setcontext((const ucontext_t *)ucp->uc_link); - - abort(); /* should never return from above call */ - } -} - -void -__makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...) -{ - mcontext_t *mc; - char *sp; - va_list ap; - int i, regargs, stackargs; - - /* Sanity checks */ - if ((ucp == NULL) || (argc < 0) || (argc > NCARGS) - || (ucp->uc_stack.ss_sp == NULL) - || (ucp->uc_stack.ss_size < MINSIGSTKSZ)) { - /* invalidate context */ - ucp->uc_mcontext.mc_len = 0; - return; - } - - /* - * The stack must have space for the frame pointer, saved - * link register, overflow arguments, and be 16-byte - * aligned. - */ - stackargs = (argc > 8) ? argc - 8 : 0; - sp = (char *) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size - - sizeof(uint32_t)*(stackargs + 2); - sp = (char *)((uint32_t)sp & ~0x1f); - - mc = &ucp->uc_mcontext; - - /* - * Up to 8 register args. Assumes all args are 32-bit and - * integer only. Not sure how to cater for floating point, - * although 64-bit args will work if aligned correctly - * in the arg list. - */ - regargs = (argc > 8) ? 8 : argc; - va_start(ap, argc); - for (i = 0; i < regargs; i++) - mc->mc_gpr[3 + i] = va_arg(ap, uint32_t); - - /* - * Overflow args go onto the stack - */ - if (argc > 8) { - uint32_t *argp; - - /* Skip past frame pointer and saved LR */ - argp = (uint32_t *)sp + 2; - - for (i = 0; i < stackargs; i++) - *argp++ = va_arg(ap, uint32_t); - } - va_end(ap); - - /* - * Use caller-saved regs 14/15 to hold params that _ctx_start - * will use to invoke the user-supplied func - */ - mc->mc_srr0 = (uint32_t) _ctx_start; - mc->mc_gpr[1] = (uint32_t) sp; /* new stack pointer */ - mc->mc_gpr[14] = (uint32_t) start; /* r14 <- start */ - mc->mc_gpr[15] = (uint32_t) ucp; /* r15 <- ucp */ -} diff --git a/lib/libc/powerpcspe/gen/signalcontext.c b/lib/libc/powerpcspe/gen/signalcontext.c deleted file mode 100644 index 30e2be848b2b..000000000000 --- a/lib/libc/powerpcspe/gen/signalcontext.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2004 Marcel Moolenaar, 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 ``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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -typedef void (*handler_t)(uint32_t, uint32_t, uint32_t); - -/* Prototypes */ -static void ctx_wrapper(ucontext_t *ucp, handler_t func, uint32_t sig, - uint32_t sig_si, uint32_t sig_uc); - -__weak_reference(__signalcontext, signalcontext); - -int -__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func) -{ - siginfo_t *sig_si; - ucontext_t *sig_uc; - uint32_t sp; - - /* Bail out if we don't have a valid ucontext pointer. */ - if (ucp == NULL) - abort(); - - /* - * Build a 16-byte-aligned signal frame - */ - sp = (ucp->uc_mcontext.mc_gpr[1] - sizeof(ucontext_t)) & ~15UL; - sig_uc = (ucontext_t *)sp; - bcopy(ucp, sig_uc, sizeof(*sig_uc)); - sp = (sp - sizeof(siginfo_t)) & ~15UL; - sig_si = (siginfo_t *)sp; - bzero(sig_si, sizeof(*sig_si)); - sig_si->si_signo = sig; - - /* - * Subtract 8 bytes from stack to allow for frameptr - */ - sp -= 2*sizeof(uint32_t); - sp &= ~15UL; - - /* - * Setup the ucontext of the signal handler. - */ - bzero(&ucp->uc_mcontext, sizeof(ucp->uc_mcontext)); - ucp->uc_link = sig_uc; - sigdelset(&ucp->uc_sigmask, sig); - - ucp->uc_mcontext.mc_vers = _MC_VERSION; - ucp->uc_mcontext.mc_len = sizeof(struct __mcontext); - ucp->uc_mcontext.mc_srr0 = (uint32_t) ctx_wrapper; - ucp->uc_mcontext.mc_gpr[1] = (uint32_t) sp; - ucp->uc_mcontext.mc_gpr[3] = (uint32_t) func; - ucp->uc_mcontext.mc_gpr[4] = (uint32_t) sig; - ucp->uc_mcontext.mc_gpr[5] = (uint32_t) sig_si; - ucp->uc_mcontext.mc_gpr[6] = (uint32_t) sig_uc; - - return (0); -} - -static void -ctx_wrapper(ucontext_t *ucp, handler_t func, uint32_t sig, uint32_t sig_si, - uint32_t sig_uc) -{ - - (*func)(sig, sig_si, sig_uc); - if (ucp->uc_link == NULL) - exit(0); - setcontext((const ucontext_t *)ucp->uc_link); - /* should never get here */ - abort(); - /* NOTREACHED */ -} diff --git a/lib/libc/powerpcspe/gen/syncicache.c b/lib/libc/powerpcspe/gen/syncicache.c deleted file mode 100644 index aa025cca8bc6..000000000000 --- a/lib/libc/powerpcspe/gen/syncicache.c +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * Copyright (C) 1995-1997, 1999 Wolfgang Solfrank. - * Copyright (C) 1995-1997, 1999 TooLs GmbH. - * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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: syncicache.c,v 1.2 1999/05/05 12:36:40 tsubai Exp $ - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#include -#include -#endif -#include - -#include -#include - -#ifdef _STANDALONE -int cacheline_size = 32; -#endif - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include - -int cacheline_size = 0; - -static void getcachelinesize(void); - -static void -getcachelinesize() -{ - static int cachemib[] = { CTL_MACHDEP, CPU_CACHELINE }; - int clen; - - clen = sizeof(cacheline_size); - - if (sysctl(cachemib, nitems(cachemib), &cacheline_size, &clen, - NULL, 0) < 0 || !cacheline_size) { - abort(); - } -} -#endif - -void -__syncicache(void *from, int len) -{ - int l, off; - char *p; - -#if !defined(_KERNEL) && !defined(_STANDALONE) - if (!cacheline_size) - getcachelinesize(); -#endif - - off = (u_int)from & (cacheline_size - 1); - l = len += off; - p = (char *)from - off; - - do { - __asm __volatile ("dcbst 0,%0" :: "r"(p)); - p += cacheline_size; - } while ((l -= cacheline_size) > 0); - __asm __volatile ("sync"); - p = (char *)from - off; - do { - __asm __volatile ("icbi 0,%0" :: "r"(p)); - p += cacheline_size; - } while ((len -= cacheline_size) > 0); - __asm __volatile ("sync; isync"); -} - diff --git a/lib/libc/powerpcspe/sys/Makefile.inc b/lib/libc/powerpcspe/sys/Makefile.inc index 6451d821b99c..7ddf4f89f05b 100644 --- a/lib/libc/powerpcspe/sys/Makefile.inc +++ b/lib/libc/powerpcspe/sys/Makefile.inc @@ -1,8 +1,4 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S - -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o - -PSEUDO= _getlogin.o _exit.o +.PATH: ${LIBC_SRCTOP}/powerpc/sys +.sinclude "${LIBC_SRCTOP}/powerpc/sys/Makefile.inc" diff --git a/lib/libc/powerpcspe/sys/brk.S b/lib/libc/powerpcspe/sys/brk.S deleted file mode 100644 index e14be1058b51..000000000000 --- a/lib/libc/powerpcspe/sys/brk.S +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * 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 -__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)) -END(brk) - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/powerpcspe/sys/cerror.S b/lib/libc/powerpcspe/sys/cerror.S deleted file mode 100644 index 3ca04fb4a19d..000000000000 --- a/lib/libc/powerpcspe/sys/cerror.S +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * 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 -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - - .globl HIDENAME(cerror) - .hidden 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 */ - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/powerpcspe/sys/exect.S b/lib/libc/powerpcspe/sys/exect.S deleted file mode 100644 index 701f5b00f45c..000000000000 --- a/lib/libc/powerpcspe/sys/exect.S +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * 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 -__FBSDID("$FreeBSD$"); - -#include "SYS.h" - -ENTRY(exect) - li %r0,SYS_execve - sc - bso 1f - blr -1: - b PIC_PLT(HIDENAME(cerror)) -END(exect) - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/powerpcspe/sys/sbrk.S b/lib/libc/powerpcspe/sys/sbrk.S deleted file mode 100644 index f058d112e863..000000000000 --- a/lib/libc/powerpcspe/sys/sbrk.S +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * 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 -__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)) -END(sbrk) - - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/powerpcspe/sys/setlogin.S b/lib/libc/powerpcspe/sys/setlogin.S deleted file mode 100644 index e0d6d3c012ce..000000000000 --- a/lib/libc/powerpcspe/sys/setlogin.S +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * 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 -__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 - - .section .note.GNU-stack,"",%progbits