From d45f87cf3599b3614ea4b126728aedeb51737695 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 May 2021 13:35:42 +0200 Subject: score: Add _CPU_Context_switch_no_return() The __builtin_unreachable() cannot be used with current GCC versions to tell the compiler that a function does not return to the caller, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99151 Add a no return variant of _CPU_Context_switch() to avoid generation of dead code in _Thread_Start_multitasking() if RTEMS was built with SMP support enabled. --- cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h | 32 ++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'cpukit/score/cpu/no_cpu/include') diff --git a/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h index c067501502..09f34b4acd 100644 --- a/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h +++ b/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h @@ -1054,22 +1054,46 @@ void _CPU_ISR_install_vector( void *_CPU_Thread_Idle_body( uintptr_t ignored ); /** + * @brief Performs a context switch from the executing thread to the heir + * thread. + * * @addtogroup RTEMSScoreCPUExampleContext * - * This routine switches from the run context to the heir context. + * This routine switches from the executing context to the heir context. + * + * @param[out] executing points to the context of the currently executing task. * - * @param[in] run points to the context of the currently executing task - * @param[in] heir points to the context of the heir task + * @param[in, out] heir points to the context of the heir task. * * Port Specific Information: * * XXX document implementation including references if appropriate */ void _CPU_Context_switch( - Context_Control *run, + Context_Control *executing, Context_Control *heir ); +/** + * @brief Performs a context switch from the executing thread to the heir + * thread and does not return. + * + * @addtogroup RTEMSScoreCPUExampleContext + * + * This routine shall be a strong alias to _CPU_Context_switch(). It shall be + * provided for all target architectures which support an SMP build + * configuration (RTEMS_SMP). The purpose is help to compiler to avoid + * generation of dead code in _Thread_Start_multitasking(). + * + * @param[out] executing points to the context of the currently executing task. + * + * @param[in, out] heir points to the context of the heir task. + */ +RTEMS_NO_RETURN void _CPU_Context_switch_no_return( + Context_Control *executing, + Context_Control *heir +); + /** * @addtogroup RTEMSScoreCPUExampleContext * -- cgit v1.2.3