From c37401f23ff9b2200b4ed8a5905f03ae5ffdd6de Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 28 Apr 2010 13:25:29 +0000 Subject: [PATCH] kernel: fpu init to separate function; also move fpu init down moving the fpu code causes exceptions raised by it to be trapped neatly instead of causing a triple fault, before the IDT is initialized. --- kernel/arch/i386/arch_system.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index 486785d4f..67e19f058 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -136,7 +136,7 @@ PRIVATE void tss_init(struct tss_s * tss, void * kernel_stack, *((reg_t *)(tss->sp0 + 1 * sizeof(reg_t))) = cpu; } -PUBLIC void arch_init(void) +PRIVATE void fpu_init(void) { unsigned short cw, sw; @@ -184,7 +184,10 @@ PUBLIC void arch_init(void) osfxsr_feature = 0; return; } +} +PUBLIC void arch_init(void) +{ #ifdef CONFIG_APIC /* * this is setting kernel segments to cover most of the phys memory. The @@ -208,6 +211,7 @@ PUBLIC void arch_init(void) } #endif + fpu_init(); } #define COM1_BASE 0x3F8 -- 2.44.0