2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 #include <exec/types.h>
7 #include <aros/libcall.h>
8 #include <exec/execbase.h>
9 #include <exec/tasks.h>
10 #include <exec/memory.h>
11 #include <exec/ptrace.h>
13 #include "exec_util.h"
15 /*****************************************************************************
19 AROS_LH4(BOOL
, PrepareContext
,
22 AROS_LHA(VOLATILE
struct Task
*, task
, A0
),
23 AROS_LHA(APTR
, entryPoint
, A1
),
24 AROS_LHA(APTR
, fallBack
, A2
),
25 AROS_LHA(struct TagItem
*, tagList
, A3
),
28 struct ExecBase
*, SysBase
, 6, Exec
)
31 Allocates the space required to hold a new set of registers on the
32 Stack given by stackPointer and clears the area except for pc which
33 is set to the address given by entryPoint.
36 task - Pointer to the new task
37 entryPoint - Address of the function to call when the new context
39 fallBack - Address to be called when the entryPoint function ended
44 The new Stackpointer with the underlying context.
47 This function is for internal use by exec only.
49 This function is processor dependant.
62 ******************************************************************************/
68 UBYTE
*sp
= (UBYTE
*)task
->tc_SPReg
;
70 /* Push fallBack address */
72 *(APTR
*)sp
= fallBack
;
74 if (!(task
->tc_Flags
& TF_ETASK
)) {
75 *(ULONG
*)0x0bad0001=0;
79 GetIntETask (task
)->iet_Context
= AllocTaskMem ((struct Task
*)task
80 , SIZEOF_ALL_REGISTERS
81 , MEMF_PUBLIC
|MEMF_CLEAR
84 if (!(regs
= (struct pt_regs
*)GetIntETask(task
)->iet_Context
)) {
85 *(ULONG
*)0x0bad0003=0;
90 regs
->pc
= (ULONG
)entryPoint
;