summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern/arch/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'sys/lib/libkern/arch/m68k')
-rw-r--r--sys/lib/libkern/arch/m68k/DEFS.h3
-rw-r--r--sys/lib/libkern/arch/m68k/Makefile.inc5
-rw-r--r--sys/lib/libkern/arch/m68k/SYS.h79
-rw-r--r--sys/lib/libkern/arch/m68k/bcmp.S91
-rw-r--r--sys/lib/libkern/arch/m68k/bzero.S80
-rw-r--r--sys/lib/libkern/arch/m68k/ffs.S56
-rw-r--r--sys/lib/libkern/arch/m68k/htonl.S54
-rw-r--r--sys/lib/libkern/arch/m68k/htons.S55
-rw-r--r--sys/lib/libkern/arch/m68k/locc.S61
-rw-r--r--sys/lib/libkern/arch/m68k/ntohl.S54
-rw-r--r--sys/lib/libkern/arch/m68k/ntohs.S55
-rw-r--r--sys/lib/libkern/arch/m68k/scanc.S67
-rw-r--r--sys/lib/libkern/arch/m68k/skpc.S61
-rw-r--r--sys/lib/libkern/arch/m68k/strcat.c55
-rw-r--r--sys/lib/libkern/arch/m68k/strcmp.S66
-rw-r--r--sys/lib/libkern/arch/m68k/strcpy.S53
-rw-r--r--sys/lib/libkern/arch/m68k/strlen.S53
-rw-r--r--sys/lib/libkern/arch/m68k/strncmp.S71
-rw-r--r--sys/lib/libkern/arch/m68k/strncpy.S63
19 files changed, 1082 insertions, 0 deletions
diff --git a/sys/lib/libkern/arch/m68k/DEFS.h b/sys/lib/libkern/arch/m68k/DEFS.h
new file mode 100644
index 00000000000..0ccd3f048fa
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/DEFS.h
@@ -0,0 +1,3 @@
+/* $NetBSD: DEFS.h,v 1.2 1994/10/26 06:39:21 cgd Exp $ */
+
+#include <machine/asm.h>
diff --git a/sys/lib/libkern/arch/m68k/Makefile.inc b/sys/lib/libkern/arch/m68k/Makefile.inc
new file mode 100644
index 00000000000..1f8844f6f87
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/Makefile.inc
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile.inc,v 1.5 1994/10/26 06:39:22 cgd Exp $
+
+SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
+ bcmp.S bzero.S ffs.S strcat.c strcmp.S strcpy.S strlen.S strncmp.S \
+ strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S
diff --git a/sys/lib/libkern/arch/m68k/SYS.h b/sys/lib/libkern/arch/m68k/SYS.h
new file mode 100644
index 00000000000..6f5c3b7cf0d
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/SYS.h
@@ -0,0 +1,79 @@
+/* $NetBSD: SYS.h,v 1.2 1994/10/26 06:39:23 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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
+ */
+
+#include <sys/syscall.h>
+#include <machine/asm.h>
+
+#ifdef __STDC__
+
+#ifdef PIC
+/* With PIC code, we can't pass the error to cerror in d0,
+ because the jump might go via the binder. */
+#define SYSCALL(x) .even; err: movl d0,sp@-; jra cerror; ENTRY(x); \
+ movl \#SYS_ ## x,d0; trap \#0; jcs err
+#else /* !PIC */
+#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \
+ movl \#SYS_ ## x,d0; trap \#0; jcs err
+#endif /* !PIC */
+
+#define RSYSCALL(x) SYSCALL(x); rts
+#define PSEUDO(x,y) ENTRY(x); movl \#SYS_ ## y,d0; trap \#0; rts
+
+#else /* !__STDC__ */
+
+#ifdef PIC
+/* With PIC code, we can't pass the error to cerror in d0,
+ because the jump might go via the binder. */
+#define SYSCALL(x) .even; err: movl d0,sp@-; jra cerror; ENTRY(x); \
+ movl #SYS_/**/x,d0; trap #0; jcs err
+#else /* !PIC */
+#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \
+ movl #SYS_/**/x,d0; trap #0; jcs err
+#endif /* !PIC */
+
+#define RSYSCALL(x) SYSCALL(x); rts
+#define PSEUDO(x,y) ENTRY(x); movl #SYS_/**/y,d0; trap #0; rts
+
+#endif /* !__STDC__ */
+
+#define ASMSTR .asciz
+
+ .globl cerror
diff --git a/sys/lib/libkern/arch/m68k/bcmp.S b/sys/lib/libkern/arch/m68k/bcmp.S
new file mode 100644
index 00000000000..8f7113ebd47
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/bcmp.S
@@ -0,0 +1,91 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: bcmp.S,v 1.1.1.1 1995/10/18 08:52:52 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+/* bcmp(s1, s2, n) */
+
+#include "DEFS.h"
+
+/*
+ * This is probably not the best we can do, but it is still 2-10 times
+ * faster than the C version in the portable gen directory.
+ *
+ * Things that might help:
+ * - longword align when possible (only on the 68020)
+ * - use nested DBcc instructions or use one and limit size to 64K
+ */
+ENTRY(bcmp)
+ movl sp@(4),a0 | string 1
+ movl sp@(8),a1 | string 2
+ movl sp@(12),d0 | length
+ beq bcdone | if zero, nothing to do
+ movl a0,d1
+ btst #0,d1 | string 1 address odd?
+ beq bceven | no, skip alignment
+ cmpmb a0@+,a1@+ | yes, compare a byte
+ bne bcnoteq | not equal, return non-zero
+ subql #1,d0 | adjust count
+ beq bcdone | count 0, reutrn zero
+bceven:
+ movl a1,d1
+ btst #0,d1 | string 2 address odd?
+ bne bcbloop | yes, no hope for alignment, compare bytes
+ movl d0,d1 | no, both even
+ lsrl #2,d1 | convert count to longword count
+ beq bcbloop | count 0, skip longword loop
+bclloop:
+ cmpml a0@+,a1@+ | compare a longword
+ bne bcnoteq | not equal, return non-zero
+ subql #1,d1 | adjust count
+ bne bclloop | still more, keep comparing
+ andl #3,d0 | what remains
+ beq bcdone | nothing, all done
+bcbloop:
+ cmpmb a0@+,a1@+ | compare a byte
+ bne bcnoteq | not equal, return non-zero
+ subql #1,d0 | adjust count
+ bne bcbloop | still more, keep going
+ rts
+bcnoteq:
+ moveq #1,d0
+bcdone:
+ rts
diff --git a/sys/lib/libkern/arch/m68k/bzero.S b/sys/lib/libkern/arch/m68k/bzero.S
new file mode 100644
index 00000000000..5b41cf71aeb
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/bzero.S
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)bzero.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: bzero.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+#include "DEFS.h"
+
+/*
+ * This is probably not the best we can do, but it is still much
+ * faster than the C version in the portable gen directory.
+ *
+ * Things that might help:
+ * - unroll the longword loop (might not be good for a 68020)
+ * - longword, as opposed to word, align when possible (only on the 68020)
+ * - use nested DBcc instructions or use one and limit size to 64K
+ */
+ENTRY(bzero)
+ movl sp@(4),a0 | destination
+ movl sp@(8),d0 | count
+ beq bzdone | nothing to do
+ movl a0,d1
+ btst #0,d1 | address odd?
+ beq bzeven | no, skip alignment
+ clrb a0@+ | yes, clear a byte
+ subql #1,d0 | adjust count
+ beq bzdone | if zero, all done
+bzeven:
+ movl d0,d1
+ lsrl #2,d1 | convert to longword count
+ beq bzbloop | no longwords, skip loop
+bzlloop:
+ clrl a0@+ | clear a longword
+ subql #1,d1 | adjust count
+ bne bzlloop | still more, keep going
+ andl #3,d0 | what remains
+ beq bzdone | nothing, all done
+bzbloop:
+ clrb a0@+ | clear a byte
+ subql #1,d0 | adjust count
+ bne bzbloop | still more, keep going
+bzdone:
+ rts
diff --git a/sys/lib/libkern/arch/m68k/ffs.S b/sys/lib/libkern/arch/m68k/ffs.S
new file mode 100644
index 00000000000..dff5318249b
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/ffs.S
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)ffs.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: ffs.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+/* bit = ffs(value) */
+
+#include "DEFS.h"
+
+ENTRY(ffs)
+ movl sp@(4),d0
+ movl d0,d1
+ negl d0
+ andl d0,d1
+ movql #32,d0
+ bfffo d1{#0:#32},d1
+ subl d1,d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/htonl.S b/sys/lib/libkern/arch/m68k/htonl.S
new file mode 100644
index 00000000000..2da54607f6e
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/htonl.S
@@ -0,0 +1,54 @@
+/* $NetBSD: htonl.S,v 1.2 1994/10/26 06:39:27 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+#ifdef notdef
+ .asciz "@(#)htonl.s 5.1 (Berkeley) 5/12/90"
+#endif
+ .asciz "$NetBSD: htonl.S,v 1.2 1994/10/26 06:39:27 cgd Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+/* netorder = htonl(hostorder) */
+
+#include "DEFS.h"
+
+ENTRY(htonl)
+ movl sp@(4),d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/htons.S b/sys/lib/libkern/arch/m68k/htons.S
new file mode 100644
index 00000000000..5c9ee9c54c7
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/htons.S
@@ -0,0 +1,55 @@
+/* $NetBSD: htons.S,v 1.2 1994/10/26 06:39:27 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+#ifdef notdef
+ .asciz "@(#)htons.s 5.1 (Berkeley) 5/12/90"
+#endif
+ .asciz "$NetBSD: htons.S,v 1.2 1994/10/26 06:39:27 cgd Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+/* hostorder = htons(netorder) */
+
+#include "DEFS.h"
+
+ENTRY(htons)
+ clrl d0
+ movw sp@(6),d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/locc.S b/sys/lib/libkern/arch/m68k/locc.S
new file mode 100644
index 00000000000..b5a838e7514
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/locc.S
@@ -0,0 +1,61 @@
+/* $NetBSD: locc.S,v 1.2 1994/10/26 06:39:28 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1980, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah Hdr: locore.s 1.58 91/04/22
+ * @(#)locore.s 7.11 (Berkeley) 5/9/91
+ */
+
+#include "DEFS.h"
+
+/*
+ * Emulate fancy VAX string operations:
+ * locc(mask, count, startc)
+ */
+ENTRY(locc)
+ movl sp@(8),d0 | get length
+ jeq Llcdone | nothing to do, return
+ movb sp@(7),d1 | mask to use
+ movl sp@(12),a0 | where to start
+ subqw #1,d0 | adjust for dbcc
+Llcloop:
+ cmpb a0@+,d1 | compate with mask
+ dbeq d0,Llcloop | keep going til no more or non-zero
+ addqw #1,d0 | overshot by one
+Llcdone:
+ rts
diff --git a/sys/lib/libkern/arch/m68k/ntohl.S b/sys/lib/libkern/arch/m68k/ntohl.S
new file mode 100644
index 00000000000..ed996cb3587
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/ntohl.S
@@ -0,0 +1,54 @@
+/* $NetBSD: ntohl.S,v 1.2 1994/10/26 06:39:29 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+#ifdef notdef
+ .asciz "@(#)ntohl.s 5.1 (Berkeley) 5/12/90"
+#endif
+ .asciz "$NetBSD: ntohl.S,v 1.2 1994/10/26 06:39:29 cgd Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+/* hostorder = ntohl(netorder) */
+
+#include "DEFS.h"
+
+ENTRY(ntohl)
+ movl sp@(4),d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/ntohs.S b/sys/lib/libkern/arch/m68k/ntohs.S
new file mode 100644
index 00000000000..d32a48775bb
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/ntohs.S
@@ -0,0 +1,55 @@
+/* $NetBSD: ntohs.S,v 1.2 1994/10/26 06:39:30 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+#ifdef notdef
+ .asciz "@(#)ntohs.s 5.1 (Berkeley) 5/12/90"
+#endif
+ .asciz "$NetBSD: ntohs.S,v 1.2 1994/10/26 06:39:30 cgd Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+/* hostorder = ntohs(netorder) */
+
+#include "DEFS.h"
+
+ENTRY(ntohs)
+ clrl d0
+ movw sp@(6),d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/scanc.S b/sys/lib/libkern/arch/m68k/scanc.S
new file mode 100644
index 00000000000..358793e7c6b
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/scanc.S
@@ -0,0 +1,67 @@
+/* $NetBSD: scanc.S,v 1.2 1994/10/26 06:39:31 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1980, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah Hdr: locore.s 1.58 91/04/22
+ * @(#)locore.s 7.11 (Berkeley) 5/9/91
+ */
+
+#include "DEFS.h"
+
+/*
+ * Emulate fancy VAX string operations:
+ * scanc(count, startc, table, mask)
+ */
+ENTRY(scanc)
+ movl sp@(4),d0 | get length
+ jeq Lscdone | nothing to do, return
+ movl sp@(8),a0 | start of scan
+ movl sp@(12),a1 | table to compare with
+ movb sp@(19),d1 | and mask to use
+ movw d2,sp@- | need a scratch register
+ clrw d2 | clear it out
+ subqw #1,d0 | adjust for dbra
+Lscloop:
+ movb a0@+,d2 | get character
+ movb a1@(0,d2:w),d2 | get table entry
+ andb d1,d2 | mask it
+ dbne d0,Lscloop | keep going til no more or non-zero
+ addqw #1,d0 | overshot by one
+ movw sp@+,d2 | restore scratch
+Lscdone:
+ rts
diff --git a/sys/lib/libkern/arch/m68k/skpc.S b/sys/lib/libkern/arch/m68k/skpc.S
new file mode 100644
index 00000000000..681779eba30
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/skpc.S
@@ -0,0 +1,61 @@
+/* $NetBSD: skpc.S,v 1.2 1994/10/26 06:39:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1980, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah Hdr: locore.s 1.58 91/04/22
+ * @(#)locore.s 7.11 (Berkeley) 5/9/91
+ */
+
+#include "DEFS.h"
+
+/*
+ * Emulate fancy VAX string operations:
+ * skpc(mask, count, startc)
+ */
+ENTRY(skpc)
+ movl sp@(8),d0 | get length
+ jeq Lskdone | nothing to do, return
+ movb sp@(7),d1 | mask to use
+ movl sp@(12),a0 | where to start
+ subqw #1,d0 | adjust for dbcc
+Lskloop:
+ cmpb a0@+,d1 | compate with mask
+ dbne d0,Lskloop | keep going til no more or zero
+ addqw #1,d0 | overshot by one
+Lskdone:
+ rts
diff --git a/sys/lib/libkern/arch/m68k/strcat.c b/sys/lib/libkern/arch/m68k/strcat.c
new file mode 100644
index 00000000000..07296b8ed42
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/strcat.c
@@ -0,0 +1,55 @@
+/* $NetBSD: strcat.c,v 1.2 1994/10/26 06:39:33 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988 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)
+#ifdef notdef
+static char *sccsid = "@(#)strcat.c 5.6 (Berkeley) 2/24/91";
+#endif
+static char *rcsid = "$NetBSD: strcat.c,v 1.2 1994/10/26 06:39:33 cgd Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <string.h>
+
+char *
+strcat(s, append)
+ register char *s;
+ register const char *append;
+{
+ char *save = s;
+
+ for (; *s; ++s);
+ while (*s++ = *append++);
+ return(save);
+}
diff --git a/sys/lib/libkern/arch/m68k/strcmp.S b/sys/lib/libkern/arch/m68k/strcmp.S
new file mode 100644
index 00000000000..c8692d3c2ce
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/strcmp.S
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)strcmp.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: strcmp.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+#include "DEFS.h"
+
+/*
+ * NOTE: this guy returns result compatible with the VAX assembly version.
+ * The C version on the portable gen directory returns different results
+ * (different signs!) when comparing chars with the high bit on. Who is
+ * right??
+ */
+ENTRY(strcmp)
+ movl sp@(4),a0 | a0 = string1
+ movl sp@(8),a1 | a1 = string2
+scloop:
+ movb a0@+,d0 | get *string1
+ cmpb a1@+,d0 | compare a byte
+ bne scexit | not equal, break out
+ tstb d0 | at end of string1?
+ bne scloop | no, keep going
+ moveq #0,d0 | strings are equal
+ rts
+scexit:
+ subb a1@-,d0 | *string1 - *string2
+ extbl d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/strcpy.S b/sys/lib/libkern/arch/m68k/strcpy.S
new file mode 100644
index 00000000000..3b06597d6a4
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/strcpy.S
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: strcpy.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+#include "DEFS.h"
+
+ENTRY(strcpy)
+ movl sp@(8),a0 | a0 = fromaddr
+ movl sp@(4),d0 | return value is toaddr
+ movl d0,a1 | a1 = toaddr
+scloop:
+ movb a0@+,a1@+ | copy a byte
+ bne scloop | copied non-null, keep going
+ rts
diff --git a/sys/lib/libkern/arch/m68k/strlen.S b/sys/lib/libkern/arch/m68k/strlen.S
new file mode 100644
index 00000000000..e911e56775d
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/strlen.S
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)strlen.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: strlen.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+#include "DEFS.h"
+
+ENTRY(strlen)
+ moveq #-1,d0
+ movl sp@(4),a0 | string
+slloop:
+ addql #1,d0 | increment count
+ tstb a0@+ | null?
+ bne slloop | no, keep going
+ rts
diff --git a/sys/lib/libkern/arch/m68k/strncmp.S b/sys/lib/libkern/arch/m68k/strncmp.S
new file mode 100644
index 00000000000..8644f7a1490
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/strncmp.S
@@ -0,0 +1,71 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)strncmp.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: strncmp.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+#include "DEFS.h"
+
+/*
+ * NOTE: this guy returns result compatible with the VAX assembly version.
+ * The C version on the portable gen directory returns different results
+ * (different signs!) when comparing chars with the high bit on. Who is
+ * right??
+ */
+ENTRY(strncmp)
+ movl sp@(12),d1 | count
+ beq scdone | nothing to do
+ movl sp@(4),a0 | a0 = string1
+ movl sp@(8),a1 | a1 = string2
+scloop:
+ movb a0@+,d0 | get *string1
+ cmpb a1@+,d0 | compare a byte
+ bne scexit | not equal, break out
+ tstb d0 | at end of string1?
+ beq scdone | yes, all done
+ subql #1,d1 | no, adjust count
+ bne scloop | more to do, keep going
+scdone:
+ moveq #0,d0 | strings are equal
+ rts
+scexit:
+ subb a1@-,d0 | *string1 - *string2
+ extbl d0
+ rts
diff --git a/sys/lib/libkern/arch/m68k/strncpy.S b/sys/lib/libkern/arch/m68k/strncpy.S
new file mode 100644
index 00000000000..9e8faa78860
--- /dev/null
+++ b/sys/lib/libkern/arch/m68k/strncpy.S
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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)
+ .text
+ /*.asciz "from: @(#)strncpy.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id: strncpy.S,v 1.1.1.1 1995/10/18 08:52:53 deraadt Exp $"
+#endif /* LIBC_SCCS and not lint */
+
+#include "DEFS.h"
+
+ENTRY(strncpy)
+ movl sp@(4),d0 | return value is toaddr
+ movl sp@(12),d1 | count
+ beq scdone | nothing to do
+ movl sp@(8),a0 | a0 = fromaddr
+ movl d0,a1 | a1 = toaddr
+scloop:
+ movb a0@+,a1@+ | copy a byte
+ beq scploop | copied null, go pad if necessary
+ subql #1,d1 | adjust count
+ bne scloop | more room, keep going
+scdone:
+ rts
+scploop:
+ subql #1,d1 | adjust count
+ beq scdone | no more room, all done
+ clrb a1@+ | clear a byte
+ jra scploop | keep going