signal()s and stacks and trampoline code
David Keppel
pardo at june.cs.washington.edu
Tue Jun 7 12:50:45 AEST 1988
[ Sorry if this has been around recently ]
[ Please REPLY by mail, I will summarize ]
I'm confused about signals, signal handlers, signal stacks, and
trampoline code. I've been told a bunch of different things (often
quite authoratatively :-) about how various versions of Un*x do it,
and some of the descriptions disagree with some of the other
descriptions. I'd like to know how this gets done on each of "your
favorite" version of Un*x, including BSD 4.3, 4.2, SysV, SunOS, Ultrix
(presumed like 4.2), Xenix, ...
Here is my (mis)understanding of what happens on 4.3BSD; please don't
think that I believe this to be the one true way, rather I want to
know where this isn't true.
+ Kernel decides to deliver a signal.
+ The kernel pushes a few instructions, called _trampoline_code_ on to
the stack.
+ The kernel transfers control to the trampoline code.
+ The trampoline code invokes the signal handler.
+ The call frame for the signal handler is pushed onto a seperate
(seperate from the standard stack) "signal stack".
+ The signal hander executes.
+ The signal handler returns, restoring the normal sp, fp, ap, ...
At the same time, the pc is set to the return point in the
trampoline code.
+ The trampoline code traps to the kernel.
+ The kernel cleans the trampoline code off of the stack.
This seems pretty wierd to me. Can somebody illuminate?
(E-mail, please. Advance thanks!)
;-D on ( coming soon to a signal stack near you ) Pardo
pardo at cs.washington.edu pardo at june.cs.washington.edu
...!{rutgers,cornell,ucsd,ubc-cs,textronix}!uw-june!pardo
More information about the Comp.unix.wizards
mailing list