RTEMS | cpukit/score/.../cpu.h: Implement _CPU_Spin_wait() (!1256)
Wayne Thornton (@wmthornton-dev)
gitlab at rtems.org
Fri May 22 22:56:39 UTC 2026
Wayne Thornton commented on a discussion on cpukit/score/cpu/x86_64/include/rtems/score/cpu.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1256#note_150896
>
> 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
I would prefer to keep the `#define` as a way of providing a friendlier error message, as I have in the `dhrl.c` implementation. Example:
```
/* Enforce architectural hardware requirements at compile time */
#ifndef _CPU_Spin_wait
#error "DHRL requires _CPU_Spin_wait() to be defined by the architecture."
#endif
```
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1256#note_150896
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260522/9a455c22/attachment-0001.htm>
More information about the bugs
mailing list