diff options
| author | chopps <chopps@NetBSD.org> | 1994-03-29 07:14:42 +0000 |
|---|---|---|
| committer | chopps <chopps@NetBSD.org> | 1994-03-29 07:14:42 +0000 |
| commit | 7bb230219d3c1925b7b923d423154c440d1299a2 (patch) | |
| tree | 42d8d11964c5c7b0e137596445c3863f5039d8de /sys/lib | |
| parent | 2c8fad6100e43aed1cdc9a2ef08233ec92f6ff80 (diff) | |
copied over so lib/libc/arch not needed to build kernel.
Diffstat (limited to 'sys/lib')
30 files changed, 1738 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..1c83cec11f5 --- /dev/null +++ b/sys/lib/libkern/arch/m68k/DEFS.h @@ -0,0 +1,3 @@ +/* $Id: DEFS.h,v 1.1 1994/03/29 07:14:42 chopps Exp $ */ + +#include <machine/asm.h> diff --git a/sys/lib/libkern/arch/m68k/SYS.h b/sys/lib/libkern/arch/m68k/SYS.h new file mode 100644 index 00000000000..0ce926ca18d --- /dev/null +++ b/sys/lib/libkern/arch/m68k/SYS.h @@ -0,0 +1,78 @@ +/*- + * 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. + * + * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 + * $Id: SYS.h,v 1.1 1994/03/29 07:14:44 chopps Exp $ + */ + +#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..f9c944f2d05 --- /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 1994/03/29 07:14:45 chopps 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 */ + jeq bcdone /* if zero, nothing to do */ + movl a0,d1 + btst #0,d1 /* string 1 address odd? */ + jeq bceven /* no, skip alignment */ + cmpmb a0@+,a1@+ /* yes, compare a byte */ + jne bcnoteq /* not equal, return non-zero */ + subql #1,d0 /* adjust count */ + jeq bcdone /* count 0, reutrn zero */ +bceven: + movl a1,d1 + btst #0,d1 /* string 2 address odd? */ + jne bcbloop /* yes, no hope for alignment, compare bytes */ + movl d0,d1 /* no, both even */ + lsrl #2,d1 /* convert count to longword count */ + jeq bcbloop /* count 0, skip longword loop */ +bclloop: + cmpml a0@+,a1@+ /* compare a longword */ + jne bcnoteq /* not equal, return non-zero */ + subql #1,d1 /* adjust count */ + jne bclloop /* still more, keep comparing */ + andl #3,d0 /* what remains */ + jeq bcdone /* nothing, all done */ +bcbloop: + cmpmb a0@+,a1@+ /* compare a byte */ + jne bcnoteq /* not equal, return non-zero */ + subql #1,d0 /* adjust count */ + jne 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..b1eead1e9a2 --- /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 1994/03/29 07:14:46 chopps 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 */ + jeq bzdone /* nothing to do */ + movl a0,d1 + btst #0,d1 /* address odd? */ + jeq bzeven /* no, skip alignment */ + clrb a0@+ /* yes, clear a byte */ + subql #1,d0 /* adjust count */ + jeq bzdone /* if zero, all done */ +bzeven: + movl d0,d1 + lsrl #2,d1 /* convert to longword count */ + jeq bzbloop /* no longwords, skip loop */ +bzlloop: + clrl a0@+ /* clear a longword */ + subql #1,d1 /* adjust count */ + jne bzlloop /* still more, keep going */ + andl #3,d0 /* what remains */ + jeq bzdone /* nothing, all done */ +bzbloop: + clrb a0@+ /* clear a byte */ + subql #1,d0 /* adjust count */ + jne 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..4c49b6cc2d3 --- /dev/null +++ b/sys/lib/libkern/arch/m68k/ffs.S @@ -0,0 +1,58 @@ +/*- + * 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 1994/03/29 07:14:47 chopps Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* bit = ffs(value) */ + +#include "DEFS.h" + +ENTRY(ffs) + moveq #-1,d0 + movl sp@(4),d1 + jeq done +again: + addql #1,d0 + btst d0,d1 + jeq again +done: + addql #1,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..eef5ceafa2d --- /dev/null +++ b/sys/lib/libkern/arch/m68k/htonl.S @@ -0,0 +1,50 @@ +/*- + * 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: @(#)htonl.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: htonl.S,v 1.1 1994/03/29 07:14:48 chopps 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..62b2d5b2b6b --- /dev/null +++ b/sys/lib/libkern/arch/m68k/htons.S @@ -0,0 +1,51 @@ +/*- + * 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: @(#)htons.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: htons.S,v 1.1 1994/03/29 07:14:50 chopps 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/ntohl.S b/sys/lib/libkern/arch/m68k/ntohl.S new file mode 100644 index 00000000000..31f992c9de2 --- /dev/null +++ b/sys/lib/libkern/arch/m68k/ntohl.S @@ -0,0 +1,50 @@ +/*- + * 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: @(#)ntohl.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: ntohl.S,v 1.1 1994/03/29 07:14:51 chopps 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..7af457a4f81 --- /dev/null +++ b/sys/lib/libkern/arch/m68k/ntohs.S @@ -0,0 +1,51 @@ +/*- + * 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: @(#)ntohs.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: ntohs.S,v 1.1 1994/03/29 07:14:52 chopps 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/strcat.c b/sys/lib/libkern/arch/m68k/strcat.c new file mode 100644 index 00000000000..3123d0975a1 --- /dev/null +++ b/sys/lib/libkern/arch/m68k/strcat.c @@ -0,0 +1,51 @@ +/* + * 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) +/*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: strcat.c,v 1.1 1994/03/29 07:14:53 chopps 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..19d8fb03b15 --- /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 1994/03/29 07:14:54 chopps 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 */ + jne scexit /* not equal, break out */ + tstb d0 /* at end of string1? */ + jne 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..708b391860d --- /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 1994/03/29 07:14:56 chopps 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 */ + jne 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..8218768de79 --- /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 1994/03/29 07:14:57 chopps 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? */ + jne 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..f6be80c7333 --- /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 1994/03/29 07:14:58 chopps 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 */ + jeq 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 */ + jne scexit /* not equal, break out */ + tstb d0 /* at end of string1? */ + jeq scdone /* yes, all done */ + subql #1,d1 /* no, adjust count */ + jne 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..f498bd6eb18 --- /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 1994/03/29 07:14:59 chopps 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 */ + jeq scdone /* nothing to do */ + movl sp@(8),a0 /* a0 = fromaddr */ + movl d0,a1 /* a1 = toaddr */ +scloop: + movb a0@+,a1@+ /* copy a byte */ + jeq scploop /* copied null, go pad if necessary */ + subql #1,d1 /* adjust count */ + jne scloop /* more room, keep going */ +scdone: + rts +scploop: + subql #1,d1 /* adjust count */ + jeq scdone /* no more room, all done */ + clrb a1@+ /* clear a byte */ + jra scploop /* keep going */ diff --git a/sys/lib/libkern/m68k/DEFS.h b/sys/lib/libkern/m68k/DEFS.h new file mode 100644 index 00000000000..1c83cec11f5 --- /dev/null +++ b/sys/lib/libkern/m68k/DEFS.h @@ -0,0 +1,3 @@ +/* $Id: DEFS.h,v 1.1 1994/03/29 07:14:42 chopps Exp $ */ + +#include <machine/asm.h> diff --git a/sys/lib/libkern/m68k/SYS.h b/sys/lib/libkern/m68k/SYS.h new file mode 100644 index 00000000000..0ce926ca18d --- /dev/null +++ b/sys/lib/libkern/m68k/SYS.h @@ -0,0 +1,78 @@ +/*- + * 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. + * + * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 + * $Id: SYS.h,v 1.1 1994/03/29 07:14:44 chopps Exp $ + */ + +#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/m68k/bcmp.S b/sys/lib/libkern/m68k/bcmp.S new file mode 100644 index 00000000000..f9c944f2d05 --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:45 chopps 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 */ + jeq bcdone /* if zero, nothing to do */ + movl a0,d1 + btst #0,d1 /* string 1 address odd? */ + jeq bceven /* no, skip alignment */ + cmpmb a0@+,a1@+ /* yes, compare a byte */ + jne bcnoteq /* not equal, return non-zero */ + subql #1,d0 /* adjust count */ + jeq bcdone /* count 0, reutrn zero */ +bceven: + movl a1,d1 + btst #0,d1 /* string 2 address odd? */ + jne bcbloop /* yes, no hope for alignment, compare bytes */ + movl d0,d1 /* no, both even */ + lsrl #2,d1 /* convert count to longword count */ + jeq bcbloop /* count 0, skip longword loop */ +bclloop: + cmpml a0@+,a1@+ /* compare a longword */ + jne bcnoteq /* not equal, return non-zero */ + subql #1,d1 /* adjust count */ + jne bclloop /* still more, keep comparing */ + andl #3,d0 /* what remains */ + jeq bcdone /* nothing, all done */ +bcbloop: + cmpmb a0@+,a1@+ /* compare a byte */ + jne bcnoteq /* not equal, return non-zero */ + subql #1,d0 /* adjust count */ + jne bcbloop /* still more, keep going */ + rts +bcnoteq: + moveq #1,d0 +bcdone: + rts diff --git a/sys/lib/libkern/m68k/bzero.S b/sys/lib/libkern/m68k/bzero.S new file mode 100644 index 00000000000..b1eead1e9a2 --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:46 chopps 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 */ + jeq bzdone /* nothing to do */ + movl a0,d1 + btst #0,d1 /* address odd? */ + jeq bzeven /* no, skip alignment */ + clrb a0@+ /* yes, clear a byte */ + subql #1,d0 /* adjust count */ + jeq bzdone /* if zero, all done */ +bzeven: + movl d0,d1 + lsrl #2,d1 /* convert to longword count */ + jeq bzbloop /* no longwords, skip loop */ +bzlloop: + clrl a0@+ /* clear a longword */ + subql #1,d1 /* adjust count */ + jne bzlloop /* still more, keep going */ + andl #3,d0 /* what remains */ + jeq bzdone /* nothing, all done */ +bzbloop: + clrb a0@+ /* clear a byte */ + subql #1,d0 /* adjust count */ + jne bzbloop /* still more, keep going */ +bzdone: + rts diff --git a/sys/lib/libkern/m68k/ffs.S b/sys/lib/libkern/m68k/ffs.S new file mode 100644 index 00000000000..4c49b6cc2d3 --- /dev/null +++ b/sys/lib/libkern/m68k/ffs.S @@ -0,0 +1,58 @@ +/*- + * 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 1994/03/29 07:14:47 chopps Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* bit = ffs(value) */ + +#include "DEFS.h" + +ENTRY(ffs) + moveq #-1,d0 + movl sp@(4),d1 + jeq done +again: + addql #1,d0 + btst d0,d1 + jeq again +done: + addql #1,d0 + rts diff --git a/sys/lib/libkern/m68k/htonl.S b/sys/lib/libkern/m68k/htonl.S new file mode 100644 index 00000000000..eef5ceafa2d --- /dev/null +++ b/sys/lib/libkern/m68k/htonl.S @@ -0,0 +1,50 @@ +/*- + * 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: @(#)htonl.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: htonl.S,v 1.1 1994/03/29 07:14:48 chopps 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/m68k/htons.S b/sys/lib/libkern/m68k/htons.S new file mode 100644 index 00000000000..62b2d5b2b6b --- /dev/null +++ b/sys/lib/libkern/m68k/htons.S @@ -0,0 +1,51 @@ +/*- + * 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: @(#)htons.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: htons.S,v 1.1 1994/03/29 07:14:50 chopps 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/m68k/ntohl.S b/sys/lib/libkern/m68k/ntohl.S new file mode 100644 index 00000000000..31f992c9de2 --- /dev/null +++ b/sys/lib/libkern/m68k/ntohl.S @@ -0,0 +1,50 @@ +/*- + * 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: @(#)ntohl.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: ntohl.S,v 1.1 1994/03/29 07:14:51 chopps 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/m68k/ntohs.S b/sys/lib/libkern/m68k/ntohs.S new file mode 100644 index 00000000000..7af457a4f81 --- /dev/null +++ b/sys/lib/libkern/m68k/ntohs.S @@ -0,0 +1,51 @@ +/*- + * 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: @(#)ntohs.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: ntohs.S,v 1.1 1994/03/29 07:14:52 chopps 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/m68k/strcat.c b/sys/lib/libkern/m68k/strcat.c new file mode 100644 index 00000000000..3123d0975a1 --- /dev/null +++ b/sys/lib/libkern/m68k/strcat.c @@ -0,0 +1,51 @@ +/* + * 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) +/*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: strcat.c,v 1.1 1994/03/29 07:14:53 chopps 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/m68k/strcmp.S b/sys/lib/libkern/m68k/strcmp.S new file mode 100644 index 00000000000..19d8fb03b15 --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:54 chopps 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 */ + jne scexit /* not equal, break out */ + tstb d0 /* at end of string1? */ + jne 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/m68k/strcpy.S b/sys/lib/libkern/m68k/strcpy.S new file mode 100644 index 00000000000..708b391860d --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:56 chopps 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 */ + jne scloop /* copied non-null, keep going */ + rts diff --git a/sys/lib/libkern/m68k/strlen.S b/sys/lib/libkern/m68k/strlen.S new file mode 100644 index 00000000000..8218768de79 --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:57 chopps 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? */ + jne slloop /* no, keep going */ + rts diff --git a/sys/lib/libkern/m68k/strncmp.S b/sys/lib/libkern/m68k/strncmp.S new file mode 100644 index 00000000000..f6be80c7333 --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:58 chopps 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 */ + jeq 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 */ + jne scexit /* not equal, break out */ + tstb d0 /* at end of string1? */ + jeq scdone /* yes, all done */ + subql #1,d1 /* no, adjust count */ + jne 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/m68k/strncpy.S b/sys/lib/libkern/m68k/strncpy.S new file mode 100644 index 00000000000..f498bd6eb18 --- /dev/null +++ b/sys/lib/libkern/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 1994/03/29 07:14:59 chopps 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 */ + jeq scdone /* nothing to do */ + movl sp@(8),a0 /* a0 = fromaddr */ + movl d0,a1 /* a1 = toaddr */ +scloop: + movb a0@+,a1@+ /* copy a byte */ + jeq scploop /* copied null, go pad if necessary */ + subql #1,d1 /* adjust count */ + jne scloop /* more room, keep going */ +scdone: + rts +scploop: + subql #1,d1 /* adjust count */ + jeq scdone /* no more room, all done */ + clrb a1@+ /* clear a byte */ + jra scploop /* keep going */ |
