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

Kernel: Add Processor::pause() and use it to give the CPU a rest

On x86, the "pause" instruction is a "spin loop hint".
This commit is contained in:
Andreas Kling 2021-08-08 15:27:04 +02:00
parent b7129c57df
commit 46215a8183
2 changed files with 9 additions and 4 deletions

View file

@ -197,10 +197,15 @@ public:
return *g_total_processors.ptr();
}
ALWAYS_INLINE static void pause()
{
asm volatile("pause");
}
ALWAYS_INLINE static void wait_check()
{
Processor::pause();
Processor::current().smp_process_pending_messages();
// TODO: pause
}
[[noreturn]] static void halt();