From 9d6235e1092e57bee39fd5574398dd7184b9f6ed Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 17 Dec 2022 10:45:55 +0100 Subject: [PATCH] CPU: Add a pause() method --- kernel/src/arch/CPU.h | 2 ++ kernel/src/arch/x86_64/CPU.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/kernel/src/arch/CPU.h b/kernel/src/arch/CPU.h index edf51cba..1701057f 100644 --- a/kernel/src/arch/CPU.h +++ b/kernel/src/arch/CPU.h @@ -25,4 +25,6 @@ namespace CPU void print_stack_trace(); void get_stack_trace_at(Registers* regs, void (*callback)(u64, void*), void* arg); void print_stack_trace_at(Registers* regs); + + void pause(); } \ No newline at end of file diff --git a/kernel/src/arch/x86_64/CPU.cpp b/kernel/src/arch/x86_64/CPU.cpp index 11043411..dd63b84d 100644 --- a/kernel/src/arch/x86_64/CPU.cpp +++ b/kernel/src/arch/x86_64/CPU.cpp @@ -506,6 +506,11 @@ namespace CPU }, &frame_index); } + + void pause() + { + asm volatile("pause"); + } } // called by kernel_yield