diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index df9f69307c..e76129271e 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -352,6 +352,7 @@ status_t x86_get_mtrr(uint32 index, uint64* _base, uint64* _length, uint8* _type); void x86_set_mtrrs(uint8 defaultType, const x86_mtrr_info* infos, uint32 count); +void x86_init_fpu(); bool x86_check_feature(uint32 feature, enum x86_feature_type type); void* x86_get_double_fault_stack(int32 cpu, size_t* _size); int32 x86_double_fault_get_cpu(void); diff --git a/src/system/kernel/arch/x86/arch_cpu.cpp b/src/system/kernel/arch/x86/arch_cpu.cpp index e508513b24..632c3a26ba 100644 --- a/src/system/kernel/arch/x86/arch_cpu.cpp +++ b/src/system/kernel/arch/x86/arch_cpu.cpp @@ -299,25 +299,25 @@ x86_set_mtrrs(uint8 defaultType, const x86_mtrr_info* infos, uint32 count) } -extern "C" void -init_fpu(void) +void +x86_init_fpu(void) { if (!x86_check_feature(IA32_FEATURE_FPU, FEATURE_COMMON)) { // No FPU... time to install one in your 386? - dprintf("Warning: CPU has no reported FPU.\n"); + dprintf("%s: Warning: CPU has no reported FPU.\n", __func__); gX86SwapFPUFunc = i386_noop_swap; return; } if (!x86_check_feature(IA32_FEATURE_SSE, FEATURE_COMMON) || !x86_check_feature(IA32_FEATURE_FXSR, FEATURE_COMMON)) { - dprintf("CPU has no SSE... just enabling FPU.\n"); + dprintf("%s: CPU has no SSE... just enabling FPU.\n", __func__); // we don't have proper SSE support, just enable FPU x86_write_cr0(x86_read_cr0() & ~(CR0_FPU_EMULATION | CR0_MONITOR_FPU)); gX86SwapFPUFunc = i386_fnsave_swap; return; } - dprintf("CPU has SSE... enabling FXSR and XMM.\n"); + dprintf("%s: CPU has SSE... enabling FXSR and XMM.\n", __func__); // enable OS support for SSE x86_write_cr4(x86_read_cr4() | CR4_OS_FXSR | CR4_OS_XMM_EXCEPTION); @@ -669,7 +669,7 @@ x86_double_fault_get_cpu(void) status_t arch_cpu_preboot_init_percpu(kernel_args *args, int cpu) { - // A simple nop FPU call until init_fpu + // A simple nop FPU call until x86_init_fpu gX86SwapFPUFunc = i386_noop_swap; // On SMP system we want to synchronize the CPUs' TSCs, so system_time() @@ -802,9 +802,6 @@ arch_cpu_init_post_vm(kernel_args *args) DT_DATA_WRITEABLE, DPL_USER); } - // setup FPU and SSE if supported - init_fpu(); - return B_OK; } diff --git a/src/system/kernel/arch/x86/arch_smp.cpp b/src/system/kernel/arch/x86/arch_smp.cpp index 4f4e53a168..55e4410f03 100644 --- a/src/system/kernel/arch/x86/arch_smp.cpp +++ b/src/system/kernel/arch/x86/arch_smp.cpp @@ -33,11 +33,10 @@ # define TRACE(x) ; #endif + static uint32 sCPUAPICIds[B_MAX_CPU_COUNT]; static uint32 sAPICVersions[B_MAX_CPU_COUNT]; -extern "C" void init_fpu(void); - static int32 i386_ici_interrupt(void *data) @@ -108,7 +107,7 @@ arch_smp_per_cpu_init(kernel_args *args, int32 cpu) apic_per_cpu_init(args, cpu); // setup FPU and SSE if supported - init_fpu(); + x86_init_fpu(); return B_OK; }