hrev43742 adds 1 changeset to branch 'master' old head: eed234ca08eb5b277afae0980729d4af1c14a741 new head: 3f1eed704a8c799a40cc005bf4cb904463148d79 ---------------------------------------------------------------------------- 3f1eed7: kernel: x86 SSE improvements * Prepend x86_ to non-static x86 code * Add x86_init_fpu function to kernel header * Don't init fpu multiple times on smp systems * Verified fpu is still started on smp and non-smp * SSE code still generates general protection faults on smp systems though [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev43742 Commit: 3f1eed704a8c799a40cc005bf4cb904463148d79 URL: http://cgit.haiku-os.org/haiku/commit/?id=3f1eed7 Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Date: Wed Feb 15 18:33:31 2012 UTC ---------------------------------------------------------------------------- 3 files changed, 9 insertions(+), 12 deletions(-) headers/private/kernel/arch/x86/arch_cpu.h | 1 + src/system/kernel/arch/x86/arch_cpu.cpp | 15 ++++++--------- src/system/kernel/arch/x86/arch_smp.cpp | 5 ++--- ---------------------------------------------------------------------------- diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index df9f693..e761292 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 e508513..632c3a2 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 4f4e53a..55e4410 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; }