Kernel: Optimize sse saving/loading

Only save and load sse when new thread is trying to execute sse
instruction. There is no need to do that every time we enter kernel.
This commit is contained in:
2024-01-03 02:06:49 +02:00
parent db0650cf10
commit 001e95f973
5 changed files with 61 additions and 27 deletions
+11
View File
@@ -231,6 +231,17 @@ namespace Kernel
Thread* current = &current_thread();
#if __enable_sse
if (current != Thread::sse_thread())
{
asm volatile(
"movq %cr0, %rax;"
"orq $(1 << 3), %rax;"
"movq %rax, %cr0"
);
}
#endif
while (current->state() == Thread::State::Terminated)
{
Thread* thread = m_current_thread->thread;