diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /lib/libc/arch/alpha |
initial import of NetBSD tree
Diffstat (limited to 'lib/libc/arch/alpha')
42 files changed, 2381 insertions, 0 deletions
diff --git a/lib/libc/arch/alpha/DEFS.h b/lib/libc/arch/alpha/DEFS.h new file mode 100644 index 00000000000..3fa35aa1457 --- /dev/null +++ b/lib/libc/arch/alpha/DEFS.h @@ -0,0 +1,30 @@ +/* $NetBSD: DEFS.h,v 1.1 1995/02/10 17:49:48 cgd Exp $ */ + +/* + * 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. + */ + +#include <machine/asm.h> diff --git a/lib/libc/arch/alpha/Makefile.inc b/lib/libc/arch/alpha/Makefile.inc new file mode 100644 index 00000000000..28b9277b11b --- /dev/null +++ b/lib/libc/arch/alpha/Makefile.inc @@ -0,0 +1,52 @@ +# $NetBSD: Makefile.inc,v 1.1 1995/02/10 17:49:49 cgd Exp $ + +KMINCLUDES= arch/alpha/SYS.h arch/alpha/DEFS.h +KMSRCS= divrem.m4 +#KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S \ +# htonl.S htons.S ntohl.S ntohs.S + +# `source' files built from m4 source +SRCS+= __divqu.S __divq.S __divlu.S __divl.S +SRCS+= __remqu.S __remq.S __remlu.S __reml.S +CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S +CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S + +__divqu.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__divqu')define(OP,\`div')define(S,\`false')"; \ + echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__divq.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__divq')define(OP,\`div')define(S,\`true')"; \ + echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__divlu.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__divlu')define(OP,\`div')define(S,\`false')"; \ + echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__divl.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__divl')define(OP,\`div')define(S,\`true')"; \ + echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__remqu.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__remqu')define(OP,\`rem')define(S,\`false')"; \ + echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__remq.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__remq')define(OP,\`rem')define(S,\`true')"; \ + echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__remlu.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__remlu')define(OP,\`rem')define(S,\`false')"; \ + echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET} + +__reml.S: ${.CURDIR}/arch/alpha/gen/divrem.m4 + @echo 'building ${.TARGET} from ${.ALLSRC}' + @(echo "define(NAME,\`__reml')define(OP,\`rem')define(S,\`true')"; \ + echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET} diff --git a/lib/libc/arch/alpha/SYS.h b/lib/libc/arch/alpha/SYS.h new file mode 100644 index 00000000000..d4c5a5600ac --- /dev/null +++ b/lib/libc/arch/alpha/SYS.h @@ -0,0 +1,53 @@ +/* $NetBSD: SYS.h,v 1.1 1995/02/10 17:49:50 cgd Exp $ */ + +/* + * 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. + */ + +#include <machine/asm.h> +#include <sys/syscall.h> + +#define CALLSYS(num) \ + CONST(num, v0); \ + call_pal 0x83; /* op_callsys */ + +#define SYSCALL_NOLABEL(x) \ + CALLSYS(SYS_/**/x); \ + beq a3, 9f; \ + br gp, 8f; \ +8: SETGP(gp); \ + lda at_reg, cerror; \ + jmp zero, (at_reg); \ +9: + +#define SYSCALL(x) LEAF(x, 0 /* XXX */); SYSCALL_NOLABEL(x); +#define RSYSCALL(x) SYSCALL(x); RET; END(x); + +#define PSEUDO(x,y) \ +LEAF(x,0); /* unknown # of args */ \ + CALLSYS(SYS_/**/y); \ + RET; \ +END(x); diff --git a/lib/libc/arch/alpha/gen/Makefile.inc b/lib/libc/arch/alpha/gen/Makefile.inc new file mode 100644 index 00000000000..88d4cac7d3f --- /dev/null +++ b/lib/libc/arch/alpha/gen/Makefile.inc @@ -0,0 +1,6 @@ +# $NetBSD: Makefile.inc,v 1.3 1995/04/29 05:09:14 cgd Exp $ + +SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c setjmp.S +SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ + fpsetround.c fpsetsticky.c +SRCS+= sigsetjmp.S diff --git a/lib/libc/arch/alpha/gen/_setjmp.S b/lib/libc/arch/alpha/gen/_setjmp.S new file mode 100644 index 00000000000..553d3b933b3 --- /dev/null +++ b/lib/libc/arch/alpha/gen/_setjmp.S @@ -0,0 +1,123 @@ +/* $NetBSD: _setjmp.S,v 1.1 1995/02/10 17:50:19 cgd Exp $ */ + +/* + * 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. + */ + +#include "DEFS.h" + +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v)" from + * the last call to + * _setjmp(a) + * by restoring registers from the stack, + * The previous signal state is NOT restored. + */ + + .set noreorder + +LEAF(_setjmp, 1) + SETGP(pv) + stq ra, (2 * 8)(a0) /* sc_pc = return address */ + stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */ + stq s1, ((10 + 4) * 8)(a0) + stq s2, ((11 + 4) * 8)(a0) + stq s3, ((12 + 4) * 8)(a0) + stq s4, ((13 + 4) * 8)(a0) + stq s5, ((14 + 4) * 8)(a0) + stq s6, ((15 + 4) * 8)(a0) + stq ra, ((26 + 4) * 8)(a0) + stq sp, ((30 + 4) * 8)(a0) + CONST(0xACEDBADD, t0) /* sigcontext magic number */ + stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */ + /* Too bad we can't check if we actually used FP */ + CONST(1, t0) + stq t0, (36 * 8)(a0) /* say we've used FP. */ + stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */ + stt fs1, ((3 + 37) * 8)(a0) + stt fs2, ((4 + 37) * 8)(a0) + stt fs3, ((5 + 37) * 8)(a0) + stt fs4, ((6 + 37) * 8)(a0) + stt fs5, ((7 + 37) * 8)(a0) + stt fs6, ((8 + 37) * 8)(a0) + stt fs7, ((9 + 37) * 8)(a0) + MF_FPCR(ft0) /* get FP control reg */ + stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */ + stq zero, (70 * 8)(a0) /* FP software control XXX */ + stq zero, (71 * 8)(a0) /* sc_reserved[0] */ + stq zero, (72 * 8)(a0) /* sc_reserved[1] */ + stq zero, (73 * 8)(a0) /* sc_xxx[0] */ + stq zero, (74 * 8)(a0) /* sc_xxx[1] */ + stq zero, (75 * 8)(a0) /* sc_xxx[2] */ + stq zero, (76 * 8)(a0) /* sc_xxx[3] */ + stq zero, (77 * 8)(a0) /* sc_xxx[4] */ + stq zero, (78 * 8)(a0) /* sc_xxx[5] */ + stq zero, (79 * 8)(a0) /* sc_xxx[6] */ + stq zero, (80 * 8)(a0) /* sc_xxx[7] */ + + mov zero, v0 /* return zero */ + RET +END(_setjmp) + +LEAF(_longjmp, 2) + SETGP(pv) + ldq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */ + CONST(0xACEDBADD, t1) + cmpeq t0, t1, t0 + beq t0, botch /* If the magic was bad, punt */ + + ldq ra, (2 * 8)(a0) /* sc_pc = return address */ + ldq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */ + ldq s1, ((10 + 4) * 8)(a0) + ldq s2, ((11 + 4) * 8)(a0) + ldq s3, ((12 + 4) * 8)(a0) + ldq s4, ((13 + 4) * 8)(a0) + ldq s5, ((14 + 4) * 8)(a0) + ldq s6, ((15 + 4) * 8)(a0) + /* ldq ra, ((26 + 4) * 8)(a0) set above */ + ldq sp, ((30 + 4) * 8)(a0) + ldt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */ + ldt fs1, ((3 + 37) * 8)(a0) + ldt fs2, ((4 + 37) * 8)(a0) + ldt fs3, ((5 + 37) * 8)(a0) + ldt fs4, ((6 + 37) * 8)(a0) + ldt fs5, ((7 + 37) * 8)(a0) + ldt fs6, ((8 + 37) * 8)(a0) + ldt fs7, ((9 + 37) * 8)(a0) + ldt ft0, (69 * 8)(a0) /* get sc_fpcr */ + MT_FPCR(ft0) /* and restore it. */ + + mov a1, v0 /* return second arg */ + RET + +botch: + CALL(longjmperror) + CALL(abort) + RET /* "can't" get here... */ +END(_longjmp) diff --git a/lib/libc/arch/alpha/gen/divrem.m4 b/lib/libc/arch/alpha/gen/divrem.m4 new file mode 100644 index 00000000000..59c7bd35a56 --- /dev/null +++ b/lib/libc/arch/alpha/gen/divrem.m4 @@ -0,0 +1,197 @@ +/* $NetBSD: divrem.m4,v 1.5 1995/09/30 03:09:07 cgd Exp $ */ + +/* + * 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. + */ + +/* + * Division and remainder. + * + * The use of m4 is modeled after the sparc code, but the algorithm is + * simple binary long division. + * + * Note that the loops could probably benefit from unrolling. + */ + +/* + * M4 Parameters + * NAME name of function to generate + * OP OP=div: t10 / t11 -> t12; OP=rem: t10 % t11 -> t12 + * S S=true: signed; S=false: unsigned + * WORDSIZE total number of bits + */ + +define(A, `t10') +define(B, `t11') +define(RESULT, `t12') + +define(BIT, `t0') +define(I, `t1') +define(CC, `t2') +define(T_0, `t3') +ifelse(S, `true', `define(NEG, `t4')') + +#include "DEFS.h" + +LEAF(NAME, 0) /* XXX */ + lda sp, -64(sp) + stq BIT, 0(sp) + stq I, 8(sp) + stq CC, 16(sp) + stq T_0, 24(sp) +ifelse(S, `true', +` stq NEG, 32(sp)') + stq A, 40(sp) + stq B, 48(sp) + mov zero, RESULT /* Initialize result to zero */ + +ifelse(S, `true', +` + /* Compute sign of result. If either is negative, this is easy. */ + or A, B, NEG /* not the sign, but... */ + srl NEG, WORDSIZE - 1, NEG /* rather, or of high bits */ + blbc NEG, Ldoit /* neither negative? do it! */ + +ifelse(OP, `div', +` xor A, B, NEG /* THIS is the sign! */ +', ` mov A, NEG /* sign follows A. */ +') + srl NEG, WORDSIZE - 1, NEG /* make negation the low bit. */ + + srl A, WORDSIZE - 1, I /* is A negative? */ + blbc I, LnegB /* no. */ + /* A is negative; flip it. */ +ifelse(WORDSIZE, `32', ` + /* top 32 bits may be random junk */ + zap A, 0xf0, A +') + subq zero, A, A + srl B, WORDSIZE - 1, I /* is B negative? */ + blbc I, Ldoit /* no. */ +LnegB: + /* B is definitely negative, no matter how we got here. */ +ifelse(WORDSIZE, `32', ` + /* top 32 bits may be random junk */ + zap B, 0xf0, B +') + subq zero, B, B +Ldoit: +') +ifelse(WORDSIZE, `32', ` + /* + * Clear the top 32 bits of each operand, as they may + * sign extension (if negated above), or random junk. + */ + zap A, 0xf0, A + zap B, 0xf0, B +') + + /* kill the special cases. */ + beq B, Ldotrap /* division by zero! */ + +1: cmpult A, B, CC /* A < B? */ + /* RESULT is already zero, from above. A is untouched. */ + bne CC, Lret_result + + cmpeq A, B, CC /* A == B? */ + cmovne CC, 1, RESULT + cmovne CC, zero, A + bne CC, Lret_result + + /* + * Find out how many bits of zeros are at the beginning of the divisor. + */ +LBbits: + CONST(1, T_0) /* I = 0; BIT = 1<<WORDSIZE-1 */ + mov zero, I + sll T_0, WORDSIZE-1, BIT +LBloop: + and B, BIT, CC /* if bit in B is set, done. */ + bne CC, LAbits + addq I, 1, I /* increment I, shift bit */ + srl BIT, 1, BIT + cmplt I, WORDSIZE-1, CC /* if I leaves one bit, done. */ + bne CC, LBloop + +LAbits: + beq I, Ldodiv /* If I = 0, divide now. */ + CONST(1, T_0) /* BIT = 1<<WORDSIZE-1 */ + sll T_0, WORDSIZE-1, BIT + +LAloop: + and A, BIT, CC /* if bit in A is set, done. */ + bne CC, Ldodiv + subq I, 1, I /* decrement I, shift bit */ + srl BIT, 1, BIT + bne I, LAloop /* If I != 0, loop again */ + +Ldodiv: + sll B, I, B /* B <<= i */ + CONST(1, T_0) + sll T_0, I, BIT + +Ldivloop: + cmpult A, B, CC + or RESULT, BIT, T_0 + cmoveq CC, T_0, RESULT + subq A, B, T_0 + cmoveq CC, T_0, A + srl BIT, 1, BIT + srl B, 1, B + beq A, Lret_result + bne BIT, Ldivloop + +Lret_result: +ifelse(OP, `div', +`', ` mov A, RESULT +') +ifelse(S, `true', +` + /* Check to see if we should negate it. */ + subqv zero, RESULT, T_0 + cmovlbs NEG, T_0, RESULT +') + + ldq BIT, 0(sp) + ldq I, 8(sp) + ldq CC, 16(sp) + ldq T_0, 24(sp) +ifelse(S, `true', +` ldq NEG, 32(sp)') + ldq A, 40(sp) + ldq B, 48(sp) + lda sp, 64(sp) + ret zero, (t9), 1 + +Ldotrap: + CONST(-2, a0) /* This is the signal to SIGFPE! */ + call_pal PAL_gentrap +ifelse(OP, `div', +`', ` mov zero, A /* so that zero will be returned */ +') + br zero, Lret_result + +END(NAME) diff --git a/lib/libc/arch/alpha/gen/fabs.S b/lib/libc/arch/alpha/gen/fabs.S new file mode 100644 index 00000000000..f1d662252cc --- /dev/null +++ b/lib/libc/arch/alpha/gen/fabs.S @@ -0,0 +1,35 @@ +/* $NetBSD: fabs.S,v 1.1 1995/02/10 17:50:21 cgd Exp $ */ + +/* + * 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. + */ + +#include "DEFS.h" + +LEAF(fabs, 1) + cpys fzero, fa0, fv0 + RET +END(fabs) diff --git a/lib/libc/arch/alpha/gen/flt_rounds.c b/lib/libc/arch/alpha/gen/flt_rounds.c new file mode 100644 index 00000000000..f363872faf6 --- /dev/null +++ b/lib/libc/arch/alpha/gen/flt_rounds.c @@ -0,0 +1,55 @@ +/* $NetBSD: flt_rounds.c,v 1.1 1995/04/29 05:09:53 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/types.h> + +static const int map[] = { + 0, /* round to zero */ + 3, /* round to negative infinity */ + 1, /* round to nearest */ + 2 /* round to positive infinity */ +}; + +int +__flt_rounds() +{ + double fpcrval; + u_int64_t old; + + __asm__("trapb"); + __asm__("mf_fpcr %0" : "=f" (fpcrval)); + __asm__("trapb"); + old = *(u_int64_t *)&fpcrval; + + return map[(old >> 58) & 0x3]; +} diff --git a/lib/libc/arch/alpha/gen/fpgetmask.c b/lib/libc/arch/alpha/gen/fpgetmask.c new file mode 100644 index 00000000000..c52a7ef0711 --- /dev/null +++ b/lib/libc/arch/alpha/gen/fpgetmask.c @@ -0,0 +1,42 @@ +/* $NetBSD: fpgetmask.c,v 1.1 1995/04/29 05:10:55 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <ieeefp.h> + +fp_except +fpgetmask() +{ + + /* XXX */ + abort(); +} diff --git a/lib/libc/arch/alpha/gen/fpgetround.c b/lib/libc/arch/alpha/gen/fpgetround.c new file mode 100644 index 00000000000..39b9b4744a6 --- /dev/null +++ b/lib/libc/arch/alpha/gen/fpgetround.c @@ -0,0 +1,49 @@ +/* $NetBSD: fpgetround.c,v 1.1 1995/04/29 05:09:55 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/types.h> +#include <ieeefp.h> + +fp_rnd +fpgetround() +{ + double fpcrval; + u_int64_t old; + + __asm__("trapb"); + __asm__("mf_fpcr %0" : "=f" (fpcrval)); + __asm__("trapb"); + old = *(u_int64_t *)&fpcrval; + + return ((old >> 58) & 0x3); +} diff --git a/lib/libc/arch/alpha/gen/fpgetsticky.c b/lib/libc/arch/alpha/gen/fpgetsticky.c new file mode 100644 index 00000000000..c36db3913d5 --- /dev/null +++ b/lib/libc/arch/alpha/gen/fpgetsticky.c @@ -0,0 +1,42 @@ +/* $NetBSD: fpgetsticky.c,v 1.1 1995/04/29 05:10:59 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <ieeefp.h> + +fp_except +fpgetsticky() +{ + + /* XXX */ + abort(); +} diff --git a/lib/libc/arch/alpha/gen/fpsetmask.c b/lib/libc/arch/alpha/gen/fpsetmask.c new file mode 100644 index 00000000000..87fc5a2f4b4 --- /dev/null +++ b/lib/libc/arch/alpha/gen/fpsetmask.c @@ -0,0 +1,43 @@ +/* $NetBSD: fpsetmask.c,v 1.1 1995/04/29 05:11:01 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <ieeefp.h> + +fp_except +fpsetmask(mask) + fp_except mask; +{ + + /* XXX */ + abort(); +} diff --git a/lib/libc/arch/alpha/gen/fpsetround.c b/lib/libc/arch/alpha/gen/fpsetround.c new file mode 100644 index 00000000000..c28093cad87 --- /dev/null +++ b/lib/libc/arch/alpha/gen/fpsetround.c @@ -0,0 +1,58 @@ +/* $NetBSD: fpsetround.c,v 1.1 1995/04/29 05:09:57 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/types.h> +#include <ieeefp.h> + +fp_rnd +fpsetround(rnd_dir) + fp_rnd rnd_dir; +{ + double fpcrval; + u_int64_t old, new; + + __asm__("trapb"); + __asm__("mf_fpcr %0" : "=f" (fpcrval)); + __asm__("trapb"); + old = *(u_int64_t *)&fpcrval; + + new = old & ~(long)0x0c00000000000000; + new = (long)rnd_dir << 58; + *(u_int64_t *)&fpcrval = new; + + __asm__("trapb"); + __asm__("mt_fpcr %0" : : "f" (fpcrval)); + __asm__("trapb"); + + return ((old >> 58) & 0x3); +} diff --git a/lib/libc/arch/alpha/gen/fpsetsticky.c b/lib/libc/arch/alpha/gen/fpsetsticky.c new file mode 100644 index 00000000000..90a993ee642 --- /dev/null +++ b/lib/libc/arch/alpha/gen/fpsetsticky.c @@ -0,0 +1,43 @@ +/* $NetBSD: fpsetsticky.c,v 1.1 1995/04/29 05:11:04 cgd Exp $ */ + +/* + * Copyright (c) 1995 Christopher G. Demetriou + * 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 Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <ieeefp.h> + +fp_except +fpsetsticky(sticky) + fp_except sticky; +{ + + /* XXX */ + abort(); +} diff --git a/lib/libc/arch/alpha/gen/frexp.c b/lib/libc/arch/alpha/gen/frexp.c new file mode 100644 index 00000000000..b05f2acd314 --- /dev/null +++ b/lib/libc/arch/alpha/gen/frexp.c @@ -0,0 +1,53 @@ +/* $NetBSD: frexp.c,v 1.1 1995/02/10 17:50:22 cgd Exp $ */ + +/* + * 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. + */ + +#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); + } +} diff --git a/lib/libc/arch/alpha/gen/infinity.c b/lib/libc/arch/alpha/gen/infinity.c new file mode 100644 index 00000000000..194a9f29d29 --- /dev/null +++ b/lib/libc/arch/alpha/gen/infinity.c @@ -0,0 +1,33 @@ +/* $NetBSD: infinity.c,v 1.1 1995/02/10 17:50:23 cgd Exp $ */ + +/* + * 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. + */ + +#include <math.h> + +/* bytes for +Infinity on an Alpha (IEEE double format) */ +char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; diff --git a/lib/libc/arch/alpha/gen/isinf.c b/lib/libc/arch/alpha/gen/isinf.c new file mode 100644 index 00000000000..11ab3cef319 --- /dev/null +++ b/lib/libc/arch/alpha/gen/isinf.c @@ -0,0 +1,52 @@ +/* $NetBSD: isinf.c,v 1.1 1995/02/10 17:50:23 cgd Exp $ */ + +/* + * 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. + */ + +#include <sys/types.h> +#include <machine/ieee.h> +#include <math.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 || p->dbl_fracl)); +} + +int +isinf(d) + double d; +{ + register struct ieee_double *p = (struct ieee_double *)&d; + + return (p->dbl_exp == DBL_EXP_INFNAN && + !p->dbl_frach && !p->dbl_fracl); +} diff --git a/lib/libc/arch/alpha/gen/ldexp.c b/lib/libc/arch/alpha/gen/ldexp.c new file mode 100644 index 00000000000..0cb993833d4 --- /dev/null +++ b/lib/libc/arch/alpha/gen/ldexp.c @@ -0,0 +1,134 @@ +/* $NetBSD: ldexp.c,v 1.1 1995/02/10 17:50:24 cgd Exp $ */ + +/* + * 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. + */ + +#include <sys/types.h> +#include <machine/ieee.h> +#include <errno.h> +#include <math.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); +} diff --git a/lib/libc/arch/alpha/gen/modf.c b/lib/libc/arch/alpha/gen/modf.c new file mode 100644 index 00000000000..47de384a571 --- /dev/null +++ b/lib/libc/arch/alpha/gen/modf.c @@ -0,0 +1,104 @@ +/* $NetBSD: modf.c,v 1.1 1995/02/10 17:50:25 cgd Exp $ */ + +/* + * 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. + */ + +#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); +} diff --git a/lib/libc/arch/alpha/gen/setjmp.S b/lib/libc/arch/alpha/gen/setjmp.S new file mode 100644 index 00000000000..3e07dd98b65 --- /dev/null +++ b/lib/libc/arch/alpha/gen/setjmp.S @@ -0,0 +1,124 @@ +/* $NetBSD: setjmp.S,v 1.1 1995/02/10 17:50:26 cgd Exp $ */ + +/* + * 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. + */ + +#include "DEFS.h" + +/* + * C library -- setjmp, longjmp + * + * longjmp(a,v) + * will generate a "return(v)" from + * the last call to + * setjmp(a) + * by restoring registers from the stack, + * and the previous signal state. + */ + + .set noreorder + +LEAF(setjmp, 1) + SETGP(pv) + stq ra, (2 * 8)(a0) /* sc_pc = return address */ + stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */ + stq s1, ((10 + 4) * 8)(a0) + stq s2, ((11 + 4) * 8)(a0) + stq s3, ((12 + 4) * 8)(a0) + stq s4, ((13 + 4) * 8)(a0) + stq s5, ((14 + 4) * 8)(a0) + stq s6, ((15 + 4) * 8)(a0) + stq ra, ((26 + 4) * 8)(a0) + stq sp, ((30 + 4) * 8)(a0) + + /* + * get signal information + */ + mov a0, s0 /* squirrel away ptr to sc */ + + /* see what's blocked */ + mov zero, a0 + CALL(sigblock) /* see what's blocked */ + stq v0, (1 * 8)(s0) /* and remember it in sc_mask */ + + lda sp, -16(sp) /* sizeof struct sigaltstack */ + mov zero, a0 + mov sp, a1 + CALL(sigaltstack) + ldl t0, 12(sp) + lda sp, 16(sp) + ldq ra, ((26 + 4) * 8)(s0) /* restore return address */ + blt v0, botch /* check for error */ + and t0, 0x1, t0 /* get SA_ONSTACK flag */ + stq t0, (0 * 8)(s0) /* and save it in sc_onstack */ + /* + * Restore old s0 and a0, and continue saving registers + */ + mov s0, a0 + ldq s0, (( 9 + 4) * 8)(a0) + + CONST(0xACEDBADE, t0) /* sigcontext magic number */ + stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */ + /* Too bad we can't check if we actually used FP */ + CONST(1, t0) + stq t0, (36 * 8)(a0) /* say we've used FP. */ + stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */ + stt fs1, ((3 + 37) * 8)(a0) + stt fs2, ((4 + 37) * 8)(a0) + stt fs3, ((5 + 37) * 8)(a0) + stt fs4, ((6 + 37) * 8)(a0) + stt fs5, ((7 + 37) * 8)(a0) + stt fs6, ((8 + 37) * 8)(a0) + stt fs7, ((9 + 37) * 8)(a0) + MF_FPCR(ft0) /* get FP control reg */ + stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */ + stq zero, (70 * 8)(a0) /* FP software control XXX */ + stq zero, (71 * 8)(a0) /* sc_reserved[0] */ + stq zero, (72 * 8)(a0) /* sc_reserved[1] */ + stq zero, (73 * 8)(a0) /* sc_xxx[0] */ + stq zero, (74 * 8)(a0) /* sc_xxx[1] */ + stq zero, (75 * 8)(a0) /* sc_xxx[2] */ + stq zero, (76 * 8)(a0) /* sc_xxx[3] */ + stq zero, (77 * 8)(a0) /* sc_xxx[4] */ + stq zero, (78 * 8)(a0) /* sc_xxx[5] */ + stq zero, (79 * 8)(a0) /* sc_xxx[6] */ + stq zero, (80 * 8)(a0) /* sc_xxx[7] */ + + mov zero, v0 /* return zero */ + RET +END(setjmp) + +LEAF(longjmp, 2) + SETGP(pv) + stq a1, (( 0 + 4) * 8)(a0) /* save return value */ + CALL(sigreturn) /* use sigreturn to return */ + +botch: + CALL(longjmperror) + CALL(abort) + RET /* "can't" get here... */ +END(longjmp) diff --git a/lib/libc/arch/alpha/gen/sigsetjmp.S b/lib/libc/arch/alpha/gen/sigsetjmp.S new file mode 100644 index 00000000000..b1fd919fbc2 --- /dev/null +++ b/lib/libc/arch/alpha/gen/sigsetjmp.S @@ -0,0 +1,62 @@ +/* $NetBSD: sigsetjmp.S,v 1.1 1995/02/10 17:50:27 cgd Exp $ */ + +/* + * 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. + */ + +#include "DEFS.h" + +/* + * C library -- sigsetjmp, siglongjmp + * + * siglongjmp(a,v) + * will generate a "return(v)" from + * the last call to + * sigsetjmp(a, mask) + * by restoring registers from the stack. + * If `mask' is non-zero, the previous signal + * state will be restored. + */ + + .set noreorder + +LEAF(sigsetjmp, 2) + SETGP(pv) + stq a1, (81 * 8)(a0) /* save the mask */ + bne a1, Lsavesig /* if !zero, save signals */ + JMP(_setjmp) /* else don't. */ +Lsavesig: + JMP(setjmp) +END(sigsetjmp) + +LEAF(siglongjmp, 2) + SETGP(pv) + ldq t0, (81 * 8)(a0) /* get the mask */ + bne t0, Lrestoresig /* if !zero, restore signals */ + JMP(_longjmp) +Lrestoresig: + JMP(longjmp) +END(siglongjmp) diff --git a/lib/libc/arch/alpha/net/Makefile.inc b/lib/libc/arch/alpha/net/Makefile.inc new file mode 100644 index 00000000000..91f20a32992 --- /dev/null +++ b/lib/libc/arch/alpha/net/Makefile.inc @@ -0,0 +1,3 @@ +# $NetBSD: Makefile.inc,v 1.1 1995/02/25 14:58:43 cgd Exp $ + +SRCS+= htonl.c htons.c ntohl.c ntohs.c diff --git a/lib/libc/arch/alpha/string/Makefile.inc b/lib/libc/arch/alpha/string/Makefile.inc new file mode 100644 index 00000000000..9fd15adc920 --- /dev/null +++ b/lib/libc/arch/alpha/string/Makefile.inc @@ -0,0 +1,7 @@ +# $NetBSD: Makefile.inc,v 1.3 1995/08/14 04:09:23 cgd Exp $ + +SRCS+= bcmp.c bcopy.S bzero.S 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 +SRCS+= memcpy.S memmove.S diff --git a/lib/libc/arch/alpha/string/bcopy.S b/lib/libc/arch/alpha/string/bcopy.S new file mode 100644 index 00000000000..4701f8be7c3 --- /dev/null +++ b/lib/libc/arch/alpha/string/bcopy.S @@ -0,0 +1,288 @@ +/* $NetBSD: bcopy.S,v 1.2 1995/09/26 03:37:10 cgd Exp $ */ + +/* + * Copyright (c) 1995 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Trevor Blackwell. Support for use as memcpy() and memmove() + * added by Chris 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. + */ + +#include "DEFS.h" + +#if defined(MEMCOPY) || defined(MEMMOVE) +#ifdef MEMCOPY +#define FUNCTION memcpy +#else +#define FUNCTION memmove +#endif +#define SRCREG a1 +#define DSTREG a0 +#else /* !(defined(MEMCOPY) || defined(MEMMOVE)) */ +#define FUNCTION bcopy +#define SRCREG a0 +#define DSTREG a1 +#endif /* !(defined(MEMCOPY) || defined(MEMMOVE)) */ + +#define SIZEREG a2 + +/* + * Copy bytes. + * + * void bcopy(char *from, char *to, size_t len); + * char *memcpy(void *to, const void *from, size_t len); + * char *memmove(void *to, const void *from, size_t len); + * + * No matter how invoked, the source and destination registers + * for calculation. There's no point in copying them to "working" + * registers, since the code uses their values "in place," and + * copying them would be slower. + */ + +LEAF(FUNCTION,3) + +#if defined(MEMCOPY) || defined(MEMMOVE) + /* set up return value, while we still can */ + mov DSTREG,v0 +#endif + + /* Check for negative length */ + ble SIZEREG,bcopy_done + + /* Check for overlap */ + subq DSTREG,SRCREG,t5 + cmpult t5,SIZEREG,t5 + bne t5,bcopy_overlap + + /* a3 = end address */ + addq SRCREG,SIZEREG,a3 + + /* Get the first word */ + ldq_u t2,0(SRCREG) + + /* Do they have the same alignment? */ + xor SRCREG,DSTREG,t0 + and t0,7,t0 + and DSTREG,7,t1 + bne t0,bcopy_different_alignment + + /* src & dst have same alignment */ + beq t1,bcopy_all_aligned + + ldq_u t3,0(DSTREG) + addq SIZEREG,t1,SIZEREG + mskqh t2,SRCREG,t2 + mskql t3,SRCREG,t3 + or t2,t3,t2 + + /* Dst is 8-byte aligned */ + +bcopy_all_aligned: + /* If less than 8 bytes,skip loop */ + subq SIZEREG,1,t0 + and SIZEREG,7,SIZEREG + bic t0,7,t0 + beq t0,bcopy_samealign_lp_end + +bcopy_samealign_lp: + stq_u t2,0(DSTREG) + addq DSTREG,8,DSTREG + ldq_u t2,8(SRCREG) + subq t0,8,t0 + addq SRCREG,8,SRCREG + bne t0,bcopy_samealign_lp + +bcopy_samealign_lp_end: + /* If we're done, exit */ + bne SIZEREG,bcopy_small_left + stq_u t2,0(DSTREG) + RET + +bcopy_small_left: + mskql t2,SIZEREG,t4 + ldq_u t3,0(DSTREG) + mskqh t3,SIZEREG,t3 + or t4,t3,t4 + stq_u t4,0(DSTREG) + RET + +bcopy_different_alignment: + /* + * this is the fun part + */ + addq SRCREG,SIZEREG,a3 + cmpule SIZEREG,8,t0 + bne t0,bcopy_da_finish + + beq t1,bcopy_da_noentry + + /* Do the initial partial word */ + subq zero,DSTREG,t0 + and t0,7,t0 + ldq_u t3,7(SRCREG) + extql t2,SRCREG,t2 + extqh t3,SRCREG,t3 + or t2,t3,t5 + insql t5,DSTREG,t5 + ldq_u t6,0(DSTREG) + mskql t6,DSTREG,t6 + or t5,t6,t5 + stq_u t5,0(DSTREG) + addq SRCREG,t0,SRCREG + addq DSTREG,t0,DSTREG + subq SIZEREG,t0,SIZEREG + ldq_u t2,0(SRCREG) + +bcopy_da_noentry: + subq SIZEREG,1,t0 + bic t0,7,t0 + and SIZEREG,7,SIZEREG + beq t0,bcopy_da_finish2 + +bcopy_da_lp: + ldq_u t3,7(SRCREG) + addq SRCREG,8,SRCREG + extql t2,SRCREG,t4 + extqh t3,SRCREG,t5 + subq t0,8,t0 + or t4,t5,t5 + stq t5,0(DSTREG) + addq DSTREG,8,DSTREG + beq t0,bcopy_da_finish1 + ldq_u t2,7(SRCREG) + addq SRCREG,8,SRCREG + extql t3,SRCREG,t4 + extqh t2,SRCREG,t5 + subq t0,8,t0 + or t4,t5,t5 + stq t5,0(DSTREG) + addq DSTREG,8,DSTREG + bne t0,bcopy_da_lp + +bcopy_da_finish2: + /* Do the last new word */ + mov t2,t3 + +bcopy_da_finish1: + /* Do the last partial word */ + ldq_u t2,-1(a3) + extql t3,SRCREG,t3 + extqh t2,SRCREG,t2 + or t2,t3,t2 + br zero,bcopy_samealign_lp_end + +bcopy_da_finish: + /* Do the last word in the next source word */ + ldq_u t3,-1(a3) + extql t2,SRCREG,t2 + extqh t3,SRCREG,t3 + or t2,t3,t2 + insqh t2,DSTREG,t3 + insql t2,DSTREG,t2 + lda t4,-1(zero) + mskql t4,SIZEREG,t5 + cmovne t5,t5,t4 + insqh t4,DSTREG,t5 + insql t4,DSTREG,t4 + addq DSTREG,SIZEREG,a4 + ldq_u t6,0(DSTREG) + ldq_u t7,-1(a4) + bic t6,t4,t6 + bic t7,t5,t7 + and t2,t4,t2 + and t3,t5,t3 + or t2,t6,t2 + or t3,t7,t3 + stq_u t3,-1(a4) + stq_u t2,0(DSTREG) + RET + +bcopy_overlap: + /* + * Basically equivalent to previous case, only backwards. + * Not quite as highly optimized + */ + addq SRCREG,SIZEREG,a3 + addq DSTREG,SIZEREG,a4 + + /* less than 8 bytes - don't worry about overlap */ + cmpule SIZEREG,8,t0 + bne t0,bcopy_ov_short + + /* Possibly do a partial first word */ + and a4,7,t4 + beq t4,bcopy_ov_nostart2 + subq a3,t4,a3 + subq a4,t4,a4 + ldq_u t1,0(a3) + subq SIZEREG,t4,SIZEREG + ldq_u t2,7(a3) + ldq t3,0(a4) + extql t1,a3,t1 + extqh t2,a3,t2 + or t1,t2,t1 + mskqh t3,t4,t3 + mskql t1,t4,t1 + or t1,t3,t1 + stq t1,0(a4) + +bcopy_ov_nostart2: + bic SIZEREG,7,t4 + and SIZEREG,7,SIZEREG + beq t4,bcopy_ov_lp_end + +bcopy_ov_lp: + /* This could be more pipelined, but it doesn't seem worth it */ + ldq_u t0,-8(a3) + subq a4,8,a4 + ldq_u t1,-1(a3) + subq a3,8,a3 + extql t0,a3,t0 + extqh t1,a3,t1 + subq t4,8,t4 + or t0,t1,t0 + stq t0,0(a4) + bne t4,bcopy_ov_lp + +bcopy_ov_lp_end: + beq SIZEREG,bcopy_done + + ldq_u t0,0(SRCREG) + ldq_u t1,7(SRCREG) + ldq_u t2,0(DSTREG) + extql t0,SRCREG,t0 + extqh t1,SRCREG,t1 + or t0,t1,t0 + insql t0,DSTREG,t0 + mskql t2,DSTREG,t2 + or t2,t0,t2 + stq_u t2,0(DSTREG) + +bcopy_done: + RET + +bcopy_ov_short: + ldq_u t2,0(SRCREG) + br zero,bcopy_da_finish + + END(FUNCTION) diff --git a/lib/libc/arch/alpha/string/bzero.S b/lib/libc/arch/alpha/string/bzero.S new file mode 100644 index 00000000000..616b5100fa0 --- /dev/null +++ b/lib/libc/arch/alpha/string/bzero.S @@ -0,0 +1,110 @@ +/* $NetBSD: bzero.S,v 1.1 1995/08/14 04:09:26 cgd Exp $ */ + +/* + * Copyright (c) 1995 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Trevor Blackwell + * + * 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. + */ + +#include "DEFS.h" + +LEAF(bzero,2) + ble a1,bzero_done + bic a1,63,t3 /* t3 is # bytes to do 64 bytes at a time */ + + /* If nothing in first word, ignore it */ + subq zero,a0,t0 + and t0,7,t0 /* t0 = (0-size)%8 */ + beq t0,bzero_nostart1 + + cmpult a1,t0,t1 /* if size > size%8 goto noshort */ + beq t1,bzero_noshort + + /* + * The whole thing is less than a word. + * Mask off 1..7 bytes, and finish. + */ + ldq_u t2,0(a0) + lda t0,-1(zero) /* t0=-1 */ + mskql t0,a1,t0 /* Get ff in bytes (a0%8)..((a0+a1-1)%8) */ + insql t0,a0,t0 + bic t2,t0,t2 /* zero those bytes in word */ + stq_u t2,0(a0) + RET + +bzero_noshort: + /* Handle the first partial word */ + ldq_u t2,0(a0) + subq a1,t0,a1 + mskql t2,a0,t2 /* zero bytes (a0%8)..7 in word */ + stq_u t2,0(a0) + + addq a0,t0,a0 /* round a0 up to next word */ + bic a1,63,t3 /* recalc t3 (# bytes to do 64 bytes at a + time) */ + +bzero_nostart1: + /* + * Loop, zeroing 64 bytes at a time + */ + beq t3,bzero_lp_done +bzero_lp: + stq zero,0(a0) + stq zero,8(a0) + stq zero,16(a0) + stq zero,24(a0) + subq t3,64,t3 + stq zero,32(a0) + stq zero,40(a0) + stq zero,48(a0) + stq zero,56(a0) + addq a0,64,a0 + bne t3,bzero_lp + +bzero_lp_done: + /* + * Handle the last 0..7 words. + * We mask off the low bits, so we don't need an extra + * compare instruction for the loop (just a bne. heh-heh) + */ + and a1,0x38,t4 + beq t4,bzero_finish_lp_done +bzero_finish_lp: + stq zero,0(a0) + subq t4,8,t4 + addq a0,8,a0 + bne t4,bzero_finish_lp + + /* Do the last partial word */ +bzero_finish_lp_done: + and a1,7,t5 /* 0..7 bytes left */ + beq t5,bzero_done /* mskqh won't change t0 if t5==0, but I + don't want to touch, say, a new VM page */ + ldq t0,0(a0) + mskqh t0,t5,t0 + stq t0,0(a0) +bzero_done: + RET + + END(bzero) diff --git a/lib/libc/arch/alpha/string/memcpy.S b/lib/libc/arch/alpha/string/memcpy.S new file mode 100644 index 00000000000..7f5527da391 --- /dev/null +++ b/lib/libc/arch/alpha/string/memcpy.S @@ -0,0 +1,4 @@ +/* $NetBSD: memcpy.S,v 1.1 1995/08/13 00:40:47 cgd Exp $ */ + +#define MEMCOPY +#include "bcopy.S" diff --git a/lib/libc/arch/alpha/string/memmove.S b/lib/libc/arch/alpha/string/memmove.S new file mode 100644 index 00000000000..4e632d2b4de --- /dev/null +++ b/lib/libc/arch/alpha/string/memmove.S @@ -0,0 +1,4 @@ +/* $NetBSD: memmove.S,v 1.1 1995/08/13 00:40:48 cgd Exp $ */ + +#define MEMMOVE +#include "bcopy.S" diff --git a/lib/libc/arch/alpha/sys/Ovfork.S b/lib/libc/arch/alpha/sys/Ovfork.S new file mode 100644 index 00000000000..aaec3bf5710 --- /dev/null +++ b/lib/libc/arch/alpha/sys/Ovfork.S @@ -0,0 +1,35 @@ +/* $NetBSD: Ovfork.S,v 1.1 1995/02/10 17:50:29 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +SYSCALL(vfork) + cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */ + RET +END(vfork) diff --git a/lib/libc/arch/alpha/sys/brk.S b/lib/libc/arch/alpha/sys/brk.S new file mode 100644 index 00000000000..09421bad028 --- /dev/null +++ b/lib/libc/arch/alpha/sys/brk.S @@ -0,0 +1,49 @@ +/* $NetBSD: brk.S,v 1.1 1995/02/10 17:50:30 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + + .globl _end +IMPORT(curbrk, 8) + + .data +EXPORT(minbrk) + .quad _end + + .text +LEAF(brk, 1) + SETGP(pv) + ldq v0, minbrk + cmpult a0, v0, t0 + cmovne t0, v0, a0 + SYSCALL_NOLABEL(break) + stq a0, curbrk + mov zero, v0 + RET +END(brk) diff --git a/lib/libc/arch/alpha/sys/cerror.S b/lib/libc/arch/alpha/sys/cerror.S new file mode 100644 index 00000000000..d0ee6ccffe3 --- /dev/null +++ b/lib/libc/arch/alpha/sys/cerror.S @@ -0,0 +1,40 @@ +/* $NetBSD: cerror.S,v 1.1 1995/02/10 17:50:31 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +IMPORT(errno, 4) + +LEAF(cerror, 0) + br t0, 1f +1: SETGP(t0) + stl v0, errno + ldiq v0, -1 + RET +END(cerror) diff --git a/lib/libc/arch/alpha/sys/exect.S b/lib/libc/arch/alpha/sys/exect.S new file mode 100644 index 00000000000..ed2257b419e --- /dev/null +++ b/lib/libc/arch/alpha/sys/exect.S @@ -0,0 +1,35 @@ +/* $NetBSD: exect.S,v 1.1 1995/02/10 17:50:32 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +LEAF(exect, 3) + SYSCALL_NOLABEL(execve) + RET +END(exect) diff --git a/lib/libc/arch/alpha/sys/fork.S b/lib/libc/arch/alpha/sys/fork.S new file mode 100644 index 00000000000..17ef463a0ef --- /dev/null +++ b/lib/libc/arch/alpha/sys/fork.S @@ -0,0 +1,35 @@ +/* $NetBSD: fork.S,v 1.1 1995/02/10 17:50:34 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +SYSCALL(fork) + cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */ + RET +END(fork) diff --git a/lib/libc/arch/alpha/sys/pipe.S b/lib/libc/arch/alpha/sys/pipe.S new file mode 100644 index 00000000000..973529c574a --- /dev/null +++ b/lib/libc/arch/alpha/sys/pipe.S @@ -0,0 +1,37 @@ +/* $NetBSD: pipe.S,v 1.1 1995/02/10 17:50:35 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +SYSCALL(pipe) + stl v0, 0(a0) + stl a4, 4(a0) + mov zero, v0 + RET +END(pipe) diff --git a/lib/libc/arch/alpha/sys/ptrace.S b/lib/libc/arch/alpha/sys/ptrace.S new file mode 100644 index 00000000000..2dfe551d591 --- /dev/null +++ b/lib/libc/arch/alpha/sys/ptrace.S @@ -0,0 +1,38 @@ +/* $NetBSD: ptrace.S,v 1.1 1995/02/10 17:50:36 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +IMPORT(errno, 4) + +LEAF(ptrace, 4) + stl zero, errno + SYSCALL_NOLABEL(ptrace) + RET +END(ptrace) diff --git a/lib/libc/arch/alpha/sys/reboot.S b/lib/libc/arch/alpha/sys/reboot.S new file mode 100644 index 00000000000..04a1b7b6bf8 --- /dev/null +++ b/lib/libc/arch/alpha/sys/reboot.S @@ -0,0 +1,35 @@ +/* $NetBSD: reboot.S,v 1.1 1995/02/10 17:50:37 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +SYSCALL(reboot) + /* Should never get here. */ + call_pal PAL_halt /* Privileged; will fault. */ +END(reboot) diff --git a/lib/libc/arch/alpha/sys/sbrk.S b/lib/libc/arch/alpha/sys/sbrk.S new file mode 100644 index 00000000000..969083b2311 --- /dev/null +++ b/lib/libc/arch/alpha/sys/sbrk.S @@ -0,0 +1,47 @@ +/* $NetBSD: sbrk.S,v 1.1 1995/02/10 17:50:38 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + + .globl _end + + .data +EXPORT(curbrk) + .quad _end + + .text +LEAF(sbrk, 1) + SETGP(pv) + ldq a1, curbrk + addq a0, a1, a0 + SYSCALL_NOLABEL(break) + stq a0, curbrk + mov a1, v0 + RET +END(sbrk) diff --git a/lib/libc/arch/alpha/sys/setlogin.S b/lib/libc/arch/alpha/sys/setlogin.S new file mode 100644 index 00000000000..22e84bb09d9 --- /dev/null +++ b/lib/libc/arch/alpha/sys/setlogin.S @@ -0,0 +1,37 @@ +/* $NetBSD: setlogin.S,v 1.1 1995/02/10 17:50:39 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +IMPORT(__logname_valid, 4) /* in getlogin() */ + +SYSCALL(setlogin) + stl zero, __logname_valid /* clear it */ + RET +END(setlogin) diff --git a/lib/libc/arch/alpha/sys/sigpending.S b/lib/libc/arch/alpha/sys/sigpending.S new file mode 100644 index 00000000000..72b727a83c7 --- /dev/null +++ b/lib/libc/arch/alpha/sys/sigpending.S @@ -0,0 +1,36 @@ +/* $NetBSD: sigpending.S,v 1.1 1995/02/10 17:50:40 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +SYSCALL(sigpending) + stl v0, 0(a0) + mov zero, v0 + RET +END(sigpending) diff --git a/lib/libc/arch/alpha/sys/sigprocmask.S b/lib/libc/arch/alpha/sys/sigprocmask.S new file mode 100644 index 00000000000..4d397bf9b78 --- /dev/null +++ b/lib/libc/arch/alpha/sys/sigprocmask.S @@ -0,0 +1,44 @@ +/* $NetBSD: sigprocmask.S,v 1.1 1995/02/10 17:50:41 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +LEAF(sigprocmask, 3) + mov a2, a5 /* safe */ + cmoveq a1, 1, a0 /* if set == NULL, how = SIG_BLOCK */ + beq a1, Ldoit /* and set = 0, and do it. */ + ldl a1, 0(a1) /* load the set from *set */ +Ldoit: SYSCALL_NOLABEL(sigprocmask) + beq a5, Lret /* if they don't want old mask, done */ + stl v0, 0(a5) /* otherwise, give it to them. */ +Lret: mov zero, v0 + RET + + END(sigprocmask) + diff --git a/lib/libc/arch/alpha/sys/sigreturn.S b/lib/libc/arch/alpha/sys/sigreturn.S new file mode 100644 index 00000000000..c22abc2c416 --- /dev/null +++ b/lib/libc/arch/alpha/sys/sigreturn.S @@ -0,0 +1,38 @@ +/* $NetBSD: sigreturn.S,v 1.1 1995/02/10 17:50:42 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +/* + * We must preserve the state of the registers as the user has set them up. + * However, that doesn't involve any special work on the Alpha. + * (XXX PROFILING) + */ + +RSYSCALL(sigreturn) diff --git a/lib/libc/arch/alpha/sys/sigsuspend.S b/lib/libc/arch/alpha/sys/sigsuspend.S new file mode 100644 index 00000000000..7170b7e55e8 --- /dev/null +++ b/lib/libc/arch/alpha/sys/sigsuspend.S @@ -0,0 +1,37 @@ +/* $NetBSD: sigsuspend.S,v 1.1 1995/02/10 17:50:43 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +LEAF(sigsuspend, 1) + ldl a0, 0(a0) /* pass *mask instead of mask */ + SYSCALL_NOLABEL(sigsuspend) + mov zero, v0 /* shouldn't need; just in case... */ + RET +END(sigsuspend) diff --git a/lib/libc/arch/alpha/sys/syscall.S b/lib/libc/arch/alpha/sys/syscall.S new file mode 100644 index 00000000000..2ccf4d315e8 --- /dev/null +++ b/lib/libc/arch/alpha/sys/syscall.S @@ -0,0 +1,32 @@ +/* $NetBSD: syscall.S,v 1.1 1995/02/10 17:50:44 cgd Exp $ */ + +/* + * 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. + */ + +#include "SYS.h" + +RSYSCALL(syscall) |