[comp.sys.encore] Signal Handlers

jb@CS.BROWN.EDU (08/08/88)

> 1. Why are only registers r0, r1 and r2 saved. Can I assume that the
>    other registers are left untouched?

You can assume the registers are left untouched.  The reason for this
is that the entry code for a subroutine generated by the C compiler
saves register r3 - r7 if it uses them and then restores them afterwards.
If you are writing your own signal handler in assembly, make sure that
you save any of these registers that you use.  The C compiler assumes
that r0 - r2 are scratch.  This means that those registers need to be
saved in some other way.

> 2. Although the comment above says that the context is restored following
>    the execution of the handler, some experiments have shown that the
>    registers r0 - r7 are available (in pre signal condition) even during
>    the execution of the handler. Is it safe to rely on this?

I wouldn't rely on this behavior if you can't find it in the doc someplace.
It depends entirely on what the kernel code does for handling a signal.
Even if it is safe at the moment, I wouldn't trust anyone to leave it that
way in the next release.  It is the type of thing that will break without
anyone thinking about it in a future release.

					Jim