2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 #include <aros/libcall.h>
7 #include <exec/execbase.h>
8 #include <exec/tasks.h>
9 #include <exec/memory.h>
10 #include <exec/ptrace.h>
12 #include "exec_util.h"
14 BOOL
PrepareContext(struct Task
*task
, APTR entryPoint
, APTR fallBack
,
15 const struct TagItem
*tagList
, struct ExecBase
*SysBase
)
19 UBYTE
*sp
= (UBYTE
*)task
->tc_SPReg
;
21 /* Push fallBack address */
23 *(APTR
*)sp
= fallBack
;
25 if (!(task
->tc_Flags
& TF_ETASK
))
28 task
->tc_UnionETask
.tc_ETask
->et_RegFrame
= AllocTaskMem(task
, SIZEOF_ALL_REGISTERS
,
29 MEMF_PUBLIC
|MEMF_CLEAR
);
31 if (!(regs
= (struct pt_regs
*)task
->tc_UnionETask
.tc_ETask
->et_RegFrame
))
35 regs
->pc
= (ULONG
)entryPoint
;