.gitignore: Update
[AROS.git] / rom / kernel / createcontext.c
blobea521a4dc6ce7c3efeff7164c3a1cfe5028a6125
1 #include <aros/kernel.h>
2 #include <aros/libcall.h>
4 #include <kernel_base.h>
5 #include <kernel_cpu.h>
6 #include <kernel_objects.h>
8 /*****************************************************************************
10 NAME */
11 #include <proto/kernel.h>
13 AROS_LH0(void *, KrnCreateContext,
15 /* SYNOPSIS */
17 /* LOCATION */
18 struct KernelBase *, KernelBase, 18, Kernel)
20 /* FUNCTION
21 Allocate and initialize CPU context storage area.
23 INPUTS
24 None.
26 RESULT
27 A pointer to a CPU context storage area.
29 NOTES
30 CPU context storage is considered private and accessible
31 only from within supevisor mode.
33 EXAMPLE
35 BUGS
37 SEE ALSO
38 KrnDeleteContext()
40 INTERNALS
42 ******************************************************************************/
44 AROS_LIBFUNC_INIT
46 struct AROSCPUContext *ctx;
47 cpumode_t mode = goSuper();
49 /* Our context is accessible only in supervisor mode */
50 ctx = krnAllocCPUContext();
52 /* Initialize the storage if needed */
53 #ifdef PREPARE_INITIAL_CONTEXT
54 if (ctx)
55 PREPARE_INITIAL_CONTEXT(ctx);
56 #endif
58 goBack(mode);
60 return ctx;
62 AROS_LIBFUNC_EXIT