I can only say that under AmigaOS it would certainly be a no-no:
"When an exception occurs, Exec stops executing the tasks normal code and jumps
immediately into the exception routine, no matter what the task was doing. The
exception routine operates in the same context the task's normal code; it
operates in the CPU's user mode and uses the task's stack."
"Task stacks are normally used to store local variables, subroutine return
addresses, and saved register values. Additionally, when a task loses the
processor, all of its current registers are preserved on this stack (with the
exception of the stack pointer itself, which must be saved in the task
On May 20, 2013, at 6:43 PM, Alexander Burger <a...@software-lab.de> wrote:
> Hi all,
> since nearly three years PicoLisp supports coroutines (64-bit version).
> Now suddenly it occurred to me that the way I implemented them might be
> The problem is how individual stacks for the coroutines are allocated. I
> do this by reserving space on the stack (by decrementing the stack
> pointer) upon starting a new coroutine. Execution of that coroutine may
> be suspended (with 'yield', so that execution continues in the main
> program or some other coroutine), to be resumed later.
> Switching between individual (co)routines is done by moving the stack
> pointer up and down between the corresponding stack frames. Everything
> seems to work fine - though I haven't used coroutines in serious
> projects yet.
> Now I remember to have read that (in POSIX?) no valid data should be
> stored *below* the current position of the stack pointer. Is that really
> the case? I can't find any conclusive information about that.
> This switching between stack frames, as described above, of course
> leaves temporarily suspended stack frames *below* the stack pointer,
> while it points into a higher frame. Does this mean that the operating
> system might dispose or overwrite them? For example, when paging is
> Interrupts are probably not a problem, as they push their contexts on
> the system stack.
> Some sources say that even GCC stores (small amounts of) data below the
> stack pointer, while others (possibly some ABIs from Intel) say this is
> an absolute no-no.
> Can anybody point to a definite answer?
> ♪♫ Alex
> UNSUBSCRIBE: mailto:email@example.com?subject=Unsubscribe