1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:17:35 +00:00

Kernel: Save/restore the SSE context on context switch.

This commit is contained in:
Andreas Kling 2019-03-27 15:27:45 +01:00
parent 44e1e7423f
commit e9f2cc3595
4 changed files with 10 additions and 15 deletions

View file

@ -190,14 +190,14 @@ void exception_7_handler(RegisterDump& regs)
if (g_last_fpu_thread == current)
return;
if (g_last_fpu_thread) {
asm volatile("fnsave %0":"=m"(g_last_fpu_thread->fpu_state()));
asm volatile("fxsave %0":"=m"(g_last_fpu_thread->fpu_state()));
} else {
asm volatile("fnclex");
}
g_last_fpu_thread = current;
if (current->has_used_fpu()) {
asm volatile("frstor %0"::"m"(current->fpu_state()));
asm volatile("fxrstor %0"::"m"(current->fpu_state()));
} else {
asm volatile("fninit");
current->set_has_used_fpu(true);