summaryrefslogtreecommitdiff
path: root/lib/libc/arch/ns32k
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/arch/ns32k')
-rw-r--r--lib/libc/arch/ns32k/DEFS.h44
-rw-r--r--lib/libc/arch/ns32k/Makefile.inc4
-rw-r--r--lib/libc/arch/ns32k/SYS.h67
-rw-r--r--lib/libc/arch/ns32k/gen/Makefile.inc5
-rw-r--r--lib/libc/arch/ns32k/gen/__main.c1
-rw-r--r--lib/libc/arch/ns32k/gen/_setjmp.S64
-rw-r--r--lib/libc/arch/ns32k/gen/alloca.S37
-rw-r--r--lib/libc/arch/ns32k/gen/fabs.S28
-rw-r--r--lib/libc/arch/ns32k/gen/flt_rounds.c20
-rw-r--r--lib/libc/arch/ns32k/gen/fpgetround.c15
-rw-r--r--lib/libc/arch/ns32k/gen/fpsetround.c24
-rw-r--r--lib/libc/arch/ns32k/gen/frexp.S62
-rw-r--r--lib/libc/arch/ns32k/gen/infinity.c10
-rw-r--r--lib/libc/arch/ns32k/gen/isinf.c68
-rw-r--r--lib/libc/arch/ns32k/gen/ldexp.S88
-rw-r--r--lib/libc/arch/ns32k/gen/modf.S68
-rw-r--r--lib/libc/arch/ns32k/gen/setjmp.S70
-rw-r--r--lib/libc/arch/ns32k/gen/sigsetjmp.S85
-rw-r--r--lib/libc/arch/ns32k/net/Makefile.inc3
-rw-r--r--lib/libc/arch/ns32k/net/htonl.S44
-rw-r--r--lib/libc/arch/ns32k/net/htons.S42
-rw-r--r--lib/libc/arch/ns32k/net/ntohl.S44
-rw-r--r--lib/libc/arch/ns32k/net/ntohs.S42
-rw-r--r--lib/libc/arch/ns32k/stdlib/abs.S28
-rw-r--r--lib/libc/arch/ns32k/string/Makefile.inc7
-rw-r--r--lib/libc/arch/ns32k/string/bzero.c73
-rw-r--r--lib/libc/arch/ns32k/sys/Ovfork.S35
-rw-r--r--lib/libc/arch/ns32k/sys/brk.S47
-rw-r--r--lib/libc/arch/ns32k/sys/cerror.S35
-rw-r--r--lib/libc/arch/ns32k/sys/exect.S35
-rw-r--r--lib/libc/arch/ns32k/sys/fork.S33
-rw-r--r--lib/libc/arch/ns32k/sys/pipe.S31
-rw-r--r--lib/libc/arch/ns32k/sys/ptrace.S40
-rw-r--r--lib/libc/arch/ns32k/sys/reboot.S26
-rw-r--r--lib/libc/arch/ns32k/sys/sbrk.S46
-rw-r--r--lib/libc/arch/ns32k/sys/setlogin.S32
-rw-r--r--lib/libc/arch/ns32k/sys/sigpending.S30
-rw-r--r--lib/libc/arch/ns32k/sys/sigprocmask.S49
-rw-r--r--lib/libc/arch/ns32k/sys/sigreturn.S41
-rw-r--r--lib/libc/arch/ns32k/sys/sigsuspend.S34
-rw-r--r--lib/libc/arch/ns32k/sys/syscall.S30
41 files changed, 1587 insertions, 0 deletions
diff --git a/lib/libc/arch/ns32k/DEFS.h b/lib/libc/arch/ns32k/DEFS.h
new file mode 100644
index 00000000000..a1c0cea954e
--- /dev/null
+++ b/lib/libc/arch/ns32k/DEFS.h
@@ -0,0 +1,44 @@
+/*-
+ * 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.
+ *
+ * @(#)DEFS.h 5.1 (Berkeley) 4/23/90
+ *
+ * $Id: DEFS.h,v 1.1 1995/10/18 08:41:36 deraadt Exp $
+ *
+ * Modified for the ns532 by Phil Nelson, 12/1/92
+ *
+ */
+
+#include <machine/asm.h>
diff --git a/lib/libc/arch/ns32k/Makefile.inc b/lib/libc/arch/ns32k/Makefile.inc
new file mode 100644
index 00000000000..638bcc37267
--- /dev/null
+++ b/lib/libc/arch/ns32k/Makefile.inc
@@ -0,0 +1,4 @@
+# $Id: Makefile.inc,v 1.1 1995/10/18 08:41:36 deraadt Exp $
+
+KMINCLUDES= arch/ns32k/SYS.h arch/ns32k/DEFS.h
+KMSRCS= setjmp.S htonl.S htons.S ntohl.S ntohs.S
diff --git a/lib/libc/arch/ns32k/SYS.h b/lib/libc/arch/ns32k/SYS.h
new file mode 100644
index 00000000000..69aba2cbdb0
--- /dev/null
+++ b/lib/libc/arch/ns32k/SYS.h
@@ -0,0 +1,67 @@
+/*-
+ * 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.
+ *
+ * @(#)SYS.h 5.5 (Berkeley) 5/7/91
+ *
+ * $Id: SYS.h,v 1.1 1995/10/18 08:41:36 deraadt Exp $
+ *
+ * Modified for the ns532 by Phil Nelson, 12/1/92
+ *
+ */
+
+#include <machine/asm.h>
+#include <sys/syscall.h>
+
+#define SYSCALL(x) \
+ ENTRY(x); \
+ movd CAT(SYS_,x),r0; \
+ SVC; \
+ bcs cerror
+
+#define RSYSCALL(x) \
+ SYSCALL(x); \
+ ret 0
+
+#define PSEUDO(x,y) \
+ ENTRY(x); \
+ movd CAT(SYS_,y),r0; \
+ SVC; \
+ ret 0
+
+#define CALL(x,y) \
+ bsr CAT(_,y); \
+ adjspd -4*x
+
+ .globl cerror
diff --git a/lib/libc/arch/ns32k/gen/Makefile.inc b/lib/libc/arch/ns32k/gen/Makefile.inc
new file mode 100644
index 00000000000..ed6ccce6f18
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/Makefile.inc
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile.inc,v 1.4 1995/05/03 03:25:11 phil Exp $
+
+SRCS+= __main.c _setjmp.S alloca.S fabs.S frexp.S infinity.c isinf.c
+SRCS+= ldexp.S modf.S setjmp.S sigsetjmp.S
+SRCS+= flt_rounds.c fpgetround.c fpsetround.c
diff --git a/lib/libc/arch/ns32k/gen/__main.c b/lib/libc/arch/ns32k/gen/__main.c
new file mode 100644
index 00000000000..46b92e933cd
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/__main.c
@@ -0,0 +1 @@
+__main(){}
diff --git a/lib/libc/arch/ns32k/gen/_setjmp.S b/lib/libc/arch/ns32k/gen/_setjmp.S
new file mode 100644
index 00000000000..013667dd508
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/_setjmp.S
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: _setjmp.S,v 1.1 1995/10/18 08:41:36 deraadt Exp $
+ *
+ */
+
+#include <machine/asm.h>
+#include <machine/jmpbuf.h>
+
+ENTRY(_setjmp)
+ movd 4(sp), r2 /* jmp_buf */
+ movd 0(sp), JMP_BUF_PC(r2) /* pc of caller */
+
+ sprd sp, JMP_BUF_SP(r2)
+ sprd fp, JMP_BUF_FP(r2)
+ sprd sb, JMP_BUF_SB(r2)
+ movd r3, JMP_BUF_R3(r2) /* save registers r3-r7 */
+ movd r4, JMP_BUF_R4(r2)
+ movd r5, JMP_BUF_R5(r2)
+ movd r6, JMP_BUF_R6(r2)
+ movd r7, JMP_BUF_R7(r2)
+
+ movqd 0, r0
+ ret 0
+
+ENTRY(_longjmp)
+ movd 4(sp), r2 /* jmp_buf */
+ movd 8(sp), r0 /* value */
+
+ lprd sp, JMP_BUF_SP(r2)
+ lprd fp, JMP_BUF_FP(r2)
+ lprd sb, JMP_BUF_SB(r2)
+ movd JMP_BUF_R3(r2), r3 /* load registers r3-r7 */
+ movd JMP_BUF_R4(r2), r4
+ movd JMP_BUF_R5(r2), r5
+ movd JMP_BUF_R6(r2), r6
+ movd JMP_BUF_R7(r2), r7
+
+ movd JMP_BUF_PC(r2), 0(sp) /* patch return pc */
+
+ cmpqd 0, r0
+ bne nonzero
+ movqd 1, r0
+nonzero:
+ ret 0
+
diff --git a/lib/libc/arch/ns32k/gen/alloca.S b/lib/libc/arch/ns32k/gen/alloca.S
new file mode 100644
index 00000000000..11787bb8d74
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/alloca.S
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: alloca.S,v 1.1 1995/10/18 08:41:36 deraadt Exp $
+ */
+/*
+ * Note: Saved registers are accessed through the frame pointer so
+ * no special magic is required here.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(alloca)
+ movd tos,r2 /* get return address */
+ movd tos,r1 /* get length */
+ sprd sp,r0
+ subd r1,r0
+ lprd sp,r0
+ movd r1,tos
+ jump 0(r2)
diff --git a/lib/libc/arch/ns32k/gen/fabs.S b/lib/libc/arch/ns32k/gen/fabs.S
new file mode 100644
index 00000000000..b151d88a0a9
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fabs.S
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: fabs.S,v 1.1 1995/10/18 08:41:36 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+
+ENTRY(fabs)
+ absl S_ARG0,f0
+ ret 0
diff --git a/lib/libc/arch/ns32k/gen/flt_rounds.c b/lib/libc/arch/ns32k/gen/flt_rounds.c
new file mode 100644
index 00000000000..99847bf5c98
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/flt_rounds.c
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin, Apr 28, 1995
+ * Public domain.
+ */
+
+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()
+{
+ int x;
+
+ __asm__("sfsr %0" : "=r" (x));
+ return map[(x >> 7) & 0x03];
+}
diff --git a/lib/libc/arch/ns32k/gen/fpgetround.c b/lib/libc/arch/ns32k/gen/fpgetround.c
new file mode 100644
index 00000000000..3aa000b35eb
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fpgetround.c
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin, Apr 28, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+
+fp_rnd
+fpgetround()
+{
+ int x;
+
+ __asm__("sfsr %0" : "=r" (x));
+ return (x >> 7) & 0x03;
+}
diff --git a/lib/libc/arch/ns32k/gen/fpsetround.c b/lib/libc/arch/ns32k/gen/fpsetround.c
new file mode 100644
index 00000000000..e3d7fa98218
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/fpsetround.c
@@ -0,0 +1,24 @@
+/*
+ * Written by J.T. Conklin, Apr 28, 1995
+ * Public domain.
+ */
+
+#include <ieeefp.h>
+
+fp_rnd
+fpsetround(rnd_dir)
+ fp_rnd rnd_dir;
+{
+ fp_rnd old;
+ fp_rnd new;
+
+ __asm__("sfsr %0" : "=r" (old));
+
+ new = old;
+ new &= ~(0x03 << 7);
+ new |= ((rnd_dir & 0x03) << 7);
+
+ __asm__("lfsr %0" : : "r" (new));
+
+ return (old >> 7) & 0x03;
+}
diff --git a/lib/libc/arch/ns32k/gen/frexp.S b/lib/libc/arch/ns32k/gen/frexp.S
new file mode 100644
index 00000000000..f558fe794c2
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/frexp.S
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Tero Kivinen (kivinen) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: frexp.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+/*
+ double frexp(value, eptr)
+ double value;
+ int *eptr;
+
+ The frexp subroutine returns the mantissa of a double value
+ as a double quantity, x, of magnitude less than one and
+ greater than or equal to 0.5 (0.5 <= |x| < 1) and stores an
+ integer n such that value = x*2**n indirectly through eptr.
+
+ One exception: if the given value is 0, then x and *eptr are made
+ zero.
+*/
+
+#include <machine/asm.h>
+
+ENTRY(frexp)
+ enter [],8
+ movd 12(fp),r1 /* value, high 32 bit */
+ cmpd 0,r1 /* check if 0 */
+ beq frexp_zero /* we do not support denormalized values */
+ movd r1,r2
+ bicd 0x7ff00000,r2 /* clear exponent */
+ ord 0x3fe00000,r2 /* set it to 1024 == exponent -11 == .5-1 */
+ lshd -20,r1 /* extract exponent */
+ andd 0x7ff,r1 /* 11 lower bits */
+ subd 1022,r1 /* unbias exponent */
+ movd r1,0(16(fp))
+ movd 8(fp),-8(fp) /* value, low 32 bit */
+ movd r2,-4(fp) /* value without exponent, high 32 bit */
+ movl -8(fp),f0 /* load return value */
+ exit []
+ ret 0
+frexp_zero:
+ movqd 0,0(16(fp)) /* return exp = 0, mantissa = 9 */
+ movdl 0,f0
+ exit []
+ ret 0
+
diff --git a/lib/libc/arch/ns32k/gen/infinity.c b/lib/libc/arch/ns32k/gen/infinity.c
new file mode 100644
index 00000000000..39c4979b3f5
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/infinity.c
@@ -0,0 +1,10 @@
+#ifndef lint
+static char rcsid[] = "$Id: infinity.c,v 1.1 1995/10/18 08:41:37 deraadt Exp $";
+#endif /* not lint */
+
+/* infinity.c */
+
+#include <math.h>
+
+/* bytes for +Infinity on a ns32k */
+char __infinity[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f };
diff --git a/lib/libc/arch/ns32k/gen/isinf.c b/lib/libc/arch/ns32k/gen/isinf.c
new file mode 100644
index 00000000000..b37abbfbd04
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/isinf.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * 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 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+/*static char sccsid[] = "@(#)isinf.c 5.1 (Berkeley) 3/18/91"; */
+static char rcsid[] = "";
+#endif /* LIBC_SCCS and not lint */
+
+
+/* I have not verified that this is correct for the ns32532 -- PAN */
+
+#include <sys/types.h>
+
+isnan(d)
+ double d;
+{
+ register struct IEEEdp {
+ u_int manl : 32;
+ u_int manh : 20;
+ u_int exp : 11;
+ u_int sign : 1;
+ } *p = (struct IEEEdp *)&d;
+
+ return(p->exp == 2047 && (p->manh || p->manl));
+}
+
+isinf(d)
+ double d;
+{
+ register struct IEEEdp {
+ u_int manl : 32;
+ u_int manh : 20;
+ u_int exp : 11;
+ u_int sign : 1;
+ } *p = (struct IEEEdp *)&d;
+
+ return(p->exp == 2047 && !p->manh && !p->manl);
+}
diff --git a/lib/libc/arch/ns32k/gen/ldexp.S b/lib/libc/arch/ns32k/gen/ldexp.S
new file mode 100644
index 00000000000..7512efab4c0
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/ldexp.S
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Tero Kivinen (kivinen) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: ldexp.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+/*
+ * double ldexp (value, exp)
+ * double value;
+ * int exp;
+ *
+ * Ldexp returns value*2**exp, if that result is in range.
+ * If underflow occurs, it returns zero. If overflow occurs,
+ * it returns a value of appropriate sign and largest
+ * possible magnitude. In case of either overflow or underflow,
+ * errno is set to ERANGE. Note that errno is not modified if
+ * no error occurs.
+ */
+
+#include <machine/asm.h>
+
+#define ERANGE 34
+
+ .globl _errno
+
+ENTRY(ldexp)
+ enter [],8
+ movd 12(fp),r1 /* get value, high 32 bit */
+ lshd -20,r1 /* extract exponent */
+ andd 0x7ff,r1 /* 11 lower bits */
+ subd 1023,r1 /* unbias exponent */
+ movd 16(fp),r0 /* get exp */
+ addd r1,r0 /* add exponents */
+ cmpd r0,1023 /* most positive exponent */
+ bgt ldexp_overflow /* too large */
+ cmpd r0,-1022 /* most negative exponent */
+ blt ldexp_underflow /* too small */
+ addd 1023,r0 /* bias exponent */
+ lshd 20,r0 /* convert exponent back to its place */
+ movd 12(fp),r1 /* get value high 32 bit */
+ bicd 0x7ff00000,r1 /* clear exponent */
+ ord r0,r1 /* insert exponent */
+ movd r1,-4(fp) /* put high 32 bit to local variable */
+ movd 8(fp),-8(fp) /* value low 32 bit to local variable */
+ movl -8(fp),f0 /* return value * 2**exp */
+ exit []
+ ret 0 /* neither */
+ldexp_underflow:
+ movdl 0d0e0,f0 /* if underflow return 0, set errno */
+ PIC_PROLOGUE
+ movd ERANGE,PIC_GOT(_errno) /* set errno */
+ PIC_EPILOGUE
+ exit []
+ ret 0
+ldexp_overflow:
+ movl huge(pc),f0 /* if overflow return HUGE */
+ movdl 0d0e0,f2
+ cmpl f2,8(fp) /* check original sign */
+ bgt ldexp_positive
+ negl f0,f0 /* if negative, return -HUGE */
+ldexp_positive:
+ PIC_PROLOGUE
+ movd ERANGE,PIC_GOT(_errno) /* set errno */
+ PIC_EPILOGUE
+ exit []
+ ret 0
+
+huge: .long 0xffffffff /* the largest number that can */
+ .long 0x7fefffff /* be represented in a long floating */
+ /* number. This is given in hex in order */
+ /* to avoid floating conversions */
diff --git a/lib/libc/arch/ns32k/gen/modf.S b/lib/libc/arch/ns32k/gen/modf.S
new file mode 100644
index 00000000000..b7a67981fa9
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/modf.S
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Tero Kivinen (kivinen) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: modf.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+/*
+ * double modf (value, iptr)
+ * double value, *iptr;
+ *
+ * Modf returns the fractional part of "value",
+ * and stores the integer part indirectly through "iptr".
+ */
+
+#include <machine/asm.h>
+
+ENTRY(modf)
+ FRAME
+ movl 8(fp),f0 /* value */
+ movd 12(fp),r0 /* higher 32 bit of value */
+ lshd -20,r0 /* extract exponent */
+ andd 0x7ff,r0 /* 11 lower bits */
+ cmpd r0,1023+30 /* compare if it's int part can fit in int */
+ bgt modf_overflow /* nope else it's ok to truncld it to int*/
+ truncld f0,r0 /* get integer part */
+ movdl r0,f2 /* convert back to float */
+ movl f2,0(16(fp)) /* move integer part to *iptr */
+ subl f2,f0 /* return fract. part = value - *iptr */
+ EMARF
+ ret 0
+modf_overflow:
+ subd 1023+20,r0 /* bias 1023, and upper part of
+ floating point mantissa part */
+ movqd -1,r2 /* generate mask to get fract. part */
+ cmpd r0,32 /* if value > 2^52 (20+32) then all int part */
+ bhi modf_all_ip
+ negd r0,r0 /* shift right */
+ lshd r0,r2 /* here */
+ comd r2,r2 /* get fractional part complement mask */
+ movd 8(fp),r1 /* get lower 32 bit of value */
+ andd r2,r1 /* mask fractional part off leave ip part */
+ movd r1,0(16(fp)) /* store ip part to *iptr */
+ movd 12(fp),4(16(fp)) /* store other half to *iptr */
+ subl 0(16(fp)),f0 /* return fract. part = value - *iptr */
+ EMARF
+ ret 0
+modf_all_ip:
+ movl 8(fp),0(16(fp)) /* copy value to *iptr */
+ movdl 0,f0 /* return 0 for fract. part */
+ EMARF
+ ret 0
diff --git a/lib/libc/arch/ns32k/gen/setjmp.S b/lib/libc/arch/ns32k/gen/setjmp.S
new file mode 100644
index 00000000000..66b608f9655
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/setjmp.S
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: setjmp.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+#include <machine/jmpbuf.h>
+
+ENTRY(setjmp)
+ movqd 0, tos
+ bsr _sigblock
+ adjspb -4
+ movd 4(sp), r2 /* jmp_buf */
+ movd 0(sp), JMP_BUF_PC(r2) /* pc of caller */
+ movd r0, JMP_BUF_SIGMASK(r2) /* save mask */
+
+ sprd sp, JMP_BUF_SP(r2)
+ sprd fp, JMP_BUF_FP(r2)
+ sprd sb, JMP_BUF_SB(r2)
+ movd r3, JMP_BUF_R3(r2) /* save registers r3-r7 */
+ movd r4, JMP_BUF_R4(r2)
+ movd r5, JMP_BUF_R5(r2)
+ movd r6, JMP_BUF_R6(r2)
+ movd r7, JMP_BUF_R7(r2)
+
+ movqd 0, r0
+ ret 0
+
+ENTRY(longjmp)
+ movd 4(sp),r2 /* jmp_buf */
+ movd JMP_BUF_SIGMASK(r2), tos /* restore mask */
+ bsr _sigsetmask
+ adjspb -4
+ movd 4(sp), r2 /* jmp_buf */
+ movd 8(sp), r0 /* value */
+
+ lprd sp, JMP_BUF_SP(r2)
+ lprd fp, JMP_BUF_FP(r2)
+ lprd sb, JMP_BUF_SB(r2)
+ movd JMP_BUF_R3(r2), r3 /* load registers r3-r7 */
+ movd JMP_BUF_R4(r2), r4
+ movd JMP_BUF_R5(r2), r5
+ movd JMP_BUF_R6(r2), r6
+ movd JMP_BUF_R7(r2), r7
+ movd JMP_BUF_PC(r2), 0(sp) /* patch return pc */
+
+ cmpqd 0, r0
+ bne nonzero
+ movqd 1, r0
+nonzero:
+ ret 0
+
diff --git a/lib/libc/arch/ns32k/gen/sigsetjmp.S b/lib/libc/arch/ns32k/gen/sigsetjmp.S
new file mode 100644
index 00000000000..04929573f81
--- /dev/null
+++ b/lib/libc/arch/ns32k/gen/sigsetjmp.S
@@ -0,0 +1,85 @@
+/* $NetBSD: sigsetjmp.S,v 1.2 1994/12/07 04:47:59 phil Exp $ */
+
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * 05-Aug-94 Matthias Pfaller (leo@marco.de)
+ * Converted to sigsetjmp.S from setjmp.S
+ *
+ * $Id: sigsetjmp.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+#include <machine/jmpbuf.h>
+
+ENTRY(sigsetjmp)
+ movd 4(sp), r2 /* jmp_buf */
+ movd 0(sp), JMP_BUF_PC(r2) /* pc of caller */
+ movd 8(sp), r1 /* savemask */
+ movd r1, JMP_BUF_SIGMASK+4(r2)
+ cmpqd 0, r1
+ beq 1f
+ movqd 0, tos
+ bsr _sigblock
+ adjspb -4
+ movd 4(sp), r2 /* jmp_buf */
+
+ movd r0, JMP_BUF_SIGMASK(r2) /* save mask */
+
+1: sprd sp, JMP_BUF_SP(r2)
+ sprd fp, JMP_BUF_FP(r2)
+ sprd sb, JMP_BUF_SB(r2)
+ movd r3, JMP_BUF_R3(r2) /* save registers r3-r7 */
+ movd r4, JMP_BUF_R4(r2)
+ movd r5, JMP_BUF_R5(r2)
+ movd r6, JMP_BUF_R6(r2)
+ movd r7, JMP_BUF_R7(r2)
+
+ movqd 0, r0
+ ret 0
+
+ENTRY(siglongjmp)
+ movd 4(sp),r2 /* jmp_buf */
+ cmpqd 0, JMP_BUF_SIGMASK+4(r2)
+ beq 1f
+
+ movd JMP_BUF_SIGMASK(r2), tos /* restore mask */
+ bsr _sigsetmask
+ adjspb -4
+ movd 4(sp), r2 /* jmp_buf */
+
+1: movd 8(sp), r0 /* value */
+
+ lprd sp, JMP_BUF_SP(r2)
+ lprd fp, JMP_BUF_FP(r2)
+ lprd sb, JMP_BUF_SB(r2)
+ movd JMP_BUF_R3(r2), r3 /* load registers r3-r7 */
+ movd JMP_BUF_R4(r2), r4
+ movd JMP_BUF_R5(r2), r5
+ movd JMP_BUF_R6(r2), r6
+ movd JMP_BUF_R7(r2), r7
+ movd JMP_BUF_PC(r2), 0(sp) /* patch return pc */
+
+ cmpqd 0, r0
+ bne nonzero
+ movqd 1, r0
+nonzero:
+ ret 0
+
diff --git a/lib/libc/arch/ns32k/net/Makefile.inc b/lib/libc/arch/ns32k/net/Makefile.inc
new file mode 100644
index 00000000000..2dd5bc77782
--- /dev/null
+++ b/lib/libc/arch/ns32k/net/Makefile.inc
@@ -0,0 +1,3 @@
+# $NetBSD: Makefile.inc,v 1.1 1995/02/25 14:59:07 cgd Exp $
+
+SRCS+= htonl.S htons.S ntohl.S ntohs.S
diff --git a/lib/libc/arch/ns32k/net/htonl.S b/lib/libc/arch/ns32k/net/htonl.S
new file mode 100644
index 00000000000..899a172517f
--- /dev/null
+++ b/lib/libc/arch/ns32k/net/htonl.S
@@ -0,0 +1,44 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1992 Carnegie Mellon University
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
+ * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
+ * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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 Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * HISTORY
+ * 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: htonl.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+
+ .text
+ENTRY(htonl)
+ movd S_ARG0,r0
+ rotw 8,r0
+ rotd 16,r0
+ rotw 8,r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/net/htons.S b/lib/libc/arch/ns32k/net/htons.S
new file mode 100644
index 00000000000..e07498dcf62
--- /dev/null
+++ b/lib/libc/arch/ns32k/net/htons.S
@@ -0,0 +1,42 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1992 Carnegie Mellon University
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
+ * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
+ * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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 Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * HISTORY
+ * 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: htons.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+
+ .text
+ENTRY(htons)
+ movzwd S_ARG0,r0
+ rotw 8,r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/net/ntohl.S b/lib/libc/arch/ns32k/net/ntohl.S
new file mode 100644
index 00000000000..3222e4668ba
--- /dev/null
+++ b/lib/libc/arch/ns32k/net/ntohl.S
@@ -0,0 +1,44 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1992 Carnegie Mellon University
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
+ * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
+ * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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 Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * HISTORY
+ * 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: ntohl.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+
+ .text
+ENTRY(ntohl)
+ movd S_ARG0,r0
+ rotw 8,r0
+ rotd 16,r0
+ rotw 8,r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/net/ntohs.S b/lib/libc/arch/ns32k/net/ntohs.S
new file mode 100644
index 00000000000..eee3c790928
--- /dev/null
+++ b/lib/libc/arch/ns32k/net/ntohs.S
@@ -0,0 +1,42 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1992 Carnegie Mellon University
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
+ * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
+ * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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 Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * HISTORY
+ * 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: ntohs.S,v 1.1 1995/10/18 08:41:37 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+
+ .text
+ENTRY(ntohs)
+ movzwd S_ARG0,r0
+ rotw 8,r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/stdlib/abs.S b/lib/libc/arch/ns32k/stdlib/abs.S
new file mode 100644
index 00000000000..afe1eeadea4
--- /dev/null
+++ b/lib/libc/arch/ns32k/stdlib/abs.S
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: abs.S,v 1.1 1995/10/18 08:41:38 deraadt Exp $
+ */
+
+#include <machine/asm.h>
+
+ENTRY(abs)
+ absd S_ARG0,r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/string/Makefile.inc b/lib/libc/arch/ns32k/string/Makefile.inc
new file mode 100644
index 00000000000..e35f0f72a3a
--- /dev/null
+++ b/lib/libc/arch/ns32k/string/Makefile.inc
@@ -0,0 +1,7 @@
+# $NetBSD: Makefile.inc,v 1.1 1995/03/20 14:45:50 mycroft 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
+#SRCS+= memmove.c strchr.c strrchr.c
diff --git a/lib/libc/arch/ns32k/string/bzero.c b/lib/libc/arch/ns32k/string/bzero.c
new file mode 100644
index 00000000000..6ab0a44cb00
--- /dev/null
+++ b/lib/libc/arch/ns32k/string/bzero.c
@@ -0,0 +1,73 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * 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 Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * $Id: bzero.c,v 1.1 1995/10/18 08:41:38 deraadt Exp $
+ */
+/*
+ * Object:
+ * bzero EXPORTED function
+ *
+ * Clear memory locations
+ *
+ * Optimize for aligned memory ops, if possible and simple.
+ * Might need later recoding in assembly for better efficiency.
+ */
+void
+bzero(addr, bcount)
+ register unsigned addr;
+ register unsigned bcount;
+{
+ register int i;
+
+ if (bcount == 0) /* sanity */
+ return;
+ switch (addr & 3) {
+ case 1:
+ *((char *) addr++) = 0;
+ if (--bcount == 0)
+ return;
+ case 2:
+ *((char *) addr++) = 0;
+ if (--bcount == 0)
+ return;
+ case 3:
+ *((char *) addr++) = 0;
+ if (--bcount == 0)
+ return;
+ default:
+ break;
+ }
+
+ for (i = bcount >> 2; i; i--, addr += 4)
+ *((int *) addr) = 0;
+
+ switch (bcount & 3) {
+ case 3: *((char*)addr++) = 0;
+ case 2: *((char*)addr++) = 0;
+ case 1: *((char*)addr++) = 0;
+ default:break;
+ }
+}
diff --git a/lib/libc/arch/ns32k/sys/Ovfork.S b/lib/libc/arch/ns32k/sys/Ovfork.S
new file mode 100644
index 00000000000..f637c432b5f
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/Ovfork.S
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: Ovfork.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+/*
+ * r0 = pid of child in parent / pid of parent in child
+ * r1 = 0 in parent, 1 in child
+ */
+SYSCALL(vfork)
+ cmpqd 0,r1
+ beq parent
+ movqd 0,r0
+parent:
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/brk.S b/lib/libc/arch/ns32k/sys/brk.S
new file mode 100644
index 00000000000..8ca140f97af
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/brk.S
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: brk.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+ .globl _curbrk
+ .globl minbrk
+
+ENTRY(_brk)
+ br ok2
+
+ENTRY(brk)
+ PIC_PROLOGUE
+ cmpd PIC_S_ARG0, PIC_GOT(minbrk)
+ bge ok1
+ movd PIC_GOT(minbrk), PIC_S_ARG0
+ok1:
+ PIC_EPILOGUE
+ok2:
+ movd SYS_break, r0
+ SVC
+ bcs cerror
+ PIC_PROLOGUE
+ movd PIC_S_ARG0, PIC_GOT(_curbrk)
+ movqd 0, r0
+ PIC_EPILOGUE
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/cerror.S b/lib/libc/arch/ns32k/sys/cerror.S
new file mode 100644
index 00000000000..f96a287fc2f
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/cerror.S
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: cerror.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+ .globl cerror
+ .globl _errno
+
+cerror:
+ PIC_PROLOGUE
+ movd r0, PIC_GOT(_errno)
+ PIC_EPILOGUE
+ movqd -1, r0
+ movqd -1, r1
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/exect.S b/lib/libc/arch/ns32k/sys/exect.S
new file mode 100644
index 00000000000..eed9caec944
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/exect.S
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: exect.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+#include <machine/psl.h>
+
+ENTRY(exect)
+ sprb us, r0
+ orb PSL_T, r0
+ lprb us, r0
+ movd SYS_execve, r0
+ SVC
+ bcs cerror
+ ret 0
+
diff --git a/lib/libc/arch/ns32k/sys/fork.S b/lib/libc/arch/ns32k/sys/fork.S
new file mode 100644
index 00000000000..743bf8c6b0f
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/fork.S
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: fork.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+/* r0 = pid. r1 = 0 in parent, 1 in child */
+
+SYSCALL(fork)
+ cmpqd 0, r1
+ beq parent
+ movqd 0, r0
+parent:
+ ret 0 /* pid = fork() */
diff --git a/lib/libc/arch/ns32k/sys/pipe.S b/lib/libc/arch/ns32k/sys/pipe.S
new file mode 100644
index 00000000000..2903173c7c4
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/pipe.S
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: pipe.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include <SYS.h>
+
+SYSCALL(pipe)
+ movd S_ARG0, r2
+ movd r0, 0(r2)
+ movd r1, 4(r2)
+ movqd 0, r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/ptrace.S b/lib/libc/arch/ns32k/sys/ptrace.S
new file mode 100644
index 00000000000..4476d2fdf61
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/ptrace.S
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: ptrace.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+/*
+ * This is included for the NetBSD version!
+ */
+
+#include "SYS.h"
+
+ .globl _errno
+ .globl cerror
+
+ENTRY(ptrace)
+ PIC_PROLOGUE
+ movqd 0, PIC_GOT(_errno)
+ PIC_EPILOGUE
+ movd SYS_ptrace, r0
+ SVC
+ bcs cerror
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/reboot.S b/lib/libc/arch/ns32k/sys/reboot.S
new file mode 100644
index 00000000000..58ec2e20219
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/reboot.S
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+
+/* This is a modified copy of mount.s. Phil Nelson
+ *
+ * $Id: reboot.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+SYSCALL(reboot)
+ dia
+
diff --git a/lib/libc/arch/ns32k/sys/sbrk.S b/lib/libc/arch/ns32k/sys/sbrk.S
new file mode 100644
index 00000000000..6170d720a5f
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/sbrk.S
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: sbrk.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+ .data
+ .globl _end
+ .globl _curbrk; .type _curbrk, @object; .size _curbrk, 4
+ .globl minbrk; .type minbrk, @object; .size minbrk, 4
+_curbrk: .long _end
+minbrk: .long _end
+
+ .text
+
+ENTRY(sbrk)
+ PIC_PROLOGUE
+ addd PIC_GOT(_curbrk), PIC_S_ARG0
+ PIC_EPILOGUE
+ movd SYS_break, r0
+ SVC
+ bcs cerror
+ PIC_PROLOGUE
+ movd PIC_GOT(_curbrk), r0
+ movd PIC_S_ARG0, PIC_GOT(_curbrk) /* XXX check this b */
+ PIC_EPILOGUE
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/setlogin.S b/lib/libc/arch/ns32k/sys/setlogin.S
new file mode 100644
index 00000000000..acb6a124c54
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/setlogin.S
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: setlogin.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+ .globl ___logname_valid /* in getlogin() */
+
+SYSCALL(setlogin)
+ PIC_PROLOGUE
+ movqd 0, PIC_GOT(___logname_valid)
+ PIC_EPILOGUE
+ ret 0 /* setlogin(name) */
diff --git a/lib/libc/arch/ns32k/sys/sigpending.S b/lib/libc/arch/ns32k/sys/sigpending.S
new file mode 100644
index 00000000000..3ca8c6b95ba
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/sigpending.S
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: sigpending.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+SYSCALL(sigpending)
+ movd S_ARG1, r1 /* fetch pointer to... */
+ movd r0, 0(r1) /* store old mask */
+ movqd 0, r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/sigprocmask.S b/lib/libc/arch/ns32k/sys/sigprocmask.S
new file mode 100644
index 00000000000..d35097c4633
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/sigprocmask.S
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: sigprocmask.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+/*
+ * Note: Has never been tested. Debug before use.
+ */
+
+
+#include "SYS.h"
+
+ENTRY(sigprocmask)
+ movd S_ARG1, r1 /* fetch new sigset pointer */
+ cmpqd 0, r1 /* check new sigset pointer */
+ bne L1 /* if not null, indirect */
+/* movqd 0, S_ARG1 /* null mask pointer: block empty set */
+ movqd 1, S_ARG0 /* SIG_BLOCK */
+ br L2
+L1: movd 0(r1), r1 /* fetch indirect ... */
+ movd r1, S_ARG1 /* to new mask arg */
+L2: movd SYS_sigprocmask, r0
+ SVC
+ bcs cerror
+ movd S_ARG2, r1 /* fetch old mask requested */
+ cmpqd 0, r1 /* test if old mask requested */
+ beq out
+ movd r0, 0(r1) /* store old mask */
+out:
+ movqd 0, r0
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/sigreturn.S b/lib/libc/arch/ns32k/sys/sigreturn.S
new file mode 100644
index 00000000000..4795bade6b9
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/sigreturn.S
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: sigreturn.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+/*
+ * We must preserve the state of the registers as the user has set them up.
+ */
+#ifdef PROF
+#undef ENTRY
+#define ENTRY(x) \
+ .globl EX(x); \
+ .align ALIGN; \
+ EX(x): save [r0,r1,r2]; \
+ .data; 1:; .long 0; \
+ .text; addr 1b(pc),r0; bsr mcount; \
+ restore [r0,r1,r2]
+#endif PROF
+
+SYSCALL(sigreturn)
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/sigsuspend.S b/lib/libc/arch/ns32k/sys/sigsuspend.S
new file mode 100644
index 00000000000..1090a6d4be7
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/sigsuspend.S
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: sigsuspend.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+ENTRY(sigsuspend)
+ movd S_ARG0, r0 /* fetch mask arg */
+ movd 0(r0), r0 /* indirect to mask arg */
+ movd r0, S_ARG0
+ movd SYS_sigsuspend, r0
+ SVC
+ bcs cerror
+ movqd 0, r0 /* shouldn t happen */
+ ret 0
diff --git a/lib/libc/arch/ns32k/sys/syscall.S b/lib/libc/arch/ns32k/sys/syscall.S
new file mode 100644
index 00000000000..64fa764b94d
--- /dev/null
+++ b/lib/libc/arch/ns32k/sys/syscall.S
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1992 Helsinki University of Technology
+ * All Rights Reserved.
+ *
+ * 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.
+ *
+ * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
+ * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
+ * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+ * USE OF THIS SOFTWARE.
+ */
+/*
+ * HISTORY
+ * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
+ * Created.
+ *
+ * $Id: syscall.S,v 1.1 1995/10/18 08:41:39 deraadt Exp $
+ */
+
+#include "SYS.h"
+
+ENTRY(syscall)
+ movqd 0, r0 /* Tell system this is syscall! */
+ SVC
+ bcs cerror
+ ret 0