syscall #17

Merged
xamidev merged 17 commits from syscall into main 2026-04-02 19:16:35 +02:00
Showing only changes of commit e8a0a36889 - Show all commits
+21
View File
@@ -29,6 +29,26 @@ static void x86_overwrite_pat()
wrmsr(0x277, 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 * x86_arch_init - Initialize x86 CPU structures
* *
@@ -42,6 +62,7 @@ static void x86_overwrite_pat()
void x86_arch_init() void x86_arch_init()
{ {
x86_overwrite_pat(); x86_overwrite_pat();
x86_enable_fpu();
x86_cpu_identification(); x86_cpu_identification();
idt_init(); idt_init();
gdt_init(); gdt_init();