Architecture-specific bits for libc on the PowerPC. From Wolfgang

Solfrank <ws@tools.de>
This commit is contained in:
thorpej 1997-03-29 20:55:50 +00:00
parent 1df9b10983
commit 5ef4bdf6cf
29 changed files with 1595 additions and 0 deletions

View File

@ -0,0 +1,148 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: ldexp.c,v 1.1 91/07/07 04:28:19 torek Exp
* $Id: ldexp.c,v 1.1 1997/03/29 20:55:57 thorpej Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
#include <errno.h>
/*
* double ldexp(double val, int exp)
* returns: val * (2**exp)
*/
double
ldexp(val, exp)
double val;
int exp;
{
register int oldexp, newexp, mulexp;
union doub {
double v;
struct ieee_double s;
} u, mul;
/*
* If input is zero, or no change, just return input.
* Likewise, if input is Inf or NaN, just return it.
*/
u.v = val;
oldexp = u.s.dbl_exp;
if (val == 0 || exp == 0 || oldexp == DBL_EXP_INFNAN)
return (val);
/*
* Compute new exponent and check for over/under flow.
* Underflow, unfortunately, could mean switching to denormal.
* If result out of range, set ERANGE and return 0 if too small
* or Inf if too big, with the same sign as the input value.
*/
newexp = oldexp + exp;
if (newexp >= DBL_EXP_INFNAN) {
/* u.s.dbl_sign = val < 0; -- already set */
u.s.dbl_exp = DBL_EXP_INFNAN;
u.s.dbl_frach = u.s.dbl_fracl = 0;
errno = ERANGE;
return (u.v); /* Inf */
}
if (newexp <= 0) {
/*
* The output number is either a denormal or underflows
* (see comments in machine/ieee.h).
*/
if (newexp <= -DBL_FRACBITS) {
/* u.s.dbl_sign = val < 0; -- already set */
u.s.dbl_exp = 0;
u.s.dbl_frach = u.s.dbl_fracl = 0;
errno = ERANGE;
return (u.v); /* zero */
}
/*
* We are going to produce a denorm. Our `exp' argument
* might be as small as -2097, and we cannot compute
* 2^-2097, so we may have to do this as many as three
* steps (not just two, as for positive `exp's below).
*/
mul.v = 0;
while (exp <= -DBL_EXP_BIAS) {
mul.s.dbl_exp = 1;
val *= mul.v;
exp += DBL_EXP_BIAS - 1;
}
mul.s.dbl_exp = exp + DBL_EXP_BIAS;
val *= mul.v;
return (val);
}
/*
* Newexp is positive.
*
* If oldexp is zero, we are starting with a denorm, and simply
* adjusting the exponent will produce bogus answers. We need
* to fix that first.
*/
if (oldexp == 0) {
/*
* Multiply by 2^mulexp to make the number normalizable.
* We cannot multiply by more than 2^1023, but `exp'
* argument might be as large as 2046. A single
* adjustment, however, will normalize the number even
* for huge `exp's, and then we can use exponent
* arithmetic just as for normal `double's.
*/
mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
mul.v = 0;
mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
val *= mul.v;
if (mulexp == exp)
return (val);
u.v = val;
newexp -= mulexp;
}
/*
* Both oldexp and newexp are positive; just replace the
* old exponent with the new one.
*/
u.s.dbl_exp = newexp;
return (u.v);
}

View File

@ -0,0 +1,4 @@
# $NetBSD: Makefile.inc,v 1.1 1997/03/29 20:55:50 thorpej Exp $
KMINCLUDES= arch/powerpc/SYS.h
KMSRCS=

View File

