diff --git a/lib/libc/arch/m68k/gen/Makefile.inc b/lib/libc/arch/m68k/gen/Makefile.inc index 0c4f4374e644..4576a1acdb37 100644 --- a/lib/libc/arch/m68k/gen/Makefile.inc +++ b/lib/libc/arch/m68k/gen/Makefile.inc @@ -1,7 +1,6 @@ -# $NetBSD: Makefile.inc,v 1.7 1997/11/04 15:23:23 is Exp $ +# $NetBSD: Makefile.inc,v 1.8 1998/10/05 02:34:18 thorpej Exp $ -SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c modf.S \ - setjmp.S sigsetjmp.S +SRCS+= alloca.S fabs.S frexp.c infinity.c isinf.c modf.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 \ @@ -10,6 +9,10 @@ SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \ negdf2.S negsf2.S subdf3.S subsf3.S truncdfsf2.S udivsi3.S \ umodsi3.S umulsi3.S +SRCS+= setjmp.S __setjmp14.S +SRCS+= _setjmp.S +SRCS+= sigsetjmp.S __sigsetjmp14.S + .ifdef(M68040) SRCS+= ldexp.c .elifdef(M68060) diff --git a/lib/libc/arch/m68k/gen/__setjmp14.S b/lib/libc/arch/m68k/gen/__setjmp14.S new file mode 100644 index 000000000000..641bdf8f81be --- /dev/null +++ b/lib/libc/arch/m68k/gen/__setjmp14.S @@ -0,0 +1,111 @@ +/* $NetBSD: __setjmp14.S,v 1.1 1998/10/05 02:34:18 thorpej Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 + RCSID("from: @(#)setjmp.s 5.1 (Berkeley) 5/12/90") +#else + RCSID("$NetBSD: __setjmp14.S,v 1.1 1998/10/05 02:34:18 thorpej Exp $") +#endif +#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 + */ + +ENTRY(__setjmp14) + /* Get signal stack info. Note overlay of ss_sp and ss_size! */ + subl #12,sp /* sizeof(stack_t) */ + clrl sp@ /* ss = NULL */ + movl sp,sp@(4) /* oss = stack_t on stack */ + jbsr _C_LABEL(__sigaltstack14) + + movl sp@(8),d0 /* ss_flags */ + andl #1,d0 /* extract SS_ONSTACK */ + addl #12,sp /* pop stack_t */ + + /* Get pointer to jmp_buf; a sigcontext is at the beginning. */ + movl sp@(4),a0 + movl d0,a0@ /* store onstack */ + clrl a0@(4) /* unused word (old style signal mask) */ + + /* Get the signal mask. */ + pea a0@(28) /* oset = &sc.sc_mask */ + movl #0,sp@- /* set = NULL */ + movl #0,sp@- /* action = 0 */ + jbsr _C_LABEL(__sigprocmask14) + addl #12,sp + + lea sp@(4),a1 /* adjust SP since we won't rts */ + movl a1,a0@(8) /* save SP */ + movl a6,a0@(12) /* save FP */ + clrl a0@(16) /* no AP */ + movl sp@,a0@(20) /* save return PC */ + clrl a0@(24) /* clear PS */ + + /* Save remaining non-scratch regs after signal mask. */ + moveml #0x3CFC,a0@(44) + + clrl d0 /* return 0 */ + rts + +ENTRY(__longjmp14) + 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@(44),#0x3CFC /* restore non-scratch regs */ + movl a0,sp@- /* let sigreturn */ + jbsr _C_LABEL(__sigreturn14) /* finish for us */ + +botch: + jbsr _C_LABEL(longjmperror) + stop #0 diff --git a/lib/libc/arch/m68k/gen/__sigsetjmp14.S b/lib/libc/arch/m68k/gen/__sigsetjmp14.S new file mode 100644 index 000000000000..f88a4b30a95a --- /dev/null +++ b/lib/libc/arch/m68k/gen/__sigsetjmp14.S @@ -0,0 +1,81 @@ +/* $NetBSD: __sigsetjmp14.S,v 1.1 1998/10/05 02:34:18 thorpej Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 + RCSID("from: @(#)_setjmp.s 5.1 (Berkeley) 5/12/90") +#else + RCSID("$NetBSD: __sigsetjmp14.S,v 1.1 1998/10/05 02:34:18 thorpej Exp $") +#endif +#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. + */ + +/* grab _JBLEN */ +#include + +ENTRY(__sigsetjmp14) + 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 _C_LABEL(_setjmp) +dosig: + jra _C_LABEL(__setjmp14) + + +ENTRY(__siglongjmp14) + movl sp@(4),a0 /* save area pointer */ + tstl a0@(_JBLEN * 4) /* check mask... */ + bne didsig + jra _C_LABEL(_longjmp) +didsig: + jra _C_LABEL(__longjmp14) diff --git a/lib/libc/arch/m68k/sys/__sigreturn14.S b/lib/libc/arch/m68k/sys/__sigreturn14.S new file mode 100644 index 000000000000..2de3ee556f51 --- /dev/null +++ b/lib/libc/arch/m68k/sys/__sigreturn14.S @@ -0,0 +1,63 @@ +/* $NetBSD: __sigreturn14.S,v 1.1 1998/10/05 02:34:19 thorpej Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "SYS.h" + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 + RCSID("from: @(#)sigreturn.s 5.1 (Berkeley) 5/12/90") +#else + RCSID("$NetBSD: __sigreturn14.S,v 1.1 1998/10/05 02:34:19 thorpej Exp $") +#endif +#endif /* LIBC_SCCS and not lint */ + +/* + * We must preserve the state of the registers as the user has set them up. + */ +#ifdef GPROF +#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 /* GPROF */ + +ENTRY(__sigreturn14) + trap #3 /* special sigreturn syscall entry point */ + jra cerror diff --git a/lib/libc/arch/m68k/sys/sigaction.S b/lib/libc/arch/m68k/sys/sigaction.S new file mode 100644 index 000000000000..262841721864 --- /dev/null +++ b/lib/libc/arch/m68k/sys/sigaction.S @@ -0,0 +1,42 @@ +/* $NetBSD: sigaction.S,v 1.1 1998/10/05 02:34:21 thorpej Exp $ */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * 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 NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#include "SYS.h" + +PSEUDO(sigaction,compat_13_sigaction13) diff --git a/lib/libc/arch/m68k/sys/sigpending.S b/lib/libc/arch/m68k/sys/sigpending.S index 9a6bca852889..69efdf23fa6f 100644 --- a/lib/libc/arch/m68k/sys/sigpending.S +++ b/lib/libc/arch/m68k/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $NetBSD: sigpending.S,v 1.2 1995/12/13 22:18:12 thorpej Exp $ */ +/* $NetBSD: sigpending.S,v 1.3 1998/10/05 02:34:21 thorpej Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -43,11 +43,11 @@ #if 0 RCSID("from: @(#)sigpending.s 5.2 (Berkeley) 8/6/90") #else - RCSID("$NetBSD: sigpending.S,v 1.2 1995/12/13 22:18:12 thorpej Exp $") + RCSID("$NetBSD: sigpending.S,v 1.3 1998/10/05 02:34:21 thorpej Exp $") #endif #endif /* LIBC_SCCS and not lint */ -SYSCALL(sigpending) +_SYSCALL(sigpending,compat_13_sigpending13) movl sp@(4),a0 movl d0,a0@ clrl d0 diff --git a/lib/libc/arch/m68k/sys/sigprocmask.S b/lib/libc/arch/m68k/sys/sigprocmask.S index 8fede6c92ef0..05a6a26d09a4 100644 --- a/lib/libc/arch/m68k/sys/sigprocmask.S +++ b/lib/libc/arch/m68k/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $NetBSD: sigprocmask.S,v 1.4 1995/12/13 22:18:14 thorpej Exp $ */ +/* $NetBSD: sigprocmask.S,v 1.5 1998/10/05 02:34:21 thorpej Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -43,7 +43,7 @@ #if 0 RCSID("from: @(#)sigprocmask.s 5.2 (Berkeley) 6/6/90") #else - RCSID("$NetBSD: sigprocmask.S,v 1.4 1995/12/13 22:18:14 thorpej Exp $") + RCSID("$NetBSD: sigprocmask.S,v 1.5 1998/10/05 02:34:21 thorpej Exp $") #endif #endif /* LIBC_SCCS and not lint */ @@ -57,7 +57,7 @@ gotptr: movl sp@(8),a0 movl a0@,sp@(8) /* indirect to new mask arg */ doit: - movl #SYS_sigprocmask,d0 + movl #SYS_compat_13_sigprocmask13,d0 trap #0 jcs err tstl sp@(12) /* test if old mask requested */ diff --git a/lib/libc/arch/m68k/sys/sigreturn.S b/lib/libc/arch/m68k/sys/sigreturn.S index c39c9d4966a0..c5714881371b 100644 --- a/lib/libc/arch/m68k/sys/sigreturn.S +++ b/lib/libc/arch/m68k/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $NetBSD: sigreturn.S,v 1.4 1996/11/30 02:34:51 jtc Exp $ */ +/* $NetBSD: sigreturn.S,v 1.5 1998/10/05 02:34:21 thorpej Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -43,7 +43,7 @@ #if 0 RCSID("from: @(#)sigreturn.s 5.1 (Berkeley) 5/12/90") #else - RCSID("$NetBSD: sigreturn.S,v 1.4 1996/11/30 02:34:51 jtc Exp $") + RCSID("$NetBSD: sigreturn.S,v 1.5 1998/10/05 02:34:21 thorpej Exp $") #endif #endif /* LIBC_SCCS and not lint */ @@ -58,6 +58,9 @@ moveml sp@+,#0x0303 #endif /* GPROF */ +/* + * NOTE: Trap #1 is used for compat_13_sigreturn13 on the m68k! + */ ENTRY(sigreturn) - trap #1 /* signals sigreturn() */ + trap #1 /* signals compat_13_sigreturn13() */ jra cerror diff --git a/lib/libc/arch/m68k/sys/sigsuspend.S b/lib/libc/arch/m68k/sys/sigsuspend.S index ae434da566e2..78fac39c0750 100644 --- a/lib/libc/arch/m68k/sys/sigsuspend.S +++ b/lib/libc/arch/m68k/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $NetBSD: sigsuspend.S,v 1.4 1995/12/13 22:18:18 thorpej Exp $ */ +/* $NetBSD: sigsuspend.S,v 1.5 1998/10/05 02:34:21 thorpej Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -43,14 +43,14 @@ #if 0 RCSID("from: @(#)sigsuspend.s 5.2 (Berkeley) 6/6/90") #else - RCSID("$NetBSD: sigsuspend.S,v 1.4 1995/12/13 22:18:18 thorpej Exp $") + RCSID("$NetBSD: sigsuspend.S,v 1.5 1998/10/05 02:34:21 thorpej Exp $") #endif #endif /* LIBC_SCCS and not lint */ ENTRY(sigsuspend) movl sp@(4),a0 movl a0@,sp@(4) /* indirect to mask arg */ - movl #SYS_sigsuspend,d0 + movl #SYS_compat_13_sigsuspend13,d0 trap #0 jcs err clrl d0 /* shouldn't happen */