Register nameservers dynamically instead of writing them to disk. It is
[AROS.git] / arch / i386-all / kernel / cpu_init.c
blobf555b2d8a0aef1fee154901ed7c2e1c029428002
1 #include <aros/config.h>
2 #include <aros/symbolsets.h>
3 #include <asm/cpu.h>
4 #include <exec/types.h>
5 #include <aros/i386/cpucontext.h>
7 #include "kernel_base.h"
8 #include "kernel_debug.h"
10 #define D(x)
12 #ifndef SIZEOF_8087_FRAME
13 #define SIZEOF_8087_FRAME sizeof(struct FPUContext)
14 #endif
16 static int cpu_Init(struct KernelBase *KernelBase)
18 ULONG v1, v2, v3, v4;
20 D(bug("[Kernel] cpu_Init(0x%p) for i386\n", KernelBase));
22 KernelBase->kb_ContextSize = sizeof(struct AROSCPUContext);
24 /* Evaluate CPU capabilities */
25 asm volatile("cpuid":"=a"(v1),"=b"(v2),"=c"(v3),"=d"(v4):"a"(1));
27 if (v4 & (1 << 24))
29 switch ((v4 >> 25) & 3)
31 case 3:
32 case 2:
33 case 1:
34 /* FPU + SSE */
36 #if (AROS_FLAVOUR & AROS_FLAVOUR_STANDALONE)
37 /* tell the CPU that we will support SSE */
38 wrcr(cr4, rdcr(cr4) | (3 << 9));
39 /* Clear the EM and MP flags of CR0 */
40 wrcr(cr0, rdcr(cr0) & ~6);
41 #endif
43 #ifdef USE_LEGACY_8087
44 KernelBase->kb_ContextFlags = ECF_FPU|ECF_FPX;
45 KernelBase->kb_ContextSize += SIZEOF_8087_FRAME; /* Legacy 8087 frame with private portion */
46 #else
47 KernelBase->kb_ContextFlags = ECF_FPX;
48 #endif
49 KernelBase->kb_ContextSize += sizeof(struct FPXContext) + 15; /* Add 15 bytes for alignment */
50 break;
53 else
55 /* FPU only */
56 KernelBase->kb_ContextFlags = ECF_FPU;
57 KernelBase->kb_ContextSize += SIZEOF_8087_FRAME;
60 D(bug("[Kernel] CPU context flags: 0x%08X\n", KernelBase->kb_ContextFlags));
62 return TRUE;
65 ADD2INITLIB(cpu_Init, 5);