From 2440a9d67b0785132e303ed6f12dff8e80baa547 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 14 Feb 2024 18:26:47 -0500 Subject: kernel: cpu: Add hint_spinwait() This commit introduces a macro that must exist per architecture (even if it does nothing) to ensure it is machine independent. Signed-off-by: Ian Moffett --- sys/include/arch/amd64/cpu.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sys/include') diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index c72c106..e6f2de0 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -37,6 +37,13 @@ #include #include #include +/* + * XXX: We are not using the PAUSE instruction for the sake of + * ensuring compatibility... PAUSE is F3 90, REP NOP is + * F3 90... REP NOP will be read as a PAUSE on processors + * that support it. + */ +#define hint_spinwait() __ASMV("rep; nop") #define this_cpu() amd64_this_cpu() #define get_bsp() amd64_get_bsp() -- cgit v1.2.3