2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 #include <exec/execbase.h>
9 #include <exec/memory.h>
10 #include <aros/libcall.h>
11 #include <aros/config.h>
12 #include <proto/exec.h>
14 #include "exec_util.h"
16 #include "exec_debug.h"
18 # define DEBUG_AddTask 0
24 #include <aros/debug.h>
26 /*****************************************************************************
30 AROS_LH3(APTR
, AddTask
,
33 AROS_LHA(struct Task
*, task
, A1
),
34 AROS_LHA(APTR
, initialPC
, A2
),
35 AROS_LHA(APTR
, finalPC
, A3
),
38 struct ExecBase
*, SysBase
, 47, Exec
)
41 Add a new task to the system. If the new task has the highest
42 priority of all and task switches are allowed it will be started
45 You must initialise certain fields, and allocate a stack before
46 calling this function. The fields that must be initialised are:
47 tc_SPLower, tc_SPUpper, tc_SPReg, and the tc_Node structure.
49 If any other fields are initialised to zero, then they will be
50 filled in with the system defaults.
52 The value of tc_SPReg will be used as the location for the stack
53 pointer. You can place any arguments you wish to pass to the Task
54 onto the stack before calling AddTask(). However note that you may
55 need to consider the stack direction on your processor.
57 Memory can be added to the tc_MemEntry list and will be freed when
58 the task dies. The new task's registers are set to 0.
61 task - Pointer to task structure.
62 initialPC - Entry point for the new task.
63 finalPC - Routine that is called if the initialPC() function
64 returns. A NULL pointer installs the default finalizer.
67 The address of the new task or NULL if the operation failed.
80 ******************************************************************************/
86 D(bug("Call AddTask (%08lx (\"%s\"), %08lx, %08lx)\n"
88 , task
->tc_Node
.ln_Name
93 t
= NewAddTask(task
, initialPC
, finalPC
, NULL
);
95 ReturnPtr ("AddTask", struct Task
*, t
);