aros/m68k/fpucontext.h: Remove dependence on _fpmath.h
[AROS.git] / rom / exec / newstackswap.c
blob5cf85557028984860ceaad22047edd3caf50756a
1 /*
2 Copyright © 1995-2009, 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
35 RESULT
36 A value actually returned by your function. The function will be
37 running on a new stack.
39 NOTES
41 EXAMPLE
43 BUGS
44 Do not attempt to pass in a prebuilt stack - it will be erased.
46 SEE ALSO
47 StackSwap()
49 INTERNALS
50 This function MUST be replaced in $(KERNEL) or $(ARCH).
52 ******************************************************************************/
54 AROS_LIBFUNC_INIT
56 /* For an example see the NewStackSwap() function in either i386 or
57 m68k-native.
59 Note that you must save any state information on the stack that is
60 used in the current process, for example you should really save
61 return addresses.
63 Note that even if you do save that information, it is not a good
64 idea to return from the procedure that StackSwap() was invoked in
65 as the stack will be quite incorrect.
68 #ifndef __CXREF__
69 #error The function NewStackSwap() has not been implemented in the kernel.
70 #endif
72 return 0;
74 AROS_LIBFUNC_EXIT
75 } /* NewStackSwap() */