@ -0,0 +1,87 @@
/* $NetBSD: SYS.h,v 1.1 1997/03/29 20:55:51 thorpej Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
*/
#include <machine/asm.h>
#include <sys/syscall.h>
#ifdef __STDC__
#define SYSCALL_NOERROR(x) .text ;\
.align 2 ;\
ENTRY(x) ;\
li 0,(SYS_ ## x) ;\
sc
#define PSEUDO(x,y) .text ;\
.align 2 ;\
ENTRY(x) ;\
li 0,(SYS_ ## y) ;\
sc ;\
blr
#else /* !__STDC__ */
#define SYSCALL_NOERROR(x) .text ;\
.align 2 ;\
ENTRY(x) ;\
li 0,(SYS_/**/x) ;\
sc
#define PSEUDO(x,y) .text ;\
.align 2 ;\
ENTRY(x) ;\
li 0,(SYS_/**/y) ;\
sc ;\
blr
#endif
#define RSYSCALL_NOERROR(x) SYSCALL_NOERROR(x) ;\
blr
#define SYSCALL(x) .text ;\
.align 2 ;\
2: b PIC_PLT(cerror) ;\
SYSCALL_NOERROR(x) ;\
bso 2b
#define RSYSCALL(x) SYSCALL_NOERROR(x) ;\
bnslr ;\
b PIC_PLT(cerror)

View File

@ -0,0 +1,4 @@
# $NetBSD: Makefile.inc,v 1.1 1997/03/29 20:55:52 thorpej Exp $
SRCS+= _setjmp.S setjmp.S sigsetjmp.S
SRCS+= isinf.c isnan.c ldexp.c fabs.S flt_rounds.c infinity.c

View File

@ -0,0 +1,38 @@
/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
#include <machine/asm.h>
#if defined(LIBC_SCCS)
.text
.asciz "$NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $"
#endif
/*
* 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.
*/
ENTRY(_setjmp)
mflr 11
mfcr 12
mr 10,1
mr 9,2
stmw 9,8(3)
li 3,0
blr
ENTRY(_longjmp)
lmw 9,8(3)
mtlr 11
mtcr 12
mr 2,9
mr 1,10
or. 3,4,4
bnelr
li 3,1
blr

View File

@ -0,0 +1,37 @@
/* $NetBSD: fabs.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
* Copyright (C) 1996 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.
*/
#include <machine/asm.h>
ENTRY(fabs)
fabs 1,1
blr

View File

@ -0,0 +1,18 @@
/* $NetBSD: flt_rounds.c,v 1.1 1997/03/29 20:55:55 thorpej Exp $ */
static const int map[] = {
1, /* round to nearest */
0, /* round to zero */
2, /* round to positive infinity */
3 /* round to negative infinity */
};
int
__flt_rounds()
{
double tmp;
int x;
asm("mffs %0; stfiwx %0,0,%1" : "=f"(tmp): "b"(&x));
return map[x & 0x03];
}

View File

@ -0,0 +1,10 @@
#ifndef lint
static char rcsid[] = "$NetBSD: infinity.c,v 1.1 1997/03/29 20:55:55 thorpej Exp $";
#endif /* not lint */
/* infinity.c */
#include <math.h>
/* bytes for +Infinity on a PowerPC */
char __infinity[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };

View File

@ -0,0 +1,57 @@
/* $NetBSD: isinf.c,v 1.1 1997/03/29 20:55:56 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
int
isinf(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
p->dbl_frach == 0 && p->dbl_fracl == 0);
}

View File

@ -0,0 +1,57 @@
/* $NetBSD: isnan.c,v 1.1 1997/03/29 20:55:57 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: isnan.c,v 1.1 91/07/08 19:03:34 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)isnan.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
int
isnan(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
(p->dbl_frach != 0 || p->dbl_fracl != 0));
}

View File

@ -0,0 +1,148 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: ldexp.c,v 1.1 91/07/07 04:28:19 torek Exp
* $Id: ldexp.c,v 1.1 1997/03/29 20:55:57 thorpej Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
#include <errno.h>
/*
* double ldexp(double val, int exp)
* returns: val * (2**exp)
*/
double
ldexp(val, exp)
double val;
int exp;
{
register int oldexp, newexp, mulexp;
union doub {
double v;
struct ieee_double s;
} u, mul;
/*
* If input is zero, or no change, just return input.
* Likewise, if input is Inf or NaN, just return it.
*/
u.v = val;
oldexp = u.s.dbl_exp;
if (val == 0 || exp == 0 || oldexp == DBL_EXP_INFNAN)
return (val);
/*
* Compute new exponent and check for over/under flow.
* Underflow, unfortunately, could mean switching to denormal.
* If result out of range, set ERANGE and return 0 if too small
* or Inf if too big, with the same sign as the input value.
*/
newexp = oldexp + exp;
if (newexp >= DBL_EXP_INFNAN) {
/* u.s.dbl_sign = val < 0; -- already set */
u.s.dbl_exp = DBL_EXP_INFNAN;
u.s.dbl_frach = u.s.dbl_fracl = 0;
errno = ERANGE;
return (u.v); /* Inf */
}
if (newexp <= 0) {
/*
* The output number is either a denormal or underflows
* (see comments in machine/ieee.h).
*/
if (newexp <= -DBL_FRACBITS) {
/* u.s.dbl_sign = val < 0; -- already set */
u.s.dbl_exp = 0;
u.s.dbl_frach = u.s.dbl_fracl = 0;
errno = ERANGE;
return (u.v); /* zero */
}
/*
* We are going to produce a denorm. Our `exp' argument
* might be as small as -2097, and we cannot compute
* 2^-2097, so we may have to do this as many as three
* steps (not just two, as for positive `exp's below).
*/
mul.v = 0;
while (exp <= -DBL_EXP_BIAS) {
mul.s.dbl_exp = 1;
val *= mul.v;
exp += DBL_EXP_BIAS - 1;
}
mul.s.dbl_exp = exp + DBL_EXP_BIAS;
val *= mul.v;
return (val);
}
/*
* Newexp is positive.
*
* If oldexp is zero, we are starting with a denorm, and simply
* adjusting the exponent will produce bogus answers. We need
* to fix that first.
*/
if (oldexp == 0) {
/*
* Multiply by 2^mulexp to make the number normalizable.
* We cannot multiply by more than 2^1023, but `exp'
* argument might be as large as 2046. A single
* adjustment, however, will normalize the number even
* for huge `exp's, and then we can use exponent
* arithmetic just as for normal `double's.
*/
mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
mul.v = 0;
mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
val *= mul.v;
if (mulexp == exp)
return (val);
u.v = val;
newexp -= mulexp;
}
/*
* Both oldexp and newexp are positive; just replace the
* old exponent with the new one.
*/
u.s.dbl_exp = newexp;
return (u.v);
}

View File

@ -0,0 +1,89 @@
/* $NetBSD: setjmp.S,v 1.1 1997/03/29 20:55:58 thorpej Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90
*/
#include <sys/syscall.h>
#include <machine/asm.h>
#if defined(LIBC_SCCS)
.text
.asciz "$NetBSD: setjmp.S,v 1.1 1997/03/29 20:55:58 thorpej Exp $"
#endif
/*
* 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.
*/
ENTRY(setjmp)
mr 6,3
li 3,1 # SIG_BLOCK
li 4,0
li 0,SYS_sigprocmask
sc # assume no error XXX
mflr 11
mfcr 12
mr 10,1
mr 9,2
mr 8,3
stmw 8,4(6)
li 3,0
blr
ENTRY(longjmp)
lmw 8,4(3)
mr 6,4
mtlr 11
mtcr 12
mr 2,9
mr 1,10
mr 4,8
li 3,3 # SIG_SETMASK
li 0,SYS_sigprocmask
sc # assume no error XXX
or. 3,6,6
bnelr
li 3,1
blr

View File

@ -0,0 +1,84 @@
/* $NetBSD: sigsetjmp.S,v 1.1 1997/03/29 20:55:59 thorpej Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90"
*/
#include <sys/syscall.h>
#include <machine/asm.h>
#if defined(LIBC_SCCS)
.text
.asciz "$NetBSD: sigsetjmp.S,v 1.1 1997/03/29 20:55:59 thorpej Exp $"
#endif
ENTRY(sigsetjmp)
mr 6,3
or. 7,4,4
beq 1f
li 3,1 # SIG_BLOCK
li 4,0
li 0,SYS_sigprocmask
sc # assume no error XXX
1:
mflr 11
mfcr 12
mr 10,1
mr 9,2
mr 8,3
stmw 7,0(6)
li 3,0
blr
ENTRY(siglongjmp)
lmw 7,0(3)
mr 6,4
mtlr 11
mtcr 12
mr 2,9
mr 1,10
or. 7,7,7
beq 1f
mr 4,8
li 3,3 # SIG_SETMASK
li 0,SYS_sigprocmask
sc # assume no error XXX
1:
or. 3,6,6
bnelr
li 3,1
blr

View File

@ -0,0 +1 @@
# $NetBSD: Makefile.inc,v 1.1 1997/03/29 20:55:59 thorpej Exp $

View File

@ -0,0 +1,6 @@
# $NetBSD: Makefile.inc,v 1.1 1997/03/29 20:56:01 thorpej Exp $
SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memchr.c memcmp.c memset.c \
rindex.c strcat.c strcmp.c strcpy.c strcspn.c strlen.c \
strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \
strspn.c strstr.c swab.c

View File

@ -0,0 +1,58 @@
/* $NetBSD: Ovfork.S,v 1.1 1997/03/29 20:56:01 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: Ovfork.s,v 1.1 91/07/06 13:05:56 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)Ovfork.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
* pid = vfork();
*
* r4 == 0 in parent process, 1 in child process.
* r3 == pid of child in parent, pid of parent in child.
*/
#include "SYS.h"
SYSCALL(vfork)
addi 4,4,-1 # from 1 to 0 in child, 0 to -1 in parent
and 3,3,4 # return 0 in child, pid in parent
blr

View File

@ -0,0 +1,72 @@
/* $NetBSD: brk.S,v 1.1 1997/03/29 20:56:02 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: brk.s,v 1.3 92/06/25 12:56:05 mccanne Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
.globl curbrk
.text
#ifdef PIC
XXX
#else
ENTRY(brk)
lis 5,_end@ha # r5 = &_end
addi 5,5,_end@l
cmplw 5,3 # if (&_end <= r3)
bgt 0f
mr 5,3 # r5 = r3
0:
mr 3,5 # new break value
li 0,SYS_break
sc # assume, that r5 is kept
bso 1f
lis 6,curbrk@ha
stw 5,curbrk@l(6) # record new break
blr # return 0
1:
b cerror
#endif

View File

@ -0,0 +1,62 @@
/* $NetBSD: cerror.S,v 1.1 1997/03/29 20:56:03 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: cerror.s,v 1.3 92/07/02 04:17:59 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
#include "SYS.h"
/* XXX _REENTRANT */
.globl _C_LABEL(errno)
#ifdef PIC
ASENTRY(cerror)
XXX
#else
ASENTRY(cerror)
lis 4,_C_LABEL(errno)@ha
stw 3,_C_LABEL(errno)@l(4)
li 3,-1
li 4,-1
blr
#endif

View File

@ -0,0 +1,48 @@
/* $NetBSD: exect.S,v 1.1 1997/03/29 20:56:03 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: exect.s,v 1.1 91/07/06 13:05:57 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)exect.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
RSYSCALL(execve)

View File

@ -0,0 +1,58 @@
/* $NetBSD: fork.S,v 1.1 1997/03/29 20:56:04 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: fork.s,v 1.1 91/07/06 13:05:58 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
* pid = fork();
*
* r4 == 0 in parent process, 1 in child process.
* r3 == pid of child in parent, pid of parent in child.
*/
#include "SYS.h"
SYSCALL(fork)
addi 4,4,-1 # from 1 to 0 in child, 0 to -1 in parent
and 3,3,4 # return 0 in child, pid in parent
blr

View File

@ -0,0 +1,58 @@
/* $NetBSD: pipe.S,v 1.1 1997/03/29 20:56:05 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: pipe.s,v 1.1 91/07/06 13:05:58 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)pipe.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(pipe)
mr 5, 3 # save pointer
li 0,SYS_pipe
sc # assume, that r5 is kept
bso 1f
stw 3,0(5) # success, store fds
stw 4,4(5)
li 3,0
blr # and return 0
1:
b cerror

View File

@ -0,0 +1,48 @@
/* $NetBSD: ptrace.S,v 1.1 1997/03/29 20:56:05 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: ptrace.s,v 1.2 91/12/20 01:59:00 leres Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
RSYSCALL(ptrace)

View File

@ -0,0 +1,71 @@
/* $NetBSD: sbrk.S,v 1.1 1997/03/29 20:56:06 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sbrk.s,v 1.3 92/07/02 00:56:49 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
.globl _end
.globl curbrk
.data
curbrk: .long _end
.text
ENTRY(sbrk)
#ifdef PIC
XXX
#else
lis 5,curbrk@ha
lwz 6,curbrk@l(5) # r6 = old break
add 3,3,6
mr 7,3 # r7 = new break
li 0,SYS_break
sc # break(new_break)
bso 1f
mr 3,6 # set return value
stw 7,curbrk@l(5) # record new break
blr
1:
b cerror
#endif

View File

@ -0,0 +1,58 @@
/* $NetBSD: setlogin.S,v 1.1 1997/03/29 20:56:06 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: setlogin.s,v 1.1 91/07/06 13:06:00 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)setlogin.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
.globl _C_LABEL(__logname_valid) /* in getlogin() */
SYSCALL(setlogin)
#ifdef PIC
XXX
#else
lis 4,_C_LABEL(__logname_valid)@ha
li 5,0
stw 5,_C_LABEL(__logname_valid)@l(4)
blr
#endif

View File

@ -0,0 +1,57 @@
/* $NetBSD: sigpending.S,v 1.1 1997/03/29 20:56:07 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigpending.s,v 1.1 91/07/06 13:06:00 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)sigpending.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(sigpending)
mr 5,3 # save pointer
li 0,SYS_sigpending
sc # sigpending()
bso 1f
stw 3,0(5) # store return value
li 3,0 # and return 0
blr
1:
b cerror

View File

@ -0,0 +1,69 @@
/* $NetBSD: sigprocmask.S,v 1.1 1997/03/29 20:56:08 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigprocmask.s,v 1.1 91/07/06 13:06:01 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)sigprocmask.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
/*
* sigprocmask(int how, sigset_t *set, sigset_t *oset)
*/
ENTRY(sigprocmask)
or. 4,4,4 # set == NULL?
li 6,1 # how = SIG_BLOCK
beq 1f
lwz 4,0(4) # if not, replace it in r4 with *set
mr 6,3
1:
mr 3,6 # ... using sigprocmask(SIG_BLOCK)
li 0,SYS_sigprocmask
sc
bso 3f
or. 5,5,5 # check to see of oset requested
beq 2f # if oset != NULL,
stw 3,0(5) # *oset = oldmask
2:
li 3,0
blr # in any case, return 0
3:
b cerror

View File

@ -0,0 +1,48 @@
/* $NetBSD: sigreturn.S,v 1.1 1997/03/29 20:56:08 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigreturn.s,v 1.1 91/07/06 13:06:01 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)sigreturn.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
RSYSCALL(sigreturn)

View File

@ -0,0 +1,52 @@
/* $NetBSD: sigsuspend.S,v 1.1 1997/03/29 20:56:09 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigsuspend.s,v 1.1 91/07/06 13:06:01 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)sigsuspend.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(sigsuspend)
lwz 3,0(3) # indirect to mask arg
li 0,SYS_sigsuspend
sc
b cerror # always terminates with EINTR

View File

@ -0,0 +1,48 @@
/* $NetBSD: syscall.S,v 1.1 1997/03/29 20:56:09 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: syscall.s,v 1.1 91/07/06 13:06:02 torek Exp
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)syscall.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
RSYSCALL(syscall)