prism2.device: Compiler delint
[AROS.git] / arch / ppc-all / kernel / createcontext.c
blobcd33d37e277d945bbd53f37d02f560602bd167ff
1 #include <aros/kernel.h>
2 #include <aros/libcall.h>
4 #include <kernel_base.h>
5 #include <kernel_objects.h>
7 AROS_LH0I(void *, KrnCreateContext,
8 struct KernelBase *, KernelBase, 18, Kernel)
10 AROS_LIBFUNC_INIT
12 struct ExceptionContext *ctx;
14 /* Allocate a new context */
15 ctx = krnAllocCPUContext();
17 /* Initialize the context */
18 if (ctx)
20 ULONG i;
23 * Sys V PPC ABI says r2 is reserved for TOC or SDATA2.
24 * Here we copy the current value and it will never be
25 * changed again. It is not needed for AROS but can be
26 * needed for host OS. It is known to be needed for Linux
27 * and won't harm anywhere else.
29 __asm__ __volatile__ ("stw 2,%0":"=m"(ctx->gpr[2])::"memory");
31 /* Initialize FPU portion */
32 ctx->Flags = ECF_FPU;
33 for (i = 0; i < 32; i++)
34 ctx->fpr[i] = 0.0;
37 return ctx;
39 AROS_LIBFUNC_EXIT