2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Create an empty usable CPU context, x86_64 version.
9 #include <aros/kernel.h>
10 #include <aros/libcall.h>
12 #include <kernel_base.h>
13 #include <kernel_objects.h>
15 AROS_LH0(void *, KrnCreateContext
,
16 struct KernelBase
*, KernelBase
, 18, Kernel
)
21 struct ExceptionContext
*ctx
;
24 * Allocate common data block and FPU data block in one chunk.
25 * On native ports AROSCPUContext can be simply #define'd to ExceptionContext,
26 * so we refer to struct AROSCPUContext only for size calculation.
27 * Below we rely on the fact that returned address is 16-byte-aligned.
28 * MemChunk is two IPTRs, so this is true.
30 ctx
= krnAllocCPUContext();
33 UBYTE current_xmm
[512+15];
34 UBYTE
*curr
= (UBYTE
*)AROS_ROUNDUP2((IPTR
)current_xmm
, 16);
35 IPTR fpdata
= (IPTR
)ctx
+ AROS_ROUNDUP2(sizeof(struct AROSCPUContext
), 16);
38 ctx
->FXData
= (struct FPXContext
*)fpdata
;
40 /* Set up default values for some registers */
43 /* These definitions may come from machine-specific kernel_cpu.h */
45 ctx
->Flags
|= ECF_SEGMENTS
;
54 /* Init SSE context */
61 ::"r"(curr
), "r"(ctx
->FXData
):"cc");