use the override options if specified
[AROS.git] / rom / kernel / createcontext.c
blobaae7b9010755fd4d847ef81964342caf69a72f31
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 */
8 #include <aros/kernel.h>
9 #include <aros/libcall.h>
11 #include <kernel_base.h>
12 #include <kernel_cpu.h>
13 #include <kernel_objects.h>
15 /*****************************************************************************
17 NAME */
18 #include <proto/kernel.h>
20 AROS_LH0(void *, KrnCreateContext,
22 /* SYNOPSIS */
24 /* LOCATION */
25 struct KernelBase *, KernelBase, 18, Kernel)
27 /* FUNCTION
28 Allocate and initialize CPU context storage area.
30 INPUTS
31 None.
33 RESULT
34 A pointer to a CPU context storage area.
36 NOTES
37 CPU context storage is considered private and accessible
38 only from within supevisor mode.
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 KrnDeleteContext()
47 INTERNALS
49 ******************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct AROSCPUContext *ctx;
54 cpumode_t mode = goSuper();
56 /* Our context is accessible only in supervisor mode */
57 ctx = krnAllocCPUContext();
59 /* Initialize the storage if needed */
60 #ifdef PREPARE_INITIAL_CONTEXT
61 if (ctx)
62 PREPARE_INITIAL_CONTEXT(ctx);
63 #endif
65 goBack(mode);
67 return ctx;
69 AROS_LIBFUNC_EXIT