mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-26 15:45:58 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user