On May 21, 2013, at 6:56 AM, Alexander Burger <a...@software-lab.de> wrote:
> They talk about "task stacks" and "preserved on this stack". I assume
> that these "stacks" all reside on the single hardware stack, right? So
> there is a stack *frame* for each task, and this frame might also be
> used to save exception context. That's all right.
Each task has a different stack using a single user-mode stack pointer. In
Amiga there is no memory protection, a context switch just involves saving the
registers in the stack, saving the stack pointer itself in the stack structure,
restoring the stack pointer of the next task and returning to it in a way that
restores the registers.
> It seems not forbidden, however, to allocate several frames below each
> other, where the active stack pointer points into some upper frame,
> right? That's the problem I'm talking about.
I thought you were talking about micro stacks. If your stacks are 1 Mb I guess
there won't be any problem.
If at some point you face problems on a system that happens to unmap stack
pages (I doubt it), you can probably workaround it by marking the stack pages
with mlock() or similar.