Re: goto across functions/isrs?




Vladimir Vassilevsky wrote:

Here is another solution: run the processing loop as the very bottom
task in the SST, and run everything else as the different SST tasks. In
this case, one can alter the context of main() while keepeng everything
else alive. This requires hacking of the stack frame.


One of the responses in this thread did make me think that you could
arrange the ISR to load the stack with just the right evil combination
of stuff such that when you hit the 'iret' instruction you'd be in
main() right before the while loop.

That would be difficult if there are any other interrupts and tasks.
Also it is very position dependent.

That's why I suggested hacking the stack frame to insert a call to a
signal handler instead. The signal handler has a well defined label, so
there are no position dependency issues. For maximum flexibility, the
handler could even be registered at run-time.

On a multitasking system, it is possible to rewrite the stack frame of
a particular task, rather than the interrupted one. You can even stack
multiple signals for the same task. A bitmask in the task struct could
be used to avoid duplicates.

.