revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / newstackswap.c
blobdd61f1f4ef7291824ec818119f09df11a615604b
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: NewStackSwap() - Call a function with swapped stack.
6 Lang: english
7 */
9 /*****************************************************************************
11 NAME */
12 #include <exec/tasks.h>
13 #include <proto/exec.h>
15 AROS_LH3(IPTR, NewStackSwap,
17 /* SYNOPSIS */
18 AROS_LHA(struct StackSwapStruct *, sss, A0),
19 AROS_LHA(LONG_FUNC, entry, A1),
20 AROS_LHA(struct StackSwapArgs *, args, A2),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 134, Exec)
25 /* FUNCTION
26 Calls a function with a new stack.
28 INPUTS
29 sss - A structure containing the values for the upper, lower
30 and current bounds of the stack you wish to use.
31 entry - Address of the function to call.
32 args - A structure (actually an array) containing up to 8
33 function arguments. May be NULL.
35 RESULT
36 The value returned by your function.
38 NOTES
39 This function is mostly compatible with MorphOS's NewPPCStackSwap()
40 function.
42 EXAMPLE
44 BUGS
45 Do not attempt to pass in a prebuilt stack - it will be erased.
47 SEE ALSO
48 StackSwap()
50 INTERNALS
51 This function MUST be replaced in $(KERNEL) or $(ARCH).
53 ******************************************************************************/
55 AROS_LIBFUNC_INIT
57 /* For an example see the NewStackSwap() function in either i386 or
58 m68k-native.
60 Note that you must save any state information on the stack that is
61 used in the current process, for example you should really save
62 return addresses.
64 Note that even if you do save that information, it is not a good
65 idea to return from the procedure that StackSwap() was invoked in
66 as the stack will be quite incorrect.
69 #ifndef __CXREF__
70 #error The function NewStackSwap() has not been implemented in the kernel.
71 #endif
73 return 0;
75 AROS_LIBFUNC_EXIT
76 } /* NewStackSwap() */