Signal changes for Alpha.

This commit is contained in:
thorpej 1998-09-29 03:01:37 +00:00
parent 3712546023
commit 2af42e072f
9 changed files with 281 additions and 11 deletions

View File

@ -1,6 +1,8 @@
# $NetBSD: Makefile.inc,v 1.3 1995/04/29 05:09:14 cgd Exp $
# $NetBSD: Makefile.inc,v 1.4 1998/09/29 03:01:37 thorpej Exp $
SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c setjmp.S
SRCS+= fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
SRCS+= sigsetjmp.S
SRCS+= _setjmp.S
SRCS+= setjmp.S __setjmp14.S
SRCS+= sigsetjmp.S __sigsetjmp14.S

View File

@ -0,0 +1,125 @@
/* $NetBSD: __setjmp14.S,v 1.1 1998/09/29 03:01:37 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
/*
* 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 the previous signal state.
*/
.set noreorder
LEAF(__setjmp14, 1)
LDGP(pv)
stq ra, (2 * 8)(a0) /* sc_pc = return address */
stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
stq s1, ((10 + 4) * 8)(a0)
stq s2, ((11 + 4) * 8)(a0)
stq s3, ((12 + 4) * 8)(a0)
stq s4, ((13 + 4) * 8)(a0)
stq s5, ((14 + 4) * 8)(a0)
stq s6, ((15 + 4) * 8)(a0)
stq ra, ((26 + 4) * 8)(a0)
stq sp, ((30 + 4) * 8)(a0)
/*
* get signal information
*/
mov a0, s0 /* squirrel away ptr to sc */
/* see what's blocked */
mov zero, a0 /* how (insignificant) */
mov zero, a1 /* set (NULL) */
lda a2, 648(s0) /* point to mask in sc */
CALL(__sigprocmask14)
lda sp, -24(sp) /* sizeof struct sigaltstack */
mov zero, a0
mov sp, a1
CALL(__sigaltstack14)
ldl t0, 16(sp) /* offset of ss_flags */
lda sp, 24(sp) /* sizeof struct sigaltstack */
ldq ra, ((26 + 4) * 8)(s0) /* restore return address */
blt v0, botch /* check for error */
and t0, 0x1, t0 /* get SA_ONSTACK flag */
stq t0, (0 * 8)(s0) /* and save it in sc_onstack */
/*
* Restore old s0 and a0, and continue saving registers
*/
mov s0, a0
ldq s0, (( 9 + 4) * 8)(a0)
ldiq t0, 0xacedbade /* sigcontext magic number */
stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
/* Too bad we can't check if we actually used FP */
ldiq t0, 1
stq t0, (36 * 8)(a0) /* say we've used FP. */
stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
stt fs1, ((3 + 37) * 8)(a0)
stt fs2, ((4 + 37) * 8)(a0)
stt fs3, ((5 + 37) * 8)(a0)
stt fs4, ((6 + 37) * 8)(a0)
stt fs5, ((7 + 37) * 8)(a0)
stt fs6, ((8 + 37) * 8)(a0)
stt fs7, ((9 + 37) * 8)(a0)
mf_fpcr ft0 /* get FP control reg */
stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */
stq zero, (70 * 8)(a0) /* FP software control XXX */
stq zero, (71 * 8)(a0) /* sc_reserved[0] */
stq zero, (72 * 8)(a0) /* sc_reserved[1] */
stq zero, (73 * 8)(a0) /* sc_xxx[0] */
stq zero, (74 * 8)(a0) /* sc_xxx[1] */
stq zero, (75 * 8)(a0) /* sc_xxx[2] */
stq zero, (76 * 8)(a0) /* sc_xxx[3] */
stq zero, (77 * 8)(a0) /* sc_xxx[4] */
stq zero, (78 * 8)(a0) /* sc_xxx[5] */
stq zero, (79 * 8)(a0) /* sc_xxx[6] */
stq zero, (80 * 8)(a0) /* sc_xxx[7] */
mov zero, v0 /* return zero */
RET
END(__setjmp14)
LEAF(__longjmp14, 2)
LDGP(pv)
stq a1, (( 0 + 4) * 8)(a0) /* save return value */
CALL(__sigreturn14) /* use sigreturn to return */
botch:
CALL(longjmperror)
CALL(abort)
RET /* "can't" get here... */
END(__longjmp14)

View File

@ -0,0 +1,62 @@
/* $NetBSD: __sigsetjmp14.S,v 1.1 1998/09/29 03:01:37 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
/*
* C library -- sigsetjmp, siglongjmp
*
* siglongjmp(a,v)
* will generate a "return(v)" from
* the last call to
* sigsetjmp(a, mask)
* by restoring registers from the stack.
* If `mask' is non-zero, the previous signal
* state will be restored.
*/
.set noreorder
LEAF(__sigsetjmp14, 2)
LDGP(pv)
stq a1, (83 * 8)(a0) /* save the mask */
bne a1, Lsavesig /* if !zero, save signals */
jmp zero, _setjmp /* else don't. */
Lsavesig:
jmp zero, __setjmp14
END(__sigsetjmp14)
LEAF(__siglongjmp14, 2)
LDGP(pv)
ldq t0, (83 * 8)(a0) /* get the mask */
bne t0, Lrestoresig /* if !zero, restore signals */
jmp zero, _longjmp
Lrestoresig:
jmp zero, __longjmp14
END(__siglongjmp14)

View File

@ -0,0 +1,38 @@
/* $NetBSD: __sigreturn14.S,v 1.1 1998/09/29 03:01:38 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
* However, that doesn't involve any special work on the Alpha.
* (XXX PROFILING)
*/
RSYSCALL(__sigreturn14)

View File

@ -0,0 +1,42 @@
/* $NetBSD: sigaction.S,v 1.1 1998/09/29 03:01:38 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigpending.S,v 1.1 1995/02/10 17:50:40 cgd Exp $ */
/* $NetBSD: sigpending.S,v 1.2 1998/09/29 03:01:38 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -29,7 +29,8 @@
#include "SYS.h"
SYSCALL(sigpending)
LEAF(sigpending,0) /* XXX # of args? */
CALLSYS_ERROR(compat_13_sigpending13)
stl v0, 0(a0)
mov zero, v0
RET

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigprocmask.S,v 1.2 1996/10/17 03:08:21 cgd Exp $ */
/* $NetBSD: sigprocmask.S,v 1.3 1998/09/29 03:01:38 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -34,7 +34,7 @@ LEAF(sigprocmask, 3)
cmoveq a1, 1, a0 /* if set == NULL, how = SIG_BLOCK */
beq a1, Ldoit /* and set = 0, and do it. */
ldl a1, 0(a1) /* load the set from *set */
Ldoit: CALLSYS_ERROR(sigprocmask)
Ldoit: CALLSYS_ERROR(compat_13_sigprocmask13)
beq a5, Lret /* if they don't want old mask, done */
stl v0, 0(a5) /* otherwise, give it to them. */
Lret: mov zero, v0

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigreturn.S,v 1.1 1995/02/10 17:50:42 cgd Exp $ */
/* $NetBSD: sigreturn.S,v 1.2 1998/09/29 03:01:38 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -35,4 +35,4 @@
* (XXX PROFILING)
*/
RSYSCALL(sigreturn)
PSEUDO(sigreturn,compat_13_sigreturn13)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigsuspend.S,v 1.2 1996/10/17 03:08:22 cgd Exp $ */
/* $NetBSD: sigsuspend.S,v 1.3 1998/09/29 03:01:38 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -31,7 +31,7 @@
LEAF(sigsuspend, 1)
ldl a0, 0(a0) /* pass *mask instead of mask */
CALLSYS_ERROR(sigsuspend)
CALLSYS_ERROR(compat_13_sigsuspend13)
mov zero, v0 /* shouldn't need; just in case... */
RET
END(sigsuspend)