/	Copyright (c) 1984, 1986, 1987, 1988 AT&T
/	  All Rights Reserved

/	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
/	The copyright notice above does not evidence any
/	actual or intended publication of such source code.
	.file	"signal.s"

	.ident	"@(#)libc-i386:libc-i386/sys/signal.s	1.3"

	.text

/ Libc signal functions:
/ signal(sig, func);
/ sigset(sig,func);
/ sighold(sig);
/ sigrelse(sig);
/ sigpause(sig);
/ sigignore(sig);
/ int	sig;
/ void	(*func)();

#include	<sys.s>
#define		INKERNEL
#include	<sys/signal.h>
.set		sig_hold,2	/ Can't use header def because of cast

	.globl	signal
	.globl	sighold
	.globl	sigrelse
	.globl	sigpause
	.globl	sigset
	.globl	sigignore
	.globl	_cerror

signal:
	MCOUNT
	movl	$SIGNAL,%eax
	movl	$_sigreturn,%edx
	jmp	.common

sigset:
	MCOUNT
	orl	$SIGDEFER,4(%esp)	/ first param after ret addr
	movl	$SIGNAL,%eax
	movl	$_sigreturn,%edx
	jmp	.common

sigignore:
	MCOUNT
	orl	$SIGIGNORE,4(%esp)	/ first param after ret addr
	movl	$SIGNAL,%eax
	jmp	.common

sigpause:
	MCOUNT
	orl	$SIGPAUSE,4(%esp)	/ first param after ret addr
	movl	$SIGNAL,%eax
	jmp	.common

sigrelse:
	MCOUNT
	orl	$SIGRELSE,4(%esp)	/ first param after ret addr
	movl	$SIGNAL,%eax
	jmp	.common
	
sighold:
	MCOUNT
	orl	$SIGHOLD,4(%esp)	/ first param after ret addr
	movl	$SIGNAL,%eax

.common:				/ actually do the call
	lcall	SYSCALL
	jc	_cerror
	ret

/ The following is used as a return address from user level interrupt
/ catching routines to clear the args from the interrupt routine call.
/ Then it enters the system to do the interrupt return to restore the 
/ stack to the proper state. Its address sent to kernel only on signal
/ sigset.
/ The signal handling is done in the kernel because the floating point
/ emulation is done there also.
/
_sigreturn:
	addl	$4,%esp		/ remove args to user interrupt routine
	lcall	SIGCALL		/ return to kernel to return to user
