2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: StackSwap() - Swap the stack of a task.
9 /*****************************************************************************
12 #include <exec/tasks.h>
13 #include <proto/exec.h>
15 AROS_LH1(void, StackSwap
,
18 AROS_LHA(struct StackSwapStruct
*, sss
, A0
),
21 struct ExecBase
*, SysBase
, 122, Exec
)
24 Changes the stack used by a task. The StackSwapStruct will contain
25 the value of the old stack such that the stack can be reset to the
26 previous version by another call to StackSwap().
28 When the stack is swapped, the data on the stack(s) will not be
29 altered, so the stack may not be set up for you. It is generally
30 required that you replace your stack before exiting from the
31 current stack frame (procedure, function call etc.).
34 sss - A structure containing the values for the upper, lower
35 and current bounds of the stack you wish to use. The
36 values will be replaced by the current values and you
37 can restore the values later.
40 The program will be running on a new stack and sss will contain
43 Calling StackSwap() twice consequtively will effectively do
47 Returning from the function that you call StackSwap() in can have
58 This function MUST be replaced in $(KERNEL) or $(ARCH).
60 ******************************************************************************/
62 /* For an example see the StackSwap() function in either i386 or
65 Note that you must save any state information on the stack that is
66 used in the current process, for example you should really save
69 Note that even if you do save that information, it is not a good
70 idea to return from the procedure that StackSwap() was invoked in
71 as the stack will be quite incorrect.
75 #error The function StackSwap() has not been implemented in the kernel.