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 //#error "PrepareContext() has been changed. Additional tagList param, etc."
16 //#error "This one here needs to be rewritten!"
18 /*****************************************************************************
22 AROS_LH4(BOOL
, PrepareContext
,
25 AROS_LHA(struct Task
*, task
, A0
),
26 AROS_LHA(APTR
, entryPoint
, A1
),
27 AROS_LHA(APTR
, fallBack
, A2
),
28 AROS_LHA(struct TagItem
*, tagList
, A3
),
31 struct ExecBase
*, SysBase
, 6, Exec
)
34 Allocates the space required to hold a new set of registers on the
35 Stack given by stackPointer and clears the area except for pc which
36 is set to the address given by entryPoint.
39 task - Pointer to the new task
40 entryPoint - Address of the function to call when the new context
42 fallBack - Address to be called when the entryPoint function ended
47 The new Stackpointer with the underlying context.
50 This function is for internal use by exec only.
52 This function is processor dependant.
65 ******************************************************************************/
71 UBYTE
*sp
= (UBYTE
*)task
->tc_SPReg
;
73 /* Push fallBack address */
75 *(APTR
*)sp
= fallBack
;
77 if (!(task
->tc_Flags
& TF_ETASK
)) {
78 *(ULONG
*)0x0bad0001=0;
82 GetIntETask (task
)->iet_Context
= AllocTaskMem (task
83 , SIZEOF_ALL_REGISTERS
84 , MEMF_PUBLIC
|MEMF_CLEAR
87 if (!(regs
= (struct pt_regs
*)GetIntETask(task
)->iet_Context
)) {
88 *(ULONG
*)0x0bad0003=0;
93 regs
->pc
= (ULONG
)entryPoint
;