summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-17 13:35:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-18 08:02:50 +0200
commitd45f87cf3599b3614ea4b126728aedeb51737695 (patch)
treeccd13083533329b75b02e80627948cc5fea77f94 /cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
parentscore: Move _Thread_queue_Queue_get_name_and_id() (diff)
downloadrtems-d45f87cf3599b3614ea4b126728aedeb51737695.tar.bz2
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.
Diffstat (limited to 'cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h')
-rw-r--r--cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h32
1 files changed, 28 insertions, 4 deletions
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,23 +1054,47 @@ 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
*
* This routine is generally used only to restart self in an