added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / m68k-native / exec / runprocess.s
blob0c5480e49dab7a7557fac78b06b9b43e9efbef7b
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Run a process ( invoked by dos/Runcommand() )
7 LONG RunProcess ( struct Process * proc,
8 struct StackSwapStruct * sss,
9 STRPTR argptr,
10 ULONG argsize,
11 LONG_FUNC entry,
12 struct DosLibrary * DOSBase
15 #include "machine.i"
17 # Stackframe
18 FirstArg = 4+(2*4) /* Return-address + registers */
19 proc = FirstArg
20 sss = proc+4
21 argptr = sss+4
22 argsize = argptr+4
23 entry = argsize+4
24 DOSBase = entry+4
26 .text
27 .balign 4
28 .globl AROS_SLIB_ENTRY(RunProcess,Dos)
29 .type AROS_SLIB_ENTRY(RunProcess,Dos),@function
30 AROS_SLIB_ENTRY(RunProcess,Dos):
31 movem.l a5-a6,-(sp) /* Save some registers */
33 move.l sss(sp),a0 /* Fetch the arguments off the stack */
34 move.l entry(sp),a5 /* " " " " " " */
36 move.l stk_Upper(a0),a1 /* Move upper bounds of the new stack into a1 */
37 move.l a0,-(a1) /* Push sss onto the new stack */
38 move.l DOSBase(sp),a6 /* Get SysBase */
39 move.l dl_SysBase(a6),a6 /* " " */
40 move.l a6,-(a1) /* Push SysBase onto the new stack */
41 move.l a1,stk_Pointer(a0) /* Store Switch Point in sss */
43 jsr StackSwap(a6) /* Switch stacks (a0=sss) */
45 jsr (a5) /* Call the specified routine */
46 move.l d0,a5 /* Save return value */
48 move.l (sp)+,a6 /* Pop SysBase off the new stack */
49 move.l (sp)+,a0 /* Pop sss off the new stack */
50 jsr StackSwap(a6) /* Switch stacks back */
52 move.l a5,d0 /* Put result in d0 where our caller expects it */
54 movem.l (sp)+,a5-a6 /* Restore registers */
55 rts