cpukit/score/.../cpu.h: Implement _CPU_Spin_wait()

_CPU_Spin_wait() is an assembly function which prevents
aggressive speculative execution by the CPU during spin-wait
loops. Added benefit is reduction of thermal load. This
function is part of the Deterministic Hedged Read Library API.
This commit is contained in:
Wayne Thornton
2026-07-23 08:12:13 -06:00
parent 2731c65d39
commit 4e9ee786f6
@@ -443,6 +443,18 @@ CPU_Counter_ticks _CPU_Counter_read( void );
typedef uintptr_t CPU_Uint32ptr;
/**
* Pauses the CPU pipeline to prevent aggressive speculative execution
* and reduce thermal load during spin-wait loops.
*/
static inline void _CPU_Spin_wait( void )
{
__asm__ volatile( "pause" ::: "memory" );
}
/* Explicitly define the macro so the preprocessor can see it in DHRL API */
#define _CPU_Spin_wait _CPU_Spin_wait
#ifdef __cplusplus
}
#endif