Reduce code duplication between powerpc and powerpcspe

They're nearly identical except for a few files.
Reported by:	kib
This commit is contained in:
Justin Hibbits 2016-10-22 21:51:58 +00:00
parent 7652bc12ba
commit 54360de77b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307799
21 changed files with 17 additions and 936 deletions

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,6 @@
# $FreeBSD$
CFLAGS+= -I${LIBC_SRCTOP}/powerpc
SRCS+= trivial-vdso_tc.c
# Long double is 64-bits

View File

@ -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 <sys/syscall.h>
#include <machine/asm.h>
#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)))

View File

@ -1,49 +0,0 @@
/*-
* Copyright (c) 2003 David Schultz <das@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.
*
* $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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <machine/asm.h>
__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

View File

@ -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));
}

View File

@ -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 <machine/asm.h>
__FBSDID("$FreeBSD$");
ENTRY(__eabi)
blr
END(__eabi)
.section .note.GNU-stack,"",%progbits

View File

@ -1,17 +0,0 @@
#include <sys/cdefs.h>
#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 <math.h>
/* 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 } };

View File

@ -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 <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <ucontext.h>
__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 */
}

View File

@ -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 <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/ucontext.h>
#include <signal.h>
#include <stdlib.h>
#include <strings.h>
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 */
}

View File

@ -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 <sys/param.h>
#if defined(_KERNEL) || defined(_STANDALONE)
#include <sys/time.h>
#include <sys/proc.h>
#include <vm/vm.h>
#endif
#include <sys/sysctl.h>
#include <machine/cpu.h>
#include <machine/md_var.h>
#ifdef _STANDALONE
int cacheline_size = 32;
#endif
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <stdlib.h>
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");
}

View File

@ -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"

View File

@ -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 <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl HIDENAME(curbrk)
.globl HIDENAME(minbrk)
.globl CNAME(_end)
.data
HIDENAME(minbrk):
.long CNAME(_end)
.text
ENTRY(brk)
#ifdef PIC
mflr %r10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr %r9
mtlr %r10
lwz %r5,HIDENAME(minbrk)@got(%r9)
lwz %r6,0(%r5)
#else
lis %r5,HIDENAME(minbrk)@ha
lwz %r6,HIDENAME(minbrk)@l(%r5)
#endif
cmplw %r6,%r3 /* if (minbrk <= r3) */
bgt 0f
mr %r6,%r3 /* r6 = r3 */
0:
mr %r3,%r6 /* new break value */
li %r0,SYS_break
sc /* assume, that r5 is kept */
bso 1f
#ifdef PIC
lwz %r7,HIDENAME(curbrk)@got(%r9)
stw %r6,0(%r7)
#else
lis %r7,HIDENAME(curbrk)@ha /* record new break */
stw %r6,HIDENAME(curbrk)@l(%r7)
#endif
blr /* return 0 */
1:
b PIC_PLT(HIDENAME(cerror))
END(brk)
.section .note.GNU-stack,"",%progbits

View File

@ -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 <machine/asm.h>
__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

View File

@ -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 <machine/asm.h>
__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

View File

@ -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 <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl HIDENAME(curbrk)
.globl CNAME(_end)
.data
HIDENAME(curbrk):
.long CNAME(_end)
.text
ENTRY(sbrk)
#ifdef PIC
mflr %r10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr %r5
mtlr %r10
lwz %r5,HIDENAME(curbrk)@got(%r5)
lwz %r6,0(%r5)
#else
lis %r5,HIDENAME(curbrk)@ha
lwz %r6,HIDENAME(curbrk)@l(%r5) /* r6 = old break */
#endif
cmpwi %r3,0 /* sbrk(0) - return curbrk */
beq 1f
add %r3,%r3,%r6
mr %r7,%r3 /* r7 = new break */
li %r0,SYS_break
sc /* break(new_break) */
bso 2f
#ifdef PIC
stw %r7,0(%r5)
#else
stw %r7,HIDENAME(curbrk)@l(%r5) /* record new break */
#endif
1:
mr %r3,%r6 /* set return value */
blr
2:
b PIC_PLT(HIDENAME(cerror))
END(sbrk)
.section .note.GNU-stack,"",%progbits

View File

@ -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 <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl CNAME(_logname_valid) /* in _getlogin() */
SYSCALL(setlogin)
#ifdef PIC
mflr %r10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr %r4
lwz %r4,CNAME(_logname_valid)@got(%r4)
li %r5,%r0
stw %r5,0(%r4)
mtlr %r10
#else
lis %r4,CNAME(_logname_valid)@ha
li %r5,0
stw %r5,CNAME(_logname_valid)@l(%r4)
#endif
blr
.section .note.GNU-stack,"",%progbits