Skip to content

Commit

Permalink
cpu: enable SSE
Browse files Browse the repository at this point in the history
  • Loading branch information
mosmeh committed Sep 22, 2024
1 parent c1e58fb commit 300e01e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ static void detect_features(struct cpu* cpu) {
static void init_cpu(struct cpu* cpu) {
detect_features(cpu);

if (cpu_has_feature(cpu, X86_FEATURE_XMM)) {
ASSERT(cpu_has_feature(cpu, X86_FEATURE_FXSR));

uint32_t cr0 = read_cr0();
cr0 &= ~X86_CR0_EM;
cr0 |= X86_CR0_MP;
write_cr0(cr0);

uint32_t cr4 = read_cr4();
cr4 |= X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT;
write_cr4(cr4);
}

if (cpu_has_feature(cpu, X86_FEATURE_PGE)) {
uint32_t cr4 = read_cr4();
cr4 |= X86_CR4_PGE;
Expand Down

0 comments on commit 300e01e

Please sign in to comment.