aboutsummaryrefslogtreecommitdiff
path: root/sys/include/arch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-14 18:26:47 -0500
committerIan Moffett <ian@osmora.org>2024-02-14 18:26:47 -0500
commit2440a9d67b0785132e303ed6f12dff8e80baa547 (patch)
treef4a2d3dd72361814db4c2f240c713255e437fd5e /sys/include/arch
parent34d83987c18df3e06db1528423841376072bb627 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'sys/include/arch')
-rw-r--r--sys/include/arch/amd64/cpu.h7
1 files changed, 7 insertions, 0 deletions
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 <sys/queue.h>
#include <machine/tss.h>
#include <machine/msr.h>
+/*
+ * 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()