mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Minimal libc for PowerPC.
Reviewed by: benno Approved by: re (blanket)
This commit is contained in:
parent
7b628f43e0
commit
8238b87b55
18 changed files with 1149 additions and 0 deletions
6
lib/libc/powerpc/gen/Makefile.inc
Normal file
6
lib/libc/powerpc/gen/Makefile.inc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# $FreeBSD$
|
||||
|
||||
SRCS += frexp.c infinity.c isinf.c ldexp.c modf.c _setjmp.S setjmp.S \
|
||||
sigsetjmp.S syncicache.c
|
||||
|
||||
|
||||
71
lib/libc/powerpc/gen/_setjmp.S
Normal file
71
lib/libc/powerpc/gen/_setjmp.S
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/*-
|
||||
* 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: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* C library -- _setjmp, _longjmp
|
||||
*
|
||||
* _longjmp(a,v)
|
||||
* will generate a "return(v?v:1)" from the last call to
|
||||
* _setjmp(a)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is NOT restored.
|
||||
*
|
||||
* jmpbuf layout:
|
||||
* +------------+
|
||||
* | unused |
|
||||
* +------------+
|
||||
* | unused |
|
||||
* | |
|
||||
* | (4 words) |
|
||||
* | |
|
||||
* +------------+
|
||||
* | saved regs |
|
||||
* | ... |
|
||||
*/
|
||||
|
||||
ENTRY(_setjmp)
|
||||
mflr %r11
|
||||
mfcr %r12
|
||||
mr %r10,%r1
|
||||
mr %r9,%r2
|
||||
stmw %r9,20(%r3)
|
||||
li %r3,0
|
||||
blr
|
||||
|
||||
ENTRY(_longjmp)
|
||||
lmw %r9,20(%r3)
|
||||
mtlr %r11
|
||||
mtcr %r12
|
||||
mr %r2,%r9
|
||||
mr %r1,%r10
|
||||
or. %r3,%r4,%r4
|
||||
bnelr
|
||||
li %r3,1
|
||||
blr
|
||||
56
lib/libc/powerpc/gen/frexp.c
Normal file
56
lib/libc/powerpc/gen/frexp.c
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $NetBSD: frexp.c,v 1.1 1995/02/10 17:50:22 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
frexp(value, eptr)
|
||||
double value;
|
||||
int *eptr;
|
||||
{
|
||||
union doub {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
if (value) {
|
||||
u.v = value;
|
||||
*eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
|
||||
u.s.dbl_exp = DBL_EXP_BIAS - 1;
|
||||
return(u.v);
|
||||
} else {
|
||||
*eptr = 0;
|
||||
return((double)0);
|
||||
}
|
||||
}
|
||||
14
lib/libc/powerpc/gen/infinity.c
Normal file
14
lib/libc/powerpc/gen/infinity.c
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#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 } };
|
||||
54
lib/libc/powerpc/gen/isinf.c
Normal file
54
lib/libc/powerpc/gen/isinf.c
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $NetBSD: isinf.c,v 1.1 1995/02/10 17:50:23 cgd Exp $
|
||||
* from: FreeBSD: src/lib/libc/alpha/gen/isinf.c,v 1.2 2000/05/10
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <math.h>
|
||||
|
||||
int
|
||||
isnan(double d)
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach || p->dbl_fracl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(double d)
|
||||
{
|
||||
struct ieee_double *p = (struct ieee_double *)&d;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
!p->dbl_frach && !p->dbl_fracl);
|
||||
}
|
||||
155
lib/libc/powerpc/gen/ldexp.c
Normal file
155
lib/libc/powerpc/gen/ldexp.c
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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>
|
||||
#if 0
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: ldexp.c,v 1.8 1999/08/30 18:28:26 mycroft Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#endif
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Multiply the given value by 2^exp.
|
||||
*/
|
||||
double
|
||||
ldexp(val, exp)
|
||||
double val;
|
||||
int exp;
|
||||
{
|
||||
int oldexp, newexp;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u, mul;
|
||||
|
||||
u.v = val;
|
||||
oldexp = u.s.dbl_exp;
|
||||
|
||||
/*
|
||||
* If input is zero, Inf or NaN, just return it.
|
||||
*/
|
||||
if (u.v == 0.0 || oldexp == DBL_EXP_INFNAN)
|
||||
return (val);
|
||||
|
||||
if (oldexp == 0) {
|
||||
/*
|
||||
* u.v is denormal. We must adjust it so that the exponent
|
||||
* arithmetic below will work.
|
||||
*/
|
||||
if (exp <= DBL_EXP_BIAS) {
|
||||
/*
|
||||
* Optimization: if the scaling can be done in a single
|
||||
* multiply, or underflows, just do it now.
|
||||
*/
|
||||
if (exp <= -DBL_FRACBITS) {
|
||||
errno = ERANGE;
|
||||
return (0.0);
|
||||
}
|
||||
mul.v = 0.0;
|
||||
mul.s.dbl_exp = exp + DBL_EXP_BIAS;
|
||||
u.v *= mul.v;
|
||||
if (u.v == 0.0) {
|
||||
errno = ERANGE;
|
||||
return (0.0);
|
||||
}
|
||||
return (u.v);
|
||||
} else {
|
||||
/*
|
||||
* We know that exp is very large, and therefore the
|
||||
* result cannot be denormal (though it may be Inf).
|
||||
* Shift u.v by just enough to make it normal.
|
||||
*/
|
||||
mul.v = 0.0;
|
||||
mul.s.dbl_exp = DBL_FRACBITS + DBL_EXP_BIAS;
|
||||
u.v *= mul.v;
|
||||
exp -= DBL_FRACBITS;
|
||||
oldexp = u.s.dbl_exp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* u.v is now normalized and oldexp has been adjusted if necessary.
|
||||
* Calculate the new exponent and check for underflow and overflow.
|
||||
*/
|
||||
newexp = oldexp + exp;
|
||||
|
||||
if (newexp <= 0) {
|
||||
/*
|
||||
* The output number is either denormal or underflows (see
|
||||
* comments in machine/ieee.h).
|
||||
*/
|
||||
if (newexp <= -DBL_FRACBITS) {
|
||||
errno = ERANGE;
|
||||
return (0.0);
|
||||
}
|
||||
/*
|
||||
* Denormalize the result. We do this with a multiply. If exp
|
||||
* is very large, it won't fit in a double, so we have to
|
||||
* adjust the exponent first. This is safe because we know
|
||||
* that u.v is normal at this point.
|
||||
*/
|
||||
if (exp <= -DBL_EXP_BIAS) {
|
||||
u.s.dbl_exp = 1;
|
||||
exp += oldexp - 1;
|
||||
}
|
||||
mul.v = 0.0;
|
||||
mul.s.dbl_exp = exp + DBL_EXP_BIAS;
|
||||
u.v *= mul.v;
|
||||
return (u.v);
|
||||
} else if (newexp >= DBL_EXP_INFNAN) {
|
||||
/*
|
||||
* The result overflowed; return +/-Inf.
|
||||
*/
|
||||
u.s.dbl_exp = DBL_EXP_INFNAN;
|
||||
u.s.dbl_frach = 0;
|
||||
u.s.dbl_fracl = 0;
|
||||
errno = ERANGE;
|
||||
return (u.v);
|
||||
} else {
|
||||
/*
|
||||
* The result is normal; just replace the old exponent with the
|
||||
* new one.
|
||||
*/
|
||||
u.s.dbl_exp = newexp;
|
||||
return (u.v);
|
||||
}
|
||||
}
|
||||
107
lib/libc/powerpc/gen/modf.c
Normal file
107
lib/libc/powerpc/gen/modf.c
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $NetBSD: modf.c,v 1.1 1995/02/10 17:50:25 cgd Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* double modf(double val, double *iptr)
|
||||
* returns: f and i such that |f| < 1.0, (f + i) = val, and
|
||||
* sign(f) == sign(i) == sign(val).
|
||||
*
|
||||
* Beware signedness when doing subtraction, and also operand size!
|
||||
*/
|
||||
double
|
||||
modf(val, iptr)
|
||||
double val, *iptr;
|
||||
{
|
||||
union doub {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u, v;
|
||||
u_int64_t frac;
|
||||
|
||||
/*
|
||||
* If input is Inf or NaN, return it and leave i alone.
|
||||
*/
|
||||
u.v = val;
|
||||
if (u.s.dbl_exp == DBL_EXP_INFNAN)
|
||||
return (u.v);
|
||||
|
||||
/*
|
||||
* If input can't have a fractional part, return
|
||||
* (appropriately signed) zero, and make i be the input.
|
||||
*/
|
||||
if ((int)u.s.dbl_exp - DBL_EXP_BIAS > DBL_FRACBITS - 1) {
|
||||
*iptr = u.v;
|
||||
v.v = 0.0;
|
||||
v.s.dbl_sign = u.s.dbl_sign;
|
||||
return (v.v);
|
||||
}
|
||||
|
||||
/*
|
||||
* If |input| < 1.0, return it, and set i to the appropriately
|
||||
* signed zero.
|
||||
*/
|
||||
if (u.s.dbl_exp < DBL_EXP_BIAS) {
|
||||
v.v = 0.0;
|
||||
v.s.dbl_sign = u.s.dbl_sign;
|
||||
*iptr = v.v;
|
||||
return (u.v);
|
||||
}
|
||||
|
||||
/*
|
||||
* There can be a fractional part of the input.
|
||||
* If you look at the math involved for a few seconds, it's
|
||||
* plain to see that the integral part is the input, with the
|
||||
* low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed,
|
||||
* the the fractional part is the part with the rest of the
|
||||
* bits zeroed. Just zeroing the high bits to get the
|
||||
* fractional part would yield a fraction in need of
|
||||
* normalization. Therefore, we take the easy way out, and
|
||||
* just use subtraction to get the fractional part.
|
||||
*/
|
||||
v.v = u.v;
|
||||
/* Zero the low bits of the fraction, the sleazy way. */
|
||||
frac = ((u_int64_t)v.s.dbl_frach << 32) + v.s.dbl_fracl;
|
||||
frac >>= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS);
|
||||
frac <<= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS);
|
||||
v.s.dbl_fracl = frac & 0xffffffff;
|
||||
v.s.dbl_frach = frac >> 32;
|
||||
*iptr = v.v;
|
||||
|
||||
u.v -= v.v;
|
||||
u.s.dbl_sign = v.s.dbl_sign;
|
||||
return (u.v);
|
||||
}
|
||||
91
lib/libc/powerpc/gen/setjmp.S
Normal file
91
lib/libc/powerpc/gen/setjmp.S
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*-
|
||||
* 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: setjmp.S,v 1.3 1998/10/03 12:30:38 tsubai Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
/*
|
||||
* C library -- setjmp, longjmp
|
||||
*
|
||||
* longjmp(a,v)
|
||||
* will generate a "return(v?v:1)" from the last call to
|
||||
* setjmp(a)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is restored.
|
||||
*
|
||||
* jmpbuf layout:
|
||||
* +------------+
|
||||
* | unused |
|
||||
* +------------+
|
||||
* | sig state |
|
||||
* | |
|
||||
* | (4 words) |
|
||||
* | |
|
||||
* +------------+
|
||||
* | saved regs |
|
||||
* | ... |
|
||||
*/
|
||||
|
||||
ENTRY(setjmp)
|
||||
mr %r6,%r3
|
||||
li %r3,1 /* SIG_BLOCK, but doesn't matter */
|
||||
/* since set == NULL */
|
||||
li %r4,0 /* set = NULL */
|
||||
mr %r5,%r6 /* &oset */
|
||||
addi %r5,%r5,4
|
||||
li %r0, SYS_sigprocmask /*sigprocmask(SIG_BLOCK, NULL, &oset)*/
|
||||
sc /*assume no error XXX */
|
||||
mflr %r11 /* r11 <- link reg */
|
||||
mfcr %r12 /* r12 <- condition reg */
|
||||
mr %r10,%r1 /* r10 <- stackptr */
|
||||
mr %r9,%r2 /* r9 <- global ptr */
|
||||
stmw %r9,20(%r6)
|
||||
li %r3,0 /* return (0) */
|
||||
blr
|
||||
|
||||
.weak CNAME(longjmp)
|
||||
.set CNAME(longjmp),CNAME(__longjmp)
|
||||
ENTRY(__longjmp)
|
||||
lmw %r9,20(%r3) /* restore regs */
|
||||
mr %r6,%r4 /* save val param */
|
||||
mtlr %r11 /* r11 -> link reg */
|
||||
mtcr %r12 /* r12 -> condition reg */
|
||||
mr %r2,%r9 /* r9 -> global ptr */
|
||||
mr %r1,%r10 /* r10 -> stackptr */
|
||||
mr %r4,%r3
|
||||
li %r3,3 /* SIG_SETMASK */
|
||||
addi %r4,%r4,4 /* &set */
|
||||
li %r5,0 /* oset = NULL */
|
||||
li %r0,SYS_sigprocmask /* sigprocmask(SIG_SET, &set, NULL) */
|
||||
sc /* assume no error XXX */
|
||||
or. %r3,%r6,%r6
|
||||
bnelr
|
||||
li %r3,1
|
||||
blr
|
||||
|
||||
97
lib/libc/powerpc/gen/sigsetjmp.S
Normal file
97
lib/libc/powerpc/gen/sigsetjmp.S
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/*-
|
||||
* 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: sigsetjmp.S,v 1.4 1998/10/03 12:30:38 tsubai Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* C library -- sigsetjmp, siglongjmp
|
||||
*
|
||||
* siglongjmp(a,v)
|
||||
* will generate a "return(v?v:1)" from the last call to
|
||||
* sigsetjmp(a, savemask)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is restored if savemask is non-zero
|
||||
*
|
||||
* jmpbuf layout:
|
||||
* +------------+
|
||||
* | savemask |
|
||||
* +------------+
|
||||
* | sig state |
|
||||
* | |
|
||||
* | (4 words) |
|
||||
* | |
|
||||
* +------------+
|
||||
* | saved regs |
|
||||
* | ... |
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
ENTRY(sigsetjmp)
|
||||
mr %r6,%r3
|
||||
stw %r4,0(%r3)
|
||||
or. %r7,%r4,%r4
|
||||
beq 1f
|
||||
li %r3,1 /* SIG_BLOCK, but doesn't matter */
|
||||
/* since set == NULL */
|
||||
li %r4,0 /* set = NULL */
|
||||
mr %r5,%r6 /* &oset */
|
||||
addi %r5,%r5,4
|
||||
li %r0, SYS_sigprocmask /* sigprocmask(SIG_BLOCK, NULL, &oset)*/
|
||||
sc /* assume no error XXX */
|
||||
1:
|
||||
mflr %r11
|
||||
mfcr %r12
|
||||
mr %r10,%r1
|
||||
mr %r9,%r2
|
||||
stmw %r9,20(%r6)
|
||||
li %r3,0
|
||||
blr
|
||||
|
||||
ENTRY(siglongjmp)
|
||||
lmw %r9,20(%r3)
|
||||
lwz %r7,0(%r3)
|
||||
mr %r6,%r4
|
||||
mtlr %r11
|
||||
mtcr %r12
|
||||
mr %r2,%r9
|
||||
mr %r1,%r10
|
||||
or. %r7,%r7,%r7
|
||||
beq 1f
|
||||
mr %r4,%r3
|
||||
li %r3,3 /* SIG_SETMASK */
|
||||
addi %r4,%r4,4 /* &set */
|
||||
li %r5,0 /* oset = NULL */
|
||||
li %r0,SYS_sigprocmask /* sigprocmask(SIG_SET, &set, NULL) */
|
||||
sc /* assume no error XXX */
|
||||
1:
|
||||
or. %r3,%r6,%r6
|
||||
bnelr
|
||||
li %r3,1
|
||||
blr
|
||||
98
lib/libc/powerpc/gen/syncicache.c
Normal file
98
lib/libc/powerpc/gen/syncicache.c
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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>
|
||||
|
||||
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||
#ifndef CACHELINESIZE
|
||||
#error "Must know the size of a cache line"
|
||||
#endif
|
||||
#else
|
||||
static void getcachelinesize(void);
|
||||
|
||||
static int _cachelinesize;
|
||||
#define CACHELINESIZE _cachelinesize
|
||||
|
||||
static void
|
||||
getcachelinesize()
|
||||
{
|
||||
static int cachemib[] = { CTL_MACHDEP, CPU_CACHELINE };
|
||||
int clen;
|
||||
|
||||
clen = sizeof(_cachelinesize);
|
||||
|
||||
if (sysctl(cachemib, sizeof(cachemib) / sizeof(cachemib[0]),
|
||||
&_cachelinesize, &clen, NULL, 0) < 0 || !_cachelinesize) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
__syncicache(void *from, int len)
|
||||
{
|
||||
int l, off;
|
||||
char *p;
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
if (!_cachelinesize)
|
||||
getcachelinesize();
|
||||
#endif
|
||||
off = (u_int)from & (CACHELINESIZE - 1);
|
||||
l = len += off;
|
||||
p = (char *)from - off;
|
||||
do {
|
||||
__asm __volatile ("dcbst 0,%0" :: "r"(p));
|
||||
p += CACHELINESIZE;
|
||||
} while ((l -= CACHELINESIZE) > 0);
|
||||
__asm __volatile ("sync");
|
||||
p = (char *)from - off;
|
||||
do {
|
||||
__asm __volatile ("icbi 0,%0" :: "r"(p));
|
||||
p += CACHELINESIZE;
|
||||
} while ((len -= CACHELINESIZE) > 0);
|
||||
__asm __volatile ("sync; isync");
|
||||
}
|
||||
11
lib/libc/powerpc/sys/Makefile.inc
Normal file
11
lib/libc/powerpc/sys/Makefile.inc
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# $FreeBSD$
|
||||
|
||||
MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S
|
||||
|
||||
# Don't generate default code for these syscalls:
|
||||
NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \
|
||||
lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \
|
||||
pwrite.o setdomainname.o sstk.o truncate.o uname.o yield.o
|
||||
|
||||
PSEUDO= _getlogin.o _exit.o
|
||||
|
||||
73
lib/libc/powerpc/sys/brk.S
Normal file
73
lib/libc/powerpc/sys/brk.S
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*-
|
||||
* 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))
|
||||
57
lib/libc/powerpc/sys/cerror.S
Normal file
57
lib/libc/powerpc/sys/cerror.S
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*-
|
||||
* 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)
|
||||
.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 */
|
||||
|
||||
|
||||
39
lib/libc/powerpc/sys/exect.S
Normal file
39
lib/libc/powerpc/sys/exect.S
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*-
|
||||
* 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))
|
||||
43
lib/libc/powerpc/sys/pipe.S
Normal file
43
lib/libc/powerpc/sys/pipe.S
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*-
|
||||
* 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: pipe.S,v 1.6 2000/09/28 08:38:54 kleink Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(pipe)
|
||||
mr %r5,%r3 /* save pointer */
|
||||
li %r0,SYS_pipe
|
||||
sc /* r5 is preserved */
|
||||
bso 1f
|
||||
stw %r3,0(%r5) /* success, store fds */
|
||||
stw %r4,4(%r5)
|
||||
li %r3,0
|
||||
blr /* and return 0 */
|
||||
1:
|
||||
b PIC_PLT(HIDENAME(cerror))
|
||||
58
lib/libc/powerpc/sys/ptrace.S
Normal file
58
lib/libc/powerpc/sys/ptrace.S
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*-
|
||||
* 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: ptrace.S,v 1.3 2000/02/23 20:16:57 kleink Exp $ */
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(ptrace)
|
||||
mflr %r0
|
||||
stwu %r1,-32(%r1)
|
||||
stw %r0,36(%r1)
|
||||
stw %r3,8(%r1)
|
||||
stw %r4,12(%r1)
|
||||
stw %r5,16(%r1)
|
||||
stw %r6,20(%r1)
|
||||
|
||||
bl PIC_PLT(CNAME(__error))
|
||||
li %r7,0
|
||||
stw %r7,0(%r3)
|
||||
|
||||
lwz %r3,8(%r1)
|
||||
lwz %r4,12(%r1)
|
||||
lwz %r5,16(%r1)
|
||||
lwz %r0,36(%r1)
|
||||
lwz %r6,20(%r1)
|
||||
mtlr %r0
|
||||
la %r1,32(%r1)
|
||||
li %r0,SYS_ptrace
|
||||
sc
|
||||
bso 1f
|
||||
blr
|
||||
1:
|
||||
b PIC_PLT(HIDENAME(cerror))
|
||||
70
lib/libc/powerpc/sys/sbrk.S
Normal file
70
lib/libc/powerpc/sys/sbrk.S
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*-
|
||||
* 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))
|
||||
49
lib/libc/powerpc/sys/setlogin.S
Normal file
49
lib/libc/powerpc/sys/setlogin.S
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*-
|
||||
* 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
|
||||
Loading…
Reference in a new issue