2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: PrepareContext() - Prepare a task context for dispatch, m68k version
9 #include <exec/execbase.h>
10 #include <exec/memory.h>
11 #include <utility/tagitem.h>
12 #include <aros/m68k/cpucontext.h>
13 #include <proto/kernel.h>
15 #include "exec_intern.h"
16 #include "exec_util.h"
18 #define _PUSH(sp, val) *--sp = (IPTR)val
20 BOOL
PrepareContext(struct Task
*task
, APTR entryPoint
, APTR fallBack
,
21 const struct TagItem
*tagList
, struct ExecBase
*SysBase
)
25 IPTR
*sp
= task
->tc_SPReg
;
26 struct ExceptionContext
*ctx
;
28 if (!(task
->tc_Flags
& TF_ETASK
))
31 ctx
= KrnCreateContext();
32 task
->tc_UnionETask
.tc_ETask
->et_RegFrame
= ctx
;
38 switch(tagList
->ti_Tag
)
41 tagList
= (const struct TagItem
*)tagList
->ti_Data
;
45 tagList
+= tagList
->ti_Data
;
52 #define HANDLEARG(x) \
53 case TASKTAG_ARG ## x: \
54 args[x - 1] = (IPTR)tagList->ti_Data; \
55 if (x > numargs) numargs = x; \
68 if (tagList
) tagList
++;
72 There is not much to do here, or at least that is how it
73 appears. Most of the work is done in the kernel_cpu.h macros.
78 /* On m68k C function gets all param on stack */
81 _PUSH(sp
, args
[numargs
]);
85 /* First we push the return address */
88 /* Then set up the frame to be used by Dispatch() */
89 ctx
->pc
= (IPTR
)entryPoint
;
93 /* We return the new stack pointer back to the caller. */
97 } /* PrepareContext() */