Kernel: Scheduler/Thread add inline assembly for i386

This commit is contained in:
2024-03-22 14:01:27 +02:00
parent d920785256
commit c0dff5e203
2 changed files with 35 additions and 2 deletions
+16
View File
@@ -19,7 +19,13 @@ namespace Kernel
ALWAYS_INLINE static void load_temp_stack()
{
#if ARCH(x86_64)
asm volatile("movq %0, %%rsp" :: "rm"(Processor::current_stack_top()));
#elif ARCH(i386)
asm volatile("movl %0, %%esp" :: "rm"(Processor::current_stack_top()));
#else
#error
#endif
}
BAN::ErrorOr<void> Scheduler::initialize()
@@ -209,11 +215,21 @@ namespace Kernel
#if __enable_sse
if (current != Thread::sse_thread())
{
#if ARCH(x86_64)
asm volatile(
"movq %cr0, %rax;"
"orq $(1 << 3), %rax;"
"movq %rax, %cr0"
);
#elif ARCH(i386)
asm volatile(
"movl %cr0, %eax;"
"orl $(1 << 3), %eax;"
"movl %eax, %cr0"
);
#else
#error
#endif
}
#endif