diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /lib/libc/arch/m68k |
initial import of NetBSD tree
Diffstat (limited to 'lib/libc/arch/m68k')
90 files changed, 4448 insertions, 0 deletions
diff --git a/lib/libc/arch/m68k/:errfix b/lib/libc/arch/m68k/:errfix new file mode 100644 index 00000000000..19ba1f0089d --- /dev/null +++ b/lib/libc/arch/m68k/:errfix @@ -0,0 +1,8 @@ +?sys_nerr? +.-2,.+1m0 +.+1,$g/\.data/s//\.text/ +0a + .data +. +w +q diff --git a/lib/libc/arch/m68k/DEFS.h b/lib/libc/arch/m68k/DEFS.h new file mode 100644 index 00000000000..79f3672d6d2 --- /dev/null +++ b/lib/libc/arch/m68k/DEFS.h @@ -0,0 +1,3 @@ +/* $Id: DEFS.h,v 1.1 1995/10/18 08:41:27 deraadt Exp $ */ + +#include <machine/asm.h> diff --git a/lib/libc/arch/m68k/Makefile.inc b/lib/libc/arch/m68k/Makefile.inc new file mode 100644 index 00000000000..948f952bb2e --- /dev/null +++ b/lib/libc/arch/m68k/Makefile.inc @@ -0,0 +1,5 @@ +# $Id: Makefile.inc,v 1.1 1995/10/18 08:41:27 deraadt Exp $ + +KMINCLUDES= arch/m68k/DEFS.h arch/m68k/SYS.h +KMSRCS= 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 diff --git a/lib/libc/arch/m68k/SYS.h b/lib/libc/arch/m68k/SYS.h new file mode 100644 index 00000000000..ba25fd2ede4 --- /dev/null +++ b/lib/libc/arch/m68k/SYS.h @@ -0,0 +1,62 @@ +/*- + * 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 1995/10/18 08:41:27 deraadt Exp $ + */ + +#include <sys/syscall.h> +#include <machine/asm.h> + +#ifdef __STDC__ + +#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \ + movl \#SYS_ ## x,d0; trap \#0; jcs err +#define RSYSCALL(x) SYSCALL(x); rts +#define PSEUDO(x,y) ENTRY(x); movl \#SYS_ ## y,d0; trap \#0; rts + +#else /* !__STDC__ */ + +#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \ + movl #SYS_/**/x,d0; trap #0; jcs err +#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/lib/libc/arch/m68k/gen/Makefile.inc b/lib/libc/arch/m68k/gen/Makefile.inc new file mode 100644 index 00000000000..03bcb9fef09 --- /dev/null +++ b/lib/libc/arch/m68k/gen/Makefile.inc @@ -0,0 +1,12 @@ +# $NetBSD: Makefile.inc,v 1.4 1995/05/03 03:43:05 briggs Exp $ + +SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c ldexp.S modf.S \ + setjmp.S sigsetjmp.S +SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \ + fpsetround.S fpsetsticky.S +SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \ + divsf3.S divsi3.S extendsfdf2.S fixdfsi.S fixunsdfsi.S \ + floatsidf.S lshlsi3.S lshrsi3.S modsi3.S muldf3.S mulsf3.S mulsi3.S \ + negdf2.S negsf2.S saveregs.c subdf3.S subsf3.S truncdfsf2.S udivsi3.S \ + umodsi3.S umulsi3.S + diff --git a/lib/libc/arch/m68k/gen/_setjmp.S b/lib/libc/arch/m68k/gen/_setjmp.S new file mode 100644 index 00000000000..7eb1d579629 --- /dev/null +++ b/lib/libc/arch/m68k/gen/_setjmp.S @@ -0,0 +1,88 @@ +/*- + * 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: @(#)_setjmp.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: _setjmp.S,v 1.1 1995/10/18 08:41:27 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v)" from + * the last call to + * _setjmp(a) + * by restoring registers from the stack, + * The previous signal state is NOT restored. + */ + +#include "DEFS.h" + +ENTRY(_setjmp) + movl sp@(4),a0 /* save area pointer */ + clrl a0@+ /* no old onstack */ + clrl a0@+ /* no old sigmask */ + movl sp,a0@+ /* save old SP */ + movl a6,a0@+ /* save old FP */ + clrl a0@+ /* no old AP */ + movl sp@,a0@+ /* save old PC */ + clrl a0@+ /* clear PS */ + moveml #0x3CFC,a0@ /* save other non-scratch regs */ + clrl d0 /* return zero */ + rts + +ENTRY(_longjmp) + movl sp@(4),a0 /* save area pointer */ + addql #8,a0 /* skip onstack/sigmask */ + tstl a0@ /* ensure non-zero SP */ + jeq botch /* oops! */ + movl sp@(8),d0 /* grab return value */ + jne ok /* non-zero ok */ + moveq #1,d0 /* else make non-zero */ +ok: + movl a0@+,sp /* restore SP */ + movl a0@+,a6 /* restore FP */ + addql #4,a0 /* skip AP */ + movl a0@+,sp@ /* restore PC */ + moveml a0@(4),#0x3CFC /* restore non-scratch regs */ + rts + +botch: + jbsr _longjmperror + stop #0 diff --git a/lib/libc/arch/m68k/gen/adddf3.S b/lib/libc/arch/m68k/gen/adddf3.S new file mode 100644 index 00000000000..be750264b69 --- /dev/null +++ b/lib/libc/arch/m68k/gen/adddf3.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: @(#)adddf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: adddf3.S,v 1.1 1995/10/18 08:41:27 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* double + double */ +ENTRY(__adddf3) + fmoved sp@(4),fp0 + faddd sp@(12),fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/addsf3.S b/lib/libc/arch/m68k/gen/addsf3.S new file mode 100644 index 00000000000..ac7ba088c1b --- /dev/null +++ b/lib/libc/arch/m68k/gen/addsf3.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: @(#)addsf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: addsf3.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* single + single */ +ENTRY(__addsf3) + fmoves sp@(4),fp0 + fadds sp@(8),fp0 + fmoves fp0,d0 + rts diff --git a/lib/libc/arch/m68k/gen/alloca.S b/lib/libc/arch/m68k/gen/alloca.S new file mode 100644 index 00000000000..d29d1e1a1d0 --- /dev/null +++ b/lib/libc/arch/m68k/gen/alloca.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: @(#)alloca.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: alloca.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* like alloc, but automatic free in return */ + +#include "DEFS.h" + +ENTRY(alloca) + movl sp@,a0 /* save return addr */ + movl sp,d0 /* get current SP value */ + subl sp@(4),d0 /* allocate requested space */ + andb #~3,d0 /* longword align for efficiency */ + addql #8,d0 /* reuse space of call frame */ + movl d0,sp /* set new SP value */ + lea sp@(-4),sp /* account for argument pop in caller */ + jmp a0@ /* funny return */ diff --git a/lib/libc/arch/m68k/gen/ashlsi3.S b/lib/libc/arch/m68k/gen/ashlsi3.S new file mode 100644 index 00000000000..20725f97554 --- /dev/null +++ b/lib/libc/arch/m68k/gen/ashlsi3.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: @(#)ashlsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: ashlsi3.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* int << int */ +ENTRY(__ashlsi3) + movel sp@(8),d1 + movel sp@(4),d0 + asll d1,d0 + rts diff --git a/lib/libc/arch/m68k/gen/ashrsi3.S b/lib/libc/arch/m68k/gen/ashrsi3.S new file mode 100644 index 00000000000..c4e6d2b445a --- /dev/null +++ b/lib/libc/arch/m68k/gen/ashrsi3.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: @(#)ashrsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: ashrsi3.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* int >> int */ +ENTRY(__ashrsi3) + movel sp@(8),d1 + movel sp@(4),d0 + asrl d1,d0 + rts diff --git a/lib/libc/arch/m68k/gen/cmpdf2.S b/lib/libc/arch/m68k/gen/cmpdf2.S new file mode 100644 index 00000000000..f56fa5611d9 --- /dev/null +++ b/lib/libc/arch/m68k/gen/cmpdf2.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: @(#)cmpdf2.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: cmpdf2.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* double > double: 1 */ +/* double < double: -1 */ +/* double == double: 0 */ +ENTRY(__cmpdf2) + fmoved sp@(4),fp0 + fcmpd sp@(12),fp0 + fbgt Lagtb + fslt d0 + extbl d0 + rts +Lagtb: + moveq #1,d0 + rts diff --git a/lib/libc/arch/m68k/gen/cmpsf2.S b/lib/libc/arch/m68k/gen/cmpsf2.S new file mode 100644 index 00000000000..8d8405f3620 --- /dev/null +++ b/lib/libc/arch/m68k/gen/cmpsf2.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: @(#)cmpsf2.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: cmpsf2.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* single > single: 1 */ +/* single < single: -1 */ +/* single == single: 0 */ +ENTRY(__cmpsf2) + fmoves sp@(4),fp0 + fcmps sp@(8),fp0 + fbgt Lagtb + fslt d0 + extbl d0 + rts +Lagtb: + moveq #1,d0 + rts diff --git a/lib/libc/arch/m68k/gen/divdf3.S b/lib/libc/arch/m68k/gen/divdf3.S new file mode 100644 index 00000000000..e9ded07f686 --- /dev/null +++ b/lib/libc/arch/m68k/gen/divdf3.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: @(#)divdf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: divdf3.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* double / double */ +ENTRY(__divdf3) + fmoved sp@(4),fp0 + fdivd sp@(12),fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/divsf3.S b/lib/libc/arch/m68k/gen/divsf3.S new file mode 100644 index 00000000000..ed6cea4fbc1 --- /dev/null +++ b/lib/libc/arch/m68k/gen/divsf3.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: @(#)divsf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: divsf3.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* single / single */ +ENTRY(__divsf3) + fmoves sp@(4),fp0 + fdivs sp@(8),fp0 + fmoves fp0,d0 + rts diff --git a/lib/libc/arch/m68k/gen/divsi3.S b/lib/libc/arch/m68k/gen/divsi3.S new file mode 100644 index 00000000000..8c1660daa7e --- /dev/null +++ b/lib/libc/arch/m68k/gen/divsi3.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: @(#)divsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: divsi3.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* int / int */ +ENTRY(__divsi3) + movel sp@(4),d0 + divsl sp@(8),d0 + rts diff --git a/lib/libc/arch/m68k/gen/extendsfdf2.S b/lib/libc/arch/m68k/gen/extendsfdf2.S new file mode 100644 index 00000000000..f34dfc67b13 --- /dev/null +++ b/lib/libc/arch/m68k/gen/extendsfdf2.S @@ -0,0 +1,52 @@ +/*- + * 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: @(#)extendsfdf2.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: extendsfdf2.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* (double) float */ +ENTRY(__extendsfdf2) + fmoves sp@(4),fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/fabs.S b/lib/libc/arch/m68k/gen/fabs.S new file mode 100644 index 00000000000..b177f7bd8ca --- /dev/null +++ b/lib/libc/arch/m68k/gen/fabs.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: @(#)fabs.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: fabs.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* fabs - floating absolute value */ + +#include "DEFS.h" + +ENTRY(fabs) + fmoved sp@(4),fp0 + fjnlt L1 + fnegx fp0 +L1: + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/fixdfsi.S b/lib/libc/arch/m68k/gen/fixdfsi.S new file mode 100644 index 00000000000..9a2b70015cc --- /dev/null +++ b/lib/libc/arch/m68k/gen/fixdfsi.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: @(#)fixdfsi.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: fixdfsi.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* (int) double */ +ENTRY(__fixdfsi) + fintrzd sp@(4),fp0 + fmovel fp0,d0 + rts diff --git a/lib/libc/arch/m68k/gen/fixunsdfsi.S b/lib/libc/arch/m68k/gen/fixunsdfsi.S new file mode 100644 index 00000000000..a1948bea745 --- /dev/null +++ b/lib/libc/arch/m68k/gen/fixunsdfsi.S @@ -0,0 +1,57 @@ +/*- + * 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: @(#)fixunsdfsi.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: fixunsdfsi.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* (unsigned) double */ +ENTRY(__fixunsdfsi) + fintrzd sp@(4),fp0 + fcmpd #0r2147483648.0,fp0 + fbge Lwaybig + fmovel fp0,d0 + rts +Lwaybig: + fsubd #0r2147483648.0,fp0 + fmovel fp0,d0 + bset #31,d0 + rts diff --git a/lib/libc/arch/m68k/gen/floatsidf.S b/lib/libc/arch/m68k/gen/floatsidf.S new file mode 100644 index 00000000000..7a77131dfec --- /dev/null +++ b/lib/libc/arch/m68k/gen/floatsidf.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: @(#)floatsidf.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: floatsidf.S,v 1.1 1995/10/18 08:41:28 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* (double) int */ +ENTRY(__floatsidf) + fmovel sp@(4),fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts + diff --git a/lib/libc/arch/m68k/gen/flt_rounds.S b/lib/libc/arch/m68k/gen/flt_rounds.S new file mode 100644 index 00000000000..68e6c2bfc12 --- /dev/null +++ b/lib/libc/arch/m68k/gen/flt_rounds.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin, Apr 6, 1995 + * Public domain. + */ + +#include <machine/asm.h> + + .text + .even +_map: + .byte 1 /* round to nearest */ + .byte 0 /* round to zero */ + .byte 3 /* round to negative infinity */ + .byte 2 /* round to positive infinity */ + +ENTRY(__flt_rounds) + fmovel fpcr,d0 + bfextu d0{#26:#2},d0 + lea _map,a0 + moveb a0@(d0:l:1),d0 + rts diff --git a/lib/libc/arch/m68k/gen/fpgetmask.S b/lib/libc/arch/m68k/gen/fpgetmask.S new file mode 100644 index 00000000000..7b6106dab3d --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpgetmask.S @@ -0,0 +1,11 @@ +/* + * Written by Charles M. Hannum, Apr 9, 1995 + * Public domain. + */ + +#include <machine/asm.h> + +ENTRY(fpgetmask) + fmovel fpcr,d0 + bfextu d0{#18:#5},d0 + rts diff --git a/lib/libc/arch/m68k/gen/fpgetround.S b/lib/libc/arch/m68k/gen/fpgetround.S new file mode 100644 index 00000000000..8dadd0d0d73 --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpgetround.S @@ -0,0 +1,11 @@ +/* + * Written by J.T. Conklin, Apr 6, 1995 + * Public domain. + */ + +#include <machine/asm.h> + +ENTRY(fpgetround) + fmovel fpcr,d0 + bfextu d0{#26:#2},d0 + rts diff --git a/lib/libc/arch/m68k/gen/fpgetsticky.S b/lib/libc/arch/m68k/gen/fpgetsticky.S new file mode 100644 index 00000000000..bfac27fc5d1 --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpgetsticky.S @@ -0,0 +1,11 @@ +/* + * Written by Charles M. Hannum, Apr 9, 1995 + * Public domain. + */ + +#include <machine/asm.h> + +ENTRY(fpgetsticky) + fmovel fpsr,d0 + bfextu d0{#24:#5},d0 + rts diff --git a/lib/libc/arch/m68k/gen/fpsetmask.S b/lib/libc/arch/m68k/gen/fpsetmask.S new file mode 100644 index 00000000000..5b0cdb2a89c --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpsetmask.S @@ -0,0 +1,16 @@ +/* + * Written by Charles M. Hannum, Apr 9, 1995 + * Public Domain. + */ + +#include <machine/asm.h> + +ENTRY(fpsetmask) + movel d2,sp@- + fmovel fpcr,d1 + movel sp@(8),d2 + bfextu d1{#18:#5},d0 + bfins d2,d1{#18:#5} + movel sp@+,d2 + fmovel d1,fpcr + rts diff --git a/lib/libc/arch/m68k/gen/fpsetround.S b/lib/libc/arch/m68k/gen/fpsetround.S new file mode 100644 index 00000000000..d89631f99ce --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpsetround.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin, Apr 6, 1995 + * Public Domain. + */ + +#include <machine/asm.h> + +ENTRY(fpsetround) + movel d2,sp@- + fmovel fpcr,d1 + movel sp@(8),d2 + bfextu d1{#26,#2},d0 + bfins d2,d1{#26:#2} + movel sp@+,d2 + fmovel d1,fpcr + rts diff --git a/lib/libc/arch/m68k/gen/fpsetsticky.S b/lib/libc/arch/m68k/gen/fpsetsticky.S new file mode 100644 index 00000000000..3e433799bdf --- /dev/null +++ b/lib/libc/arch/m68k/gen/fpsetsticky.S @@ -0,0 +1,16 @@ +/* + * Written by Charles M. Hannum, Apr 9, 1995 + * Public domain. + */ + +#include <machine/asm.h> + +ENTRY(fpsetsticky) + movel d2,sp@- + fmovel fpsr,d1 + movel sp@(8),d2 + bfextu d1{#24:#5},d0 + bfins d2,d1{#24:#5} + movel sp@+,d2 + fmovel d1,fpsr + rts diff --git a/lib/libc/arch/m68k/gen/frexp.c b/lib/libc/arch/m68k/gen/frexp.c new file mode 100644 index 00000000000..f65eb531581 --- /dev/null +++ b/lib/libc/arch/m68k/gen/frexp.c @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char sccsid[] = "from: @(#)frexp.c 5.1 (Berkeley) 3/6/91";*/ +static char rcsid[] = "$Id: frexp.c,v 1.1 1995/10/18 08:41:29 deraadt Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <sys/types.h> +#include <math.h> + +double +frexp(value, eptr) + double value; + int *eptr; +{ + union { + double v; + struct { + u_int u_sign : 1; + u_int u_exp : 11; + u_int u_mant1 : 20; + u_int u_mant2 : 32; + } s; + } u; + + if (value) { + u.v = value; + *eptr = u.s.u_exp - 1022; + u.s.u_exp = 1022; + return(u.v); + } else { + *eptr = 0; + return((double)0); + } +} diff --git a/lib/libc/arch/m68k/gen/infinity.c b/lib/libc/arch/m68k/gen/infinity.c new file mode 100644 index 00000000000..214cdac680f --- /dev/null +++ b/lib/libc/arch/m68k/gen/infinity.c @@ -0,0 +1,10 @@ +#ifndef lint +static char rcsid[] = "$Id: infinity.c,v 1.1 1995/10/18 08:41:29 deraadt Exp $"; +#endif /* not lint */ + +/* infinity.c */ + +#include <math.h> + +/* bytes for +Infinity on a 68k */ +char __infinity[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; diff --git a/lib/libc/arch/m68k/gen/isinf.c b/lib/libc/arch/m68k/gen/isinf.c new file mode 100644 index 00000000000..cbe2649a478 --- /dev/null +++ b/lib/libc/arch/m68k/gen/isinf.c @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char sccsid[] = "from: @(#)isinf.c 5.1 (Berkeley) 3/18/91";*/ +static char rcsid[] = "$Id: isinf.c,v 1.1 1995/10/18 08:41:29 deraadt Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <sys/types.h> + +isnan(d) + double d; +{ + register struct IEEEdp { + u_int sign : 1; + u_int exp : 11; + u_int manh : 20; + u_int manl : 32; + } *p = (struct IEEEdp *)&d; + + return(p->exp == 2047 && (p->manh || p->manl)); +} + +isinf(d) + double d; +{ + register struct IEEEdp { + u_int sign : 1; + u_int exp : 11; + u_int manh : 20; + u_int manl : 32; + } *p = (struct IEEEdp *)&d; + + return(p->exp == 2047 && !p->manh && !p->manl); +} diff --git a/lib/libc/arch/m68k/gen/ldexp.S b/lib/libc/arch/m68k/gen/ldexp.S new file mode 100644 index 00000000000..a157f0f14f7 --- /dev/null +++ b/lib/libc/arch/m68k/gen/ldexp.S @@ -0,0 +1,59 @@ +/*- + * 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: @(#)ldexp.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: ldexp.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* + * double ldexp(val, exp) + * returns: val * (2**exp), for integer exp + */ +ENTRY(ldexp) + fmoved sp@(4),fp0 + fbeq Ldone + ftwotoxl sp@(12),fp1 + fmulx fp1,fp0 +Ldone: + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/lshlsi3.S b/lib/libc/arch/m68k/gen/lshlsi3.S new file mode 100644 index 00000000000..617fbcdf60c --- /dev/null +++ b/lib/libc/arch/m68k/gen/lshlsi3.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: @(#)lshlsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: lshlsi3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* unsigned << unsigned */ +ENTRY(__lshlsi3) + movel sp@(8),d1 + movel sp@(4),d0 + lsll d1,d0 + rts diff --git a/lib/libc/arch/m68k/gen/lshrsi3.S b/lib/libc/arch/m68k/gen/lshrsi3.S new file mode 100644 index 00000000000..6a4a8cc983d --- /dev/null +++ b/lib/libc/arch/m68k/gen/lshrsi3.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: @(#)lshrsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: lshrsi3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* unsigned >> unsigned */ +ENTRY(__lshrsi3) + movel sp@(8),d1 + movel sp@(4),d0 + lsrl d1,d0 + rts diff --git a/lib/libc/arch/m68k/gen/modf.S b/lib/libc/arch/m68k/gen/modf.S new file mode 100644 index 00000000000..5dffe41e07a --- /dev/null +++ b/lib/libc/arch/m68k/gen/modf.S @@ -0,0 +1,59 @@ +/*- + * 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: @(#)modf.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: modf.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* + * double modf(val, iptr) + * returns: xxx and n (in *iptr) where val == n.xxx + */ +ENTRY(modf) + fmoved sp@(4),fp0 + movel sp@(12),a0 + fintrzx fp0,fp1 + fmoved fp1,a0@ + fsubx fp1,fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/modsi3.S b/lib/libc/arch/m68k/gen/modsi3.S new file mode 100644 index 00000000000..fc96bc3b917 --- /dev/null +++ b/lib/libc/arch/m68k/gen/modsi3.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: @(#)modsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: modsi3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* int % int */ +ENTRY(__modsi3) + movel sp@(4),d1 + divsll sp@(8),d0:d1 + rts diff --git a/lib/libc/arch/m68k/gen/muldf3.S b/lib/libc/arch/m68k/gen/muldf3.S new file mode 100644 index 00000000000..24eaf12cfb2 --- /dev/null +++ b/lib/libc/arch/m68k/gen/muldf3.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: @(#)muldf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: muldf3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* double * double */ +ENTRY(__muldf3) + fmoved sp@(4),fp0 + fmuld sp@(12),fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/mulsf3.S b/lib/libc/arch/m68k/gen/mulsf3.S new file mode 100644 index 00000000000..228594a23c0 --- /dev/null +++ b/lib/libc/arch/m68k/gen/mulsf3.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: @(#)mulsf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: mulsf3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* single * single */ +ENTRY(__mulsf3) + fmoves sp@(4),fp0 + fmuls sp@(8),fp0 + fmoves fp0,d0 + rts diff --git a/lib/libc/arch/m68k/gen/mulsi3.S b/lib/libc/arch/m68k/gen/mulsi3.S new file mode 100644 index 00000000000..fa36ffce8f8 --- /dev/null +++ b/lib/libc/arch/m68k/gen/mulsi3.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: @(#)mulsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: mulsi3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* int * int */ +ENTRY(__mulsi3) + movel sp@(4),d0 + mulsl sp@(8),d0 + rts diff --git a/lib/libc/arch/m68k/gen/negdf2.S b/lib/libc/arch/m68k/gen/negdf2.S new file mode 100644 index 00000000000..82cabc1a0fc --- /dev/null +++ b/lib/libc/arch/m68k/gen/negdf2.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: @(#)negdf2.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: negdf2.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* -double */ +ENTRY(__negdf2) + movel sp@(4),d0 + movel sp@(8),d1 + bchg #31,d0 + rts diff --git a/lib/libc/arch/m68k/gen/negsf2.S b/lib/libc/arch/m68k/gen/negsf2.S new file mode 100644 index 00000000000..2079f355eb8 --- /dev/null +++ b/lib/libc/arch/m68k/gen/negsf2.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: @(#)negsf2.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: negsf2.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* -single */ +ENTRY(__negsf2) + movel sp@(4),d0 + bchg #31,d0 + rts diff --git a/lib/libc/arch/m68k/gen/saveregs.c b/lib/libc/arch/m68k/gen/saveregs.c new file mode 100644 index 00000000000..3dc611b4b91 --- /dev/null +++ b/lib/libc/arch/m68k/gen/saveregs.c @@ -0,0 +1,46 @@ +/*- + * 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) +/*static char sccsid[] = "from: @(#)saveregs.c 5.2 (Berkeley) 6/22/90";*/ +static char rcsid[] = "$Id: saveregs.c,v 1.1 1995/10/18 08:41:29 deraadt Exp $"; +#endif /* LIBC_SCCS and not lint */ + +__builtin_saveregs() +{ + abort(); +} diff --git a/lib/libc/arch/m68k/gen/setjmp.S b/lib/libc/arch/m68k/gen/setjmp.S new file mode 100644 index 00000000000..b249cfbc6d1 --- /dev/null +++ b/lib/libc/arch/m68k/gen/setjmp.S @@ -0,0 +1,94 @@ +/*- + * 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: @(#)setjmp.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: setjmp.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* + * C library -- setjmp, longjmp + * + * longjmp(a,v) + * will generate a "return(v)" from + * the last call to + * setjmp(a) + * by restoring registers from the stack, + * and a struct sigcontext, see <signal.h> + */ + +#include "DEFS.h" + +ENTRY(setjmp) + subl #12,sp /* space for sigstack args/rvals */ + clrl sp@ /* don't change it... */ + movl sp,sp@(4) /* ...but return the current val */ + jbsr _sigaltstack /* note: flags returned in sp@(8) */ + clrl sp@ /* don't change mask, just return */ + jbsr _sigblock /* old value */ + movl sp@(8),d1 /* old flags value */ + andl #1,d1 /* extract onstack flag */ + addl #12,sp + movl sp@(4),a0 /* save area pointer */ + movl d1,a0@+ /* save old onstack value */ + movl d0,a0@+ /* save old signal mask */ + lea sp@(4),a1 /* adjust saved SP since we won't rts */ + movl a1,a0@+ /* save old SP */ + movl a6,a0@+ /* save old FP */ + clrl a0@+ /* no AP */ + movl sp@,a0@+ /* save old PC */ + clrl a0@+ /* clean PS */ + moveml #0x3CFC,a0@ /* save remaining non-scratch regs */ + clrl d0 /* return 0 */ + rts + +ENTRY(longjmp) + movl sp@(4),a0 /* save area pointer */ + tstl a0@(8) /* ensure non-zero SP */ + jeq botch /* oops! */ + movl sp@(8),d0 /* grab return value */ + jne ok /* non-zero ok */ + moveq #1,d0 /* else make non-zero */ +ok: + moveml a0@(28),#0x3CFC /* restore non-scratch regs */ + movl a0,sp@- /* let sigreturn */ + jbsr _sigreturn /* finish for us */ + +botch: + jbsr _longjmperror + stop #0 diff --git a/lib/libc/arch/m68k/gen/sigsetjmp.S b/lib/libc/arch/m68k/gen/sigsetjmp.S new file mode 100644 index 00000000000..48ca496eafa --- /dev/null +++ b/lib/libc/arch/m68k/gen/sigsetjmp.S @@ -0,0 +1,77 @@ +/*- + * 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: @(#)_setjmp.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$NetBSD: sigsetjmp.S,v 1.1 1995/05/03 03:43:07 briggs Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* + * C library -- sigsetjmp, siglongjmp + * + * siglongjmp(a,v) + * will generate a "return(v)" from + * the last call to + * sigsetjmp(a,m) + * by restoring registers from the stack, + * The previous signal state is restored if 'm' was non-zero. + */ + +#include "DEFS.h" + +/* grab _JBLEN */ +#include <m68k/setjmp.h> + +ENTRY(sigsetjmp) + movl sp@(8),d1 /* grab the mask */ + movl sp@(4),a0 /* grab the area pointer */ + movl d1,a0@(_JBLEN * 4 ) /* save at end of area */ + tstl d1 + bne dosig + jra __setjmp +dosig: + jra _setjmp + + +ENTRY(siglongjmp) + movl sp@(4),a0 /* save area pointer */ + tstl a0@(_JBLEN * 4) /* check mask... */ + bne didsig + jra __longjmp +didsig: + jra _longjmp diff --git a/lib/libc/arch/m68k/gen/subdf3.S b/lib/libc/arch/m68k/gen/subdf3.S new file mode 100644 index 00000000000..0174e81c501 --- /dev/null +++ b/lib/libc/arch/m68k/gen/subdf3.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: @(#)subdf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: subdf3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* double - double */ +ENTRY(__subdf3) + fmoved sp@(4),fp0 + fsubd sp@(12),fp0 + fmoved fp0,sp@- + movel sp@+,d0 + movel sp@+,d1 + rts diff --git a/lib/libc/arch/m68k/gen/subsf3.S b/lib/libc/arch/m68k/gen/subsf3.S new file mode 100644 index 00000000000..9f5f0963e56 --- /dev/null +++ b/lib/libc/arch/m68k/gen/subsf3.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: @(#)subsf3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: subsf3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* single - single */ +ENTRY(__subsf3) + fmoves sp@(4),fp0 + fsubs sp@(8),fp0 + fmoves fp0,d0 + rts diff --git a/lib/libc/arch/m68k/gen/truncdfsf2.S b/lib/libc/arch/m68k/gen/truncdfsf2.S new file mode 100644 index 00000000000..1bf9c2a4f58 --- /dev/null +++ b/lib/libc/arch/m68k/gen/truncdfsf2.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: @(#)truncdfsf2.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: truncdfsf2.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* (float) double */ +ENTRY(__truncdfsf2) + fmoved sp@(4),fp0 + fmoves fp0,d0 + rts diff --git a/lib/libc/arch/m68k/gen/udivsi3.S b/lib/libc/arch/m68k/gen/udivsi3.S new file mode 100644 index 00000000000..8d8c7f0ccfc --- /dev/null +++ b/lib/libc/arch/m68k/gen/udivsi3.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: @(#)udivsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: udivsi3.S,v 1.1 1995/10/18 08:41:29 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* unsigned / unsigned */ +ENTRY(__udivsi3) + movel sp@(4),d0 + divul sp@(8),d0 + rts diff --git a/lib/libc/arch/m68k/gen/umodsi3.S b/lib/libc/arch/m68k/gen/umodsi3.S new file mode 100644 index 00000000000..9a71c5b6cfa --- /dev/null +++ b/lib/libc/arch/m68k/gen/umodsi3.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: @(#)umodsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: umodsi3.S,v 1.1 1995/10/18 08:41:30 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* unsigned % unsigned */ +ENTRY(__umodsi3) + movel sp@(4),d1 + divull sp@(8),d0:d1 + rts diff --git a/lib/libc/arch/m68k/gen/umulsi3.S b/lib/libc/arch/m68k/gen/umulsi3.S new file mode 100644 index 00000000000..11c6b0ba916 --- /dev/null +++ b/lib/libc/arch/m68k/gen/umulsi3.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: @(#)umulsi3.s 5.1 (Berkeley) 6/7/90"*/ + .asciz "$Id: umulsi3.S,v 1.1 1995/10/18 08:41:30 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +/* unsigned * unsigned */ +ENTRY(__umulsi3) + movel sp@(4),d0 + mulul sp@(8),d0 + rts diff --git a/lib/libc/arch/m68k/net/Makefile.inc b/lib/libc/arch/m68k/net/Makefile.inc new file mode 100644 index 00000000000..dc2ddf344cc --- /dev/null +++ b/lib/libc/arch/m68k/net/Makefile.inc @@ -0,0 +1,3 @@ +# $NetBSD: Makefile.inc,v 1.1 1995/02/25 14:58:55 cgd Exp $ + +SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/arch/m68k/net/htonl.S b/lib/libc/arch/m68k/net/htonl.S new file mode 100644 index 00000000000..6cc74518d3c --- /dev/null +++ b/lib/libc/arch/m68k/net/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 1995/10/18 08:41:30 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* netorder = htonl(hostorder) */ + +#include "DEFS.h" + +ENTRY(htonl) + movl sp@(4),d0 + rts diff --git a/lib/libc/arch/m68k/net/htons.S b/lib/libc/arch/m68k/net/htons.S new file mode 100644 index 00000000000..1cfb6b49379 --- /dev/null +++ b/lib/libc/arch/m68k/net/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 1995/10/18 08:41:30 deraadt 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/lib/libc/arch/m68k/net/ntohl.S b/lib/libc/arch/m68k/net/ntohl.S new file mode 100644 index 00000000000..1751667baab --- /dev/null +++ b/lib/libc/arch/m68k/net/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 1995/10/18 08:41:30 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* hostorder = ntohl(netorder) */ + +#include "DEFS.h" + +ENTRY(ntohl) + movl sp@(4),d0 + rts diff --git a/lib/libc/arch/m68k/net/ntohs.S b/lib/libc/arch/m68k/net/ntohs.S new file mode 100644 index 00000000000..2f35eec2b6f --- /dev/null +++ b/lib/libc/arch/m68k/net/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 1995/10/18 08:41:30 deraadt 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/lib/libc/arch/m68k/stdlib/abs.S b/lib/libc/arch/m68k/stdlib/abs.S new file mode 100644 index 00000000000..6c4a53784d6 --- /dev/null +++ b/lib/libc/arch/m68k/stdlib/abs.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: @(#)abs.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: abs.S,v 1.1 1995/10/18 08:41:30 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* abs - int absolute value */ + +#include "DEFS.h" + +ENTRY(abs) + movl sp@(4),d0 + jge L1 + negl d0 +L1: + rts diff --git a/lib/libc/arch/m68k/string/Makefile.inc b/lib/libc/arch/m68k/string/Makefile.inc new file mode 100644 index 00000000000..8ed076485f3 --- /dev/null +++ b/lib/libc/arch/m68k/string/Makefile.inc @@ -0,0 +1,7 @@ +# $NetBSD: Makefile.inc,v 1.1 1995/03/20 14:45:45 mycroft Exp $ + +SRCS+= bcmp.S bcopy.S bzero.S ffs.S index.S memchr.c memcmp.S memset.S \ + rindex.S strcat.c strcmp.S strcpy.S strcspn.c strlen.S \ + strncat.c strncmp.S strncpy.S strpbrk.c strsep.c \ + strspn.c strstr.c swab.S +SRCS+= memcpy.S memmove.S strchr.S strrchr.S diff --git a/lib/libc/arch/m68k/string/bcmp.S b/lib/libc/arch/m68k/string/bcmp.S new file mode 100644 index 00000000000..2cfae67e363 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/bcopy.S b/lib/libc/arch/m68k/string/bcopy.S new file mode 100644 index 00000000000..137c27db218 --- /dev/null +++ b/lib/libc/arch/m68k/string/bcopy.S @@ -0,0 +1,132 @@ +/*- + * 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: @(#)bcopy.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: bcopy.S,v 1.1 1995/10/18 08:41:31 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#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: + * - unroll the longword copy loop (might not be good for a 68020) + * - longword align when possible (only on the 68020) + * - use nested DBcc instructions or use one and limit size to 64K + */ +#ifdef MEMCOPY +ENTRY(memcpy) +#else +#ifdef MEMMOVE +ENTRY(memmove) +#else +ENTRY(bcopy) +#endif +#endif + movl sp@(12),d1 | check count + beq bcdone | == 0, do not do anything +#if defined(MEMCOPY) || defined(MEMMOVE) + movl sp@(4),a1 | dest address + movl sp@(8),a0 | src address +#else + movl sp@(4),a0 | src address + movl sp@(8),a1 | dest address +#endif + cmpl a1,a0 | src after dest? + blt bcback | yes, must copy backwards + movl a0,d0 + btst #0,d0 | src address odd? + beq bcfeven | no, skip alignment + movb a0@+,a1@+ | yes, copy a byte + subql #1,d1 | adjust count + beq bcdone | count 0, all done +bcfeven: + movl a1,d0 + btst #0,d0 | dest address odd? + bne bcfbloop | yes, no hope for alignment, copy bytes + movl d1,d0 | no, both even + lsrl #2,d0 | convert count to longword count + beq bcfbloop | count 0, skip longword loop +bcflloop: + movl a0@+,a1@+ | copy a longword + subql #1,d0 | adjust count + bne bcflloop | still more, keep copying + andl #3,d1 | what remains + beq bcdone | nothing, all done +bcfbloop: + movb a0@+,a1@+ | copy a byte + subql #1,d1 | adjust count + bne bcfbloop | still more, keep going +bcdone: +#if defined(MEMCOPY) || defined(MEMMOVE) + movl sp@(4),d0 | dest address +#endif + rts +bcback: + addl d1,a0 | src pointer to end + addl d1,a1 | dest pointer to end + movl a0,d0 + btst #0,d0 | src address odd? + beq bcbeven | no, skip alignment + movb a0@-,a1@- | yes, copy a byte + subql #1,d1 | adjust count + beq bcdone | count 0, all done +bcbeven: + movl a1,d0 + btst #0,d0 | dest address odd? + bne bcbbloop | yes, no hope for alignment, copy bytes + movl d1,d0 | no, both even + lsrl #2,d0 | convert count to longword count + beq bcbbloop | count 0, skip longword loop +bcblloop: + movl a0@-,a1@- | copy a longword + subql #1,d0 | adjust count + bne bcblloop | still more, keep copying + andl #3,d1 | what remains + beq bcdone | nothing, all done +bcbbloop: + movb a0@-,a1@- | copy a byte + subql #1,d1 | adjust count + bne bcbbloop | still more, keep going +#if defined(MEMCOPY) || defined(MEMMOVE) + movl sp@(4),d0 | dest address +#endif + rts diff --git a/lib/libc/arch/m68k/string/bzero.S b/lib/libc/arch/m68k/string/bzero.S new file mode 100644 index 00000000000..c9822440bb2 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/ffs.S b/lib/libc/arch/m68k/string/ffs.S new file mode 100644 index 00000000000..d35e3ffd291 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/index.S b/lib/libc/arch/m68k/string/index.S new file mode 100644 index 00000000000..1d26bc4bc60 --- /dev/null +++ b/lib/libc/arch/m68k/string/index.S @@ -0,0 +1,62 @@ +/*- + * 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: @(#)index.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: index.S,v 1.1 1995/10/18 08:41:31 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +#ifdef STRCHR +ENTRY(strchr) +#else +ENTRY(index) +#endif + movl sp@(4),a0 | string + movb sp@(11),d0 | char to look for +ixloop: + cmpb a0@,d0 | found our char? + beq ixfound | yes, break out + tstb a0@+ | null? + bne ixloop | no, keep going + moveq #0,d0 | not found, return null + rts +ixfound: + movl a0,d0 | found, return pointer + rts diff --git a/lib/libc/arch/m68k/string/memcmp.S b/lib/libc/arch/m68k/string/memcmp.S new file mode 100644 index 00000000000..578c23308ba --- /dev/null +++ b/lib/libc/arch/m68k/string/memcmp.S @@ -0,0 +1,100 @@ +/*- + * 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: memcmp.S,v 1.1 1995/10/18 08:41:31 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +/* memcmp(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(memcmp) + 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 bcnoteql | 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 +bcnoteql: + subql #4,a0 + subql #4,a1 + movl #4,d0 + jra bcbloop +bcnoteq: + clrl d0 + clrl d1 + movb a0@-,d0 + movb a1@-,d1 + subl d1,d0 +bcdone: + rts diff --git a/lib/libc/arch/m68k/string/memcpy.S b/lib/libc/arch/m68k/string/memcpy.S new file mode 100644 index 00000000000..1617c7153aa --- /dev/null +++ b/lib/libc/arch/m68k/string/memcpy.S @@ -0,0 +1,2 @@ +#define MEMCOPY +#include "bcopy.S" diff --git a/lib/libc/arch/m68k/string/memmove.S b/lib/libc/arch/m68k/string/memmove.S new file mode 100644 index 00000000000..f5a94ed4937 --- /dev/null +++ b/lib/libc/arch/m68k/string/memmove.S @@ -0,0 +1,2 @@ +#define MEMMOVE +#include "bcopy.S" diff --git a/lib/libc/arch/m68k/string/memset.S b/lib/libc/arch/m68k/string/memset.S new file mode 100644 index 00000000000..322abc10582 --- /dev/null +++ b/lib/libc/arch/m68k/string/memset.S @@ -0,0 +1,111 @@ +/*- + * 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: memset.S,v 1.1 1995/10/18 08:41:31 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(memset) + movl d2,sp@- + movl sp@(8),a0 | destination + movl sp@(16),d0 | count + beq bzdone | nothing to do + movb sp@(15),d2 | character + movl a0,d1 + btst #0,d1 | address odd? + beq bzeven | no, skip alignment + movb d2,a0@+ | set one byte + subql #1,d0 | adjust count + beq bzdone | if zero, all done +bzeven: + cmpl #15,d0 + ble bzbloop | too small to be worthwhile + clrl d1 | replicate byte to fill longword + movb d2,d1 + movl d1,d2 + lsll #8,d1 + orl d1,d2 + lsll #8,d1 + orl d1,d2 + lsll #8,d1 + orl d1,d2 + movl d0,d1 | convert to longword count + lsrl #2,d1 +#ifdef DEBUG + moveml #0xffff,sp@- + movl d2,sp@- + movl d1,sp@- + movl d0,sp@- + movl a0,sp@- + movl #foo,sp@- + jsr _printf + addl #20,sp + moveml sp@+,#0xffff +#endif +bzlloop: + movl d2,a0@+ | set one longword + subql #1,d1 | adjust count + bne bzlloop | still more, keep going + andl #3,d0 | what remains + beq bzdone | nothing, all done +bzbloop: + movb d2,a0@+ | set one byte + subql #1,d0 | adjust count + bne bzbloop | still more, keep going +bzdone: + movl sp@(8),d0 | return destination + movl sp@+,d2 + rts + +#ifdef DEBUG + .globl _printf +foo: + .asciz "a0=%08x d0=%08x d1=%08x d2=%08x\n" +#endif diff --git a/lib/libc/arch/m68k/string/rindex.S b/lib/libc/arch/m68k/string/rindex.S new file mode 100644 index 00000000000..211654d34f6 --- /dev/null +++ b/lib/libc/arch/m68k/string/rindex.S @@ -0,0 +1,62 @@ +/*- + * 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: @(#)rindex.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: rindex.S,v 1.1 1995/10/18 08:41:31 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "DEFS.h" + +#ifdef STRRCHR +ENTRY(strrchr) +#else +ENTRY(rindex) +#endif + movl sp@(4),a0 | string + movb sp@(11),d0 | char to look for + subl a1,a1 | clear rindex pointer +rixloop: + cmpb a0@,d0 | found our char? + bne rixnope | no, check for null + movl a0,a1 | yes, remember location +rixnope: + tstb a0@+ | null? + bne rixloop | no, keep going + movl a1,d0 | return value + rts diff --git a/lib/libc/arch/m68k/string/strchr.S b/lib/libc/arch/m68k/string/strchr.S new file mode 100644 index 00000000000..e603668efe5 --- /dev/null +++ b/lib/libc/arch/m68k/string/strchr.S @@ -0,0 +1,2 @@ +#define STRCHR +#include "index.S" diff --git a/lib/libc/arch/m68k/string/strcmp.S b/lib/libc/arch/m68k/string/strcmp.S new file mode 100644 index 00000000000..92dfd30c57b --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/strcpy.S b/lib/libc/arch/m68k/string/strcpy.S new file mode 100644 index 00000000000..de1be32b574 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/strlen.S b/lib/libc/arch/m68k/string/strlen.S new file mode 100644 index 00000000000..65c94469f92 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/strncmp.S b/lib/libc/arch/m68k/string/strncmp.S new file mode 100644 index 00000000000..7d06a8de187 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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/lib/libc/arch/m68k/string/strncpy.S b/lib/libc/arch/m68k/string/strncpy.S new file mode 100644 index 00000000000..310614c3ac9 --- /dev/null +++ b/lib/libc/arch/m68k/string/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 1995/10/18 08:41:31 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 diff --git a/lib/libc/arch/m68k/string/strrchr.S b/lib/libc/arch/m68k/string/strrchr.S new file mode 100644 index 00000000000..f9deb5a826e --- /dev/null +++ b/lib/libc/arch/m68k/string/strrchr.S @@ -0,0 +1,2 @@ +#define STRRCHR +#include "rindex.S" diff --git a/lib/libc/arch/m68k/string/swab.S b/lib/libc/arch/m68k/string/swab.S new file mode 100644 index 00000000000..80d5d120535 --- /dev/null +++ b/lib/libc/arch/m68k/string/swab.S @@ -0,0 +1,18 @@ +#include "DEFS.h" + +ENTRY(swab) + movl sp@(4),a0 | source + movl sp@(8),a1 | destination + movl sp@(12),d0 | count + lsrl #1,d0 | count is in bytes; we need words + beq swdone + +swloop: + movw a0@+,d1 + rorw #8,d1 + movw d1,a1@+ + subql #1,d0 + bne swloop + +swdone: + rts diff --git a/lib/libc/arch/m68k/sys/Ovfork.S b/lib/libc/arch/m68k/sys/Ovfork.S new file mode 100644 index 00000000000..2edc3f8de64 --- /dev/null +++ b/lib/libc/arch/m68k/sys/Ovfork.S @@ -0,0 +1,81 @@ +/*- + * 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: @(#)Ovfork.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: Ovfork.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +/* + * @(#)vfork.s 4.1 (Berkeley) 12/21/80 + * C library -- vfork + */ + +/* + * pid = vfork(); + * + * d1 == 0 in parent process, d1 == 1 in child process. + * d0 == pid of child in parent, d0 == pid of parent in child. + * + * trickery here, due to keith sklower, uses ret to clear the stack, + * and then returns with a jump indirect, since only one person can return + * with a ret off this stack... we do the ret before we vfork! + */ + +ENTRY(vfork) + movl sp@+,a0 + movl #SYS_vfork,d0 + trap #0 + jcs err + subql #1,d1 /* from 1 to 0 in child, 0 to -1 in parent */ + andl d1,d0 + jmp a0@ +err: + .globl _errno +#ifdef PIC + movel #__GLOBAL_OFFSET_TABLE_,a1 + lea pc@(0,a1:l),a1 + movl a1@(_errno:w),a1 + movl d0,a1@ +#else + movl d0,_errno +#endif + moveq #-1,d0 + jmp a0@ diff --git a/lib/libc/arch/m68k/sys/brk.S b/lib/libc/arch/m68k/sys/brk.S new file mode 100644 index 00000000000..24a99555cc2 --- /dev/null +++ b/lib/libc/arch/m68k/sys/brk.S @@ -0,0 +1,79 @@ +/*- + * 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: @(#)brk.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: brk.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + + .globl _end + .globl minbrk + .globl curbrk + + .data +minbrk: .long _end + .text + +ENTRY(brk) +#ifdef PIC + movl #__GLOBAL_OFFSET_TABLE_,a1 + lea pc@(0,a1:l),a1 + movl a1@(minbrk:w),a0 + movl a0@,d0 +#else + movl minbrk,d0 +#endif + cmpl sp@(4),d0 + jle ok + movl d0,sp@(4) +ok: + movl #SYS_break,d0 + trap #0 + jcs err +#ifdef PIC + movl a1@(curbrk:w),a0 + movl sp@(4),a0@ +#else + movl sp@(4),curbrk +#endif + clrl d0 + rts +err: + jra cerror diff --git a/lib/libc/arch/m68k/sys/cerror.S b/lib/libc/arch/m68k/sys/cerror.S new file mode 100644 index 00000000000..cafc425c5ab --- /dev/null +++ b/lib/libc/arch/m68k/sys/cerror.S @@ -0,0 +1,59 @@ +/*- + * 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: @(#)cerror.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: cerror.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + + .even + .globl _errno +cerror: +#ifdef PIC + movl #__GLOBAL_OFFSET_TABLE_,a0 + lea pc@(0,a0:l),a0 + movl a0@(_errno:w),a0 + movl d0,a0@ +#else + movl d0,_errno +#endif + movl #-1,d0 + movl #-1,d1 + rts diff --git a/lib/libc/arch/m68k/sys/exect.S b/lib/libc/arch/m68k/sys/exect.S new file mode 100644 index 00000000000..73f6a130136 --- /dev/null +++ b/lib/libc/arch/m68k/sys/exect.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: @(#)exect.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: exect.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" +#include <machine/psl.h> + +ENTRY(exect) + movl #SYS_execve,d0 + trap #0 + jra cerror /* exect(file, argv, env) */ diff --git a/lib/libc/arch/m68k/sys/fork.S b/lib/libc/arch/m68k/sys/fork.S new file mode 100644 index 00000000000..a13a8200269 --- /dev/null +++ b/lib/libc/arch/m68k/sys/fork.S @@ -0,0 +1,49 @@ +/*- + * 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: @(#)fork.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: fork.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +SYSCALL(fork) + subql #1,d1 /* from 1 to 0 in child, 0 to -1 in parent */ + andl d1,d0 + rts /* pid = fork() */ diff --git a/lib/libc/arch/m68k/sys/pipe.S b/lib/libc/arch/m68k/sys/pipe.S new file mode 100644 index 00000000000..06825cb1bde --- /dev/null +++ b/lib/libc/arch/m68k/sys/pipe.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: @(#)pipe.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: pipe.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +SYSCALL(pipe) + movl sp@(4),a0 + movl d0,a0@+ + movl d1,a0@ + clrl d0 + rts diff --git a/lib/libc/arch/m68k/sys/ptrace.S b/lib/libc/arch/m68k/sys/ptrace.S new file mode 100644 index 00000000000..f260b69b99c --- /dev/null +++ b/lib/libc/arch/m68k/sys/ptrace.S @@ -0,0 +1,62 @@ +/*- + * 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: @(#)ptrace.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: ptrace.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + + .globl _errno + +ENTRY(ptrace) +#ifdef PIC + movl #__GLOBAL_OFFSET_TABLE_,a0 + lea pc@(0,a0:l),a0 + movl a0@(_errno:w),a0 + clrl a0@ +#else + clrl _errno +#endif + movl #SYS_ptrace,d0 + trap #0 + jcs err + rts +err: + jra cerror diff --git a/lib/libc/arch/m68k/sys/reboot.S b/lib/libc/arch/m68k/sys/reboot.S new file mode 100644 index 00000000000..7927e0792bb --- /dev/null +++ b/lib/libc/arch/m68k/sys/reboot.S @@ -0,0 +1,48 @@ +/*- + * 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: @(#)reboot.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: reboot.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +SYSCALL(reboot) + stop #0 + diff --git a/lib/libc/arch/m68k/sys/sbrk.S b/lib/libc/arch/m68k/sys/sbrk.S new file mode 100644 index 00000000000..50dbf3d53ee --- /dev/null +++ b/lib/libc/arch/m68k/sys/sbrk.S @@ -0,0 +1,75 @@ +/*- + * 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: @(#)sbrk.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: sbrk.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + + .globl _end + .globl curbrk + + .data +curbrk: .long _end + .text + +ENTRY(sbrk) +#ifdef PIC + movl #__GLOBAL_OFFSET_TABLE_,a1 + lea pc@(0,a1:l),a1 + movl a1@(curbrk:w),a1 + movl a1@,d0 +#else + movl curbrk,d0 +#endif + addl d0,sp@(4) + movl #SYS_break,d0 + trap #0 + jcs err +#ifdef PIC + movl a1@,d0 + movl sp@(4),a1@ +#else + movl curbrk,d0 + movl sp@(4),curbrk +#endif + rts +err: + jra cerror diff --git a/lib/libc/arch/m68k/sys/setlogin.S b/lib/libc/arch/m68k/sys/setlogin.S new file mode 100644 index 00000000000..c920588781a --- /dev/null +++ b/lib/libc/arch/m68k/sys/setlogin.S @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) + .text + /*.asciz "from: @(#)setlogin.s 5.1 (Berkeley) 5/6/91"*/ + .asciz "$Id: setlogin.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +.globl ___logname_valid /* in getlogin() */ + +SYSCALL(setlogin) +#ifdef PIC + movl #__GLOBAL_OFFSET_TABLE_,a1 + lea pc@(0,a1:l),a1 + movl a1@(___logname_valid:w),a1 + clrl a1@ +#else + clrl ___logname_valid +#endif + rts /* setlogin(name) */ diff --git a/lib/libc/arch/m68k/sys/sigpending.S b/lib/libc/arch/m68k/sys/sigpending.S new file mode 100644 index 00000000000..edced04be19 --- /dev/null +++ b/lib/libc/arch/m68k/sys/sigpending.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: @(#)sigpending.s 5.2 (Berkeley) 8/6/90"*/ + .asciz "$Id: sigpending.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +SYSCALL(sigpending) + movl sp@(4),a0 + movl d0,a0@ + clrl d0 + rts diff --git a/lib/libc/arch/m68k/sys/sigprocmask.S b/lib/libc/arch/m68k/sys/sigprocmask.S new file mode 100644 index 00000000000..66c646e4739 --- /dev/null +++ b/lib/libc/arch/m68k/sys/sigprocmask.S @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * 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: @(#)sigprocmask.s 5.2 (Berkeley) 6/6/90"*/ + .asciz "$Id: sigprocmask.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +ENTRY(sigprocmask) + tstl sp@(8) /* check new sigset pointer */ + jne gotptr /* if not null, indirect */ +/* movl #0,sp@(8) /* null mask pointer: block empty set */ + movl #1,sp@(4) /* SIG_BLOCK */ + jra doit +gotptr: + movl sp@(8),a0 + movl a0@,sp@(8) /* indirect to new mask arg */ +doit: + movl #SYS_sigprocmask,d0 + trap #0 + jcs err + tstl sp@(12) /* test if old mask requested */ + jeq out + movl sp@(12),a0 + movl d0,a0@ /* store old mask */ +out: + clrl d0 + rts +err: + jra cerror diff --git a/lib/libc/arch/m68k/sys/sigreturn.S b/lib/libc/arch/m68k/sys/sigreturn.S new file mode 100644 index 00000000000..0c8ad83bebc --- /dev/null +++ b/lib/libc/arch/m68k/sys/sigreturn.S @@ -0,0 +1,59 @@ +/*- + * 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: @(#)sigreturn.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: sigreturn.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +/* + * We must preserve the state of the registers as the user has set them up. + */ +#ifdef PROF +#undef ENTRY +#define ENTRY(x) \ + .globl _/**/x; .even; _/**/x:; moveml #0xC0C0,sp@-; .data; \ + PROF/**/x:; .long 0; .text; lea PROF/**/x,a0; jbsr mcount; \ + moveml sp@+,#0x0303 +#endif PROF + +ENTRY(sigreturn) + trap #1 /* signals sigreturn() */ + jra cerror diff --git a/lib/libc/arch/m68k/sys/sigsuspend.S b/lib/libc/arch/m68k/sys/sigsuspend.S new file mode 100644 index 00000000000..ba51bfd0002 --- /dev/null +++ b/lib/libc/arch/m68k/sys/sigsuspend.S @@ -0,0 +1,55 @@ +/*- + * 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: @(#)sigsuspend.s 5.2 (Berkeley) 6/6/90"*/ + .asciz "$Id: sigsuspend.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +ENTRY(sigsuspend) + movl sp@(4),a0 + movl a0@,sp@(4) /* indirect to mask arg */ + movl #SYS_sigsuspend,d0 + trap #0 + jcs err + clrl d0 /* shouldn't happen */ + rts +err: + jra cerror diff --git a/lib/libc/arch/m68k/sys/syscall.S b/lib/libc/arch/m68k/sys/syscall.S new file mode 100644 index 00000000000..54d1f94bf10 --- /dev/null +++ b/lib/libc/arch/m68k/sys/syscall.S @@ -0,0 +1,52 @@ +/*- + * 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: @(#)syscall.s 5.1 (Berkeley) 5/12/90"*/ + .asciz "$Id: syscall.S,v 1.1 1995/10/18 08:41:32 deraadt Exp $" +#endif /* LIBC_SCCS and not lint */ + +#include "SYS.h" + +ENTRY(syscall) + clrl d0 + trap #0 + jcs err + rts +err: + jra cerror |