Enable FPU
This commit is contained in:
@@ -29,6 +29,26 @@ static void x86_overwrite_pat()
|
||||
wrmsr(0x277, pat);
|
||||
}
|
||||
|
||||
/*
|
||||
* x86_enable_fpu - Enable Floating Point Unit
|
||||
*
|
||||
* This function enables the Floating Point Unit,
|
||||
* which allows the CPU to do floating point
|
||||
* operations.
|
||||
*
|
||||
* Here we do not check for FPU support but we
|
||||
* should. However most processors support it.
|
||||
*/
|
||||
static void x86_enable_fpu()
|
||||
{
|
||||
size_t cr4;
|
||||
__asm__ volatile("mov %%cr4, %0" : "=r"(cr4));
|
||||
cr4 |= 0x200;
|
||||
__asm__ volatile("mov %0, %%cr4" :: "r"(cr4));
|
||||
uint16_t cw = 0x37F;
|
||||
asm volatile("fldcw %0" :: "m"(cw));
|
||||
}
|
||||
|
||||
/*
|
||||
* x86_arch_init - Initialize x86 CPU structures
|
||||
*
|
||||
@@ -42,6 +62,7 @@ static void x86_overwrite_pat()
|
||||
void x86_arch_init()
|
||||
{
|
||||
x86_overwrite_pat();
|
||||
x86_enable_fpu();
|
||||
x86_cpu_identification();
|
||||
idt_init();
|
||||
gdt_init();
|
||||
|
||||
Reference in New Issue
Block a user