revert between 56095 -> 55830 in arch
[AROS.git] / arch / .unmaintained / m68k-pp-native / exec / preparecontext.c
blob87ea55a59f254e2550aea30ab356db529c0181a5
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/execbase.h>
7 #include <exec/tasks.h>
8 #include <exec/memory.h>
9 #include <exec/ptrace.h>
11 #include "exec_util.h"
13 BOOL PrepareContext(struct Task *task, APTR entryPoint, APTR fallBack,
14 struct TagItem *tagList, struct ExecBase *SysBase)
16 struct pt_regs *regs;
17 UBYTE *sp = (UBYTE *)task->tc_SPReg;
19 /* Push fallBack address */
20 sp -= sizeof(APTR);
21 *(APTR *)sp = fallBack;
23 if (!(task->tc_Flags & TF_ETASK))
25 *(ULONG *)0x0bad0001=0;
26 return FALSE;
29 task->tc_UnionETask.tc_ETask->et_RegFrame = AllocTaskMem(task, SIZEOF_ALL_REGISTERS,
30 MEMF_PUBLIC|MEMF_CLEAR);
32 if (!(regs = (struct pt_regs *)task->tc_UnionETask.tc_ETask->et_RegFrame))
34 *(ULONG *)0x0bad0003=0;
35 return FALSE;
38 regs->usp = sp;
39 regs->pc = (ULONG)entryPoint;
41 task->tc_SPReg = sp;
43 return TRUE;