x86-64: properly set up x87 state

This commit is contained in:
Matheus
2024-04-21 20:17:18 -03:00
parent 899186ea85
commit a8bdb6e1ad
2 changed files with 17 additions and 2 deletions
+9
View File
@@ -40,4 +40,13 @@ void cpu_initstate() {
"or $0b11000000000, %%rax;"
"mov %%rax, %%cr4;"
: : : "rax");
// set NE in cr0 and reset x87 fpu
asm volatile(
"fninit;"
"mov %%cr0, %%rax;"
"or $0b100000, %%rax;"
"mov %%rax, %%cr0;"
: : : "rax"
);
}