[comp.unix.xenix] In-Task Context Switching

goof@quiche.cs.mcgill.ca (Paul LOSORDO) (10/27/89)

	I'm trying to implement a process scheduler. What I want to do
is have SIGALRM call up my own context switch and scheduling algorithm 
such that I can select which process ( each having it's own machine
state structure ) will be running in the current task.

I have a version of that scheduler working fine when each process calls
the scheduler voluntarily, but I am having a problem with automating the
thing  using signals. It seems that the signal 'mapper' doesn't context 
switch to your private signal handler but rather calls it after saving
( I hope ! ) the register on its own. What that means is that the return
address and the flags are definitely wrong on entry to my handler and
that the registers are probably different too ( I have to test that
hypothesis ). There may also be some other stuff piled on the stack for
signal() internal use. Since signal() is linked to my code, I assume
that everything is pushed on my stack and not somewhere in the kernel.

	Now, does anyone have an idea what and in what order signal()
pushes its stuff on the stack ? My only avenue at this moment is to set
specific values in the registers and examine the stack after a signal to
try to deduce what is pushed... A bit lo-tech and time-consuming...

	Any comments ?