lcms2.library: fixed strict aliasing issue detected with gcc 4.8.3
[AROS.git] / arch / ppc-all / kernel / createcontext.c
blob93cd0e532df81dc1a6a532457d635332039bdf0c
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/kernel.h>
7 #include <aros/libcall.h>
9 #include <kernel_base.h>
10 #include <kernel_objects.h>
12 AROS_LH0I(void *, KrnCreateContext,
13 struct KernelBase *, KernelBase, 18, Kernel)
15 AROS_LIBFUNC_INIT
17 struct ExceptionContext *ctx;
19 /* Allocate a new context */
20 ctx = krnAllocCPUContext();
22 /* Initialize the context */
23 if (ctx)
25 ULONG i;
28 * Sys V PPC ABI says r2 is reserved for TOC or SDATA2.
29 * Here we copy the current value and it will never be
30 * changed again. It is not needed for AROS but can be
31 * needed for host OS. It is known to be needed for Linux
32 * and won't harm anywhere else.
34 __asm__ __volatile__ ("stw 2,%0":"=m"(ctx->gpr[2])::"memory");
36 /* Initialize FPU portion */
37 ctx->Flags = ECF_FPU;
38 for (i = 0; i < 32; i++)
39 ctx->fpr[i] = 0.0;
42 return ctx;
44 AROS_LIBFUNC_EXIT