2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id: runprocess.c 24234 2006-03-27 20:09:51Z verhaegs $
5 Desc: RunProcess() - Run a process from an entry point with args
9 #include <aros/asmcall.h> /* LONG_FUNC */
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <aros/debug.h>
17 /**************************************************************************
20 LONG
AROS_SLIB_ENTRY(RunProcess
,Dos
) (
23 struct Process
* proc
,
24 struct StackSwapStruct
* sss
,
28 struct DosLibrary
* DOSBase
)
31 Sets the stack as specified and calls the routine with the given
35 proc - Process context
37 argptr - Pointer to argument string
38 argsize - Size of the argument string
39 entry - The entry point of the function
40 DOSBase - Pointer to dos.library structure
43 The return value of (*entry)();
55 **************************************************************************/
59 register IPTR
*retptr
= &ret
;
62 oldReturnAddr
= proc
->pr_ReturnAddr
;
64 /* Compute argsize automatically */
67 argsize
= strlen(argptr
);
70 sss
->stk_Pointer
= sss
->stk_Upper
;
73 /* Call the function with the new stack */
75 We have to set the pr_ReturnAddr pointer to the correct value
76 before we call the entry() otherwise some startup code will
79 This can be done rather more easily on the m68k than elsewhere.
82 /* On x86_64 one does not need to use any UFC3R macro! */
84 *retptr
= entry(argptr
,argsize
,SysBase
);
88 proc
->pr_ReturnAddr
= oldReturnAddr
;