Subject: Re: Performance tweak for m68k signal delivery
To: None <port-m68k@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-m68k
Date: 07/03/2002 07:58:55
On Wed, Jul 03, 2002 at 08:46:48PM +0900, ITOH Yasufumi wrote:

 > The pointer to "struct sigcontext" already in sigframe when sending
 > a signal, and we can reuse it.
 > This saves 6 bytes in the trampoline.

Yes.  But is the handler allowed to clobber its argument slots?  If so,
then the address of the sigcontext must be recomputed.

 > 
 > > 		signal context structure
 > > 	------------------------------------------------------------
 > > 		pointer to sigcontext structure			[12]
 > > 		signal specific code				[8]
 > > 		signal number					[4]
 > > 	SP->	return address (address of signal trampoline)	[0]
 > 
 > Data structure description in decreasing address order is
 > rather too hard to read (to me). :)
 > 
 > 
 > Suggested sigcode:
 > 
 > /*
 >  * Signal trampoline; copied to top of user stack.
 >  *
 >  * The handler has returned here as if we had called it.  On
 >  * entry, the stack looks like:
 >  *
 >  *	sp+0	->	signal number
 >  *	sp+4		signal specific code
 >  *	sp+8		pointer to signal context frame (scp)
 >  *	sp+12		saved hardware state
 >  *			(including signal context frame)
 >  *				.
 >  *				.
 >  *				.
 >  */
 > 
 > 	.data
 > 	.align	2
 > GLOBAL(sigcode)
 > 	addql	#4,%sp		| pop signal number		(2 bytes)
 > 	trap	#3		| special sigreturn trap	(2 bytes)
 > 	movl	%d0,%sp@(4)	| save errno			(4 bytes)
 > 	moveq	#SYS_exit,%d0	| syscall == exit		(2 bytes)
 > 	trap	#0		| exit(errno)			(2 bytes)
 > 	.align	2
 > GLOBAL(esigcode)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>