Subject: Re: Performance tweak for m68k signal delivery
To: None <thorpej@wasabisystems.com>
From: ITOH Yasufumi <itohy@netbsd.org>
List: port-m68k
Date: 07/03/2002 20:46:48
Just comment.
Jason R Thorpe writes:
> Attached is a patch to make the kernel directly invoke a signal handler,
> rather than bouncing through the signal trampoline. Now, the trampoline
> is used only to return from the signal. The net result is to save a few
> instructions during signal delivery.
The pointer to "struct sigcontext" already in sigframe when sending
a signal, and we can reuse it.
This saves 6 bytes in the trampoline.
> 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)