revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-mac / exec / preparecontext.c
blobbb81a02b955601fb1ef79bf59d6e919fef78b556
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
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)
17 struct pt_regs *regs;
19 UBYTE *sp = (UBYTE *)task->tc_SPReg;
21 /* Push fallBack address */
22 sp -= sizeof(APTR);
23 *(APTR *)sp = fallBack;
25 if (!(task->tc_Flags & TF_ETASK))
26 return FALSE;
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))
32 return FALSE;
34 regs->usp = sp;
35 regs->pc = (ULONG)entryPoint;
37 task->tc_SPReg = sp;
39 return TRUE;