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:
parent
b7129c57df
commit
46215a8183
2 changed files with 9 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue