From c773d6e616aa22e6970a00d392a3d86152e619dd Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 7 May 2023 22:32:04 -0300 Subject: [PATCH] x86_64 cpu: enable SSE --- kernel-src/arch/x86-64/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel-src/arch/x86-64/cpu.c b/kernel-src/arch/x86-64/cpu.c index aff4bd7c..f5ee4677 100644 --- a/kernel-src/arch/x86-64/cpu.c +++ b/kernel-src/arch/x86-64/cpu.c @@ -29,4 +29,15 @@ void cpu_initstate() { wrmsr(MSR_LSTAR, (uint64_t)arch_syscall_entry); wrmsr(MSR_CSTAR, 0); // no compatibility mode syscall handler wrmsr(MSR_FMASK, 0x200); // disable interrupts on syscall + + // enable SSE + asm volatile( + "mov %%cr0, %%rax;" + "and $0xFFFB, %%ax;" + "or $2, %%eax;" + "mov %%rax, %%cr0;" + "mov %%cr4, %%rax;" + "or $0b11000000000, %%rax;" + "mov %%rax, %%cr4;" + : : : "rax"); }