Implement side_cpu_relax for x86
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Feb 2024 18:58:55 +0000 (13:58 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Feb 2024 18:58:55 +0000 (13:58 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/compiler.h

index 528781377b710adfd8490a93a368f11243f8791b..bf76b26316dd6bb4aa955ad54f5add8211501d07 100644 (file)
@@ -6,11 +6,19 @@
 #ifndef _SIDE_COMPILER_H
 #define _SIDE_COMPILER_H
 
+#if defined(__x86_64__) || defined(__i386__)
+static inline
+void side_cpu_relax(void)
+{
+       asm volatile ("rep; nop" : : : "memory");
+}
+#else
 //TODO: implement per-architecture busy loop "pause"/"rep; nop;" instruction.
 static inline
 void side_cpu_relax(void)
 {
        asm volatile ("" : : : "memory");
 }
+#endif
 
 #endif /* _SIDE_COMPILER_H */
This page took 0.023188 seconds and 4 git commands to generate.