diff options
Diffstat (limited to 'cpukit/score/include/rtems/score')
8 files changed, 72 insertions, 55 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h index 931f008c06..d4e1339afb 100644 --- a/cpukit/score/include/rtems/score/scheduler.h +++ b/cpukit/score/include/rtems/score/scheduler.h @@ -67,7 +67,7 @@ typedef struct { void ( *unblock )( const Scheduler_Control *, Thread_Control * ); /** allocates the scheduler field of the given thread */ - void * ( *allocate )( const Scheduler_Control *, Thread_Control * ); + bool ( *allocate )( const Scheduler_Control *, Thread_Control * ); /** frees the scheduler field of the given thread */ void ( *free )( const Scheduler_Control *, Thread_Control * ); @@ -199,9 +199,9 @@ extern const Scheduler_Control _Scheduler_Table[]; * @param[in] scheduler Unused. * @param[in] the_thread Unused. * - * @return An arbitrary non-NULL value. + * @retval true Always. */ -void *_Scheduler_default_Allocate( +bool _Scheduler_default_Allocate( const Scheduler_Control *scheduler, Thread_Control *the_thread ); diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h index 3abfdc5d99..e546c8d1e3 100644 --- a/cpukit/score/include/rtems/score/schedulercbs.h +++ b/cpukit/score/include/rtems/score/schedulercbs.h @@ -53,7 +53,7 @@ extern "C" { _Scheduler_EDF_Block, /* block entry point */ \ _Scheduler_CBS_Unblock, /* unblock entry point */ \ _Scheduler_CBS_Allocate, /* allocate entry point */ \ - _Scheduler_EDF_Free, /* free entry point */ \ + _Scheduler_default_Free, /* free entry point */ \ _Scheduler_EDF_Update, /* update entry point */ \ _Scheduler_EDF_Enqueue, /* enqueue entry point */ \ _Scheduler_EDF_Enqueue_first, /* enqueue_first entry point */ \ @@ -344,7 +344,7 @@ void _Scheduler_CBS_Budget_callout( * @param[in] the_thread is the thread the scheduler is allocating * management memory for. */ -void *_Scheduler_CBS_Allocate( +bool _Scheduler_CBS_Allocate( const Scheduler_Control *scheduler, Thread_Control *the_thread ); diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h index c6aba2dee2..fabce7e288 100644 --- a/cpukit/score/include/rtems/score/scheduleredf.h +++ b/cpukit/score/include/rtems/score/scheduleredf.h @@ -46,7 +46,7 @@ extern "C" { _Scheduler_EDF_Block, /* block entry point */ \ _Scheduler_EDF_Unblock, /* unblock entry point */ \ _Scheduler_EDF_Allocate, /* allocate entry point */ \ - _Scheduler_EDF_Free, /* free entry point */ \ + _Scheduler_default_Free, /* free entry point */ \ _Scheduler_EDF_Update, /* update entry point */ \ _Scheduler_EDF_Enqueue, /* enqueue entry point */ \ _Scheduler_EDF_Enqueue_first, /* enqueue_first entry point */ \ @@ -150,20 +150,7 @@ void _Scheduler_EDF_Schedule( * @param[in] the_thread is the thread the scheduler is allocating * management memory for. */ -void *_Scheduler_EDF_Allocate( - const Scheduler_Control *scheduler, - Thread_Control *the_thread -); - -/** - * @brief Frees EDF information of a thread. - * - * This routine frees the EDF specific information of @a the_thread. - * - * @param[in] the_thread is the thread whose scheduler specific information - * will be deallocated. - */ -void _Scheduler_EDF_Free( +bool _Scheduler_EDF_Allocate( const Scheduler_Control *scheduler, Thread_Control *the_thread ); diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index 25866e5ba7..5c787239d0 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -124,7 +124,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( * * This routine allocates @a the_thread->scheduler */ -RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate( +RTEMS_INLINE_ROUTINE bool _Scheduler_Allocate( const Scheduler_Control *scheduler, Thread_Control *the_thread ) diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h index 7706bf32ce..b46c0fa29a 100644 --- a/cpukit/score/include/rtems/score/schedulerpriority.h +++ b/cpukit/score/include/rtems/score/schedulerpriority.h @@ -52,8 +52,8 @@ extern "C" { _Scheduler_priority_Yield, /* yield entry point */ \ _Scheduler_priority_Block, /* block entry point */ \ _Scheduler_priority_Unblock, /* unblock entry point */ \ - _Scheduler_priority_Allocate, /* allocate entry point */ \ - _Scheduler_priority_Free, /* free entry point */ \ + _Scheduler_default_Allocate, /* allocate entry point */ \ + _Scheduler_default_Free, /* free entry point */ \ _Scheduler_priority_Update, /* update entry point */ \ _Scheduler_priority_Enqueue, /* enqueue entry point */ \ _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \ @@ -126,32 +126,6 @@ void _Scheduler_priority_Schedule( ); /** - * @brief Allocates @a the_thread->scheduler. - * - * This routine allocates @a the_thread->scheduler. - * - * @param[in] the_thread is the thread the scheduler is allocating - * management memory for - */ -void * _Scheduler_priority_Allocate( - const Scheduler_Control *scheduler, - Thread_Control *the_thread -); - -/** - * @brief Frees @a the_thread->scheduler. - * - * This routine frees @a the_thread->scheduler. - * - * @param[in] the_thread is the thread whose scheduler specific information - * will be deallocated. - */ -void _Scheduler_priority_Free( - const Scheduler_Control *scheduler, - Thread_Control *the_thread -); - -/** * @brief Update the scheduler priority. * This routine updates @a the_thread->scheduler based on @a the_scheduler * structures and thread state. diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h index 54fca12bf0..4f31722eb1 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @@ -55,7 +55,7 @@ extern "C" { _Scheduler_priority_SMP_Block, \ _Scheduler_priority_SMP_Enqueue_fifo, \ _Scheduler_priority_affinity_SMP_Allocate, \ - _Scheduler_priority_Free, \ + _Scheduler_default_Free, \ _Scheduler_priority_SMP_Update, \ _Scheduler_priority_SMP_Enqueue_fifo, \ _Scheduler_priority_SMP_Enqueue_lifo, \ @@ -77,7 +77,7 @@ extern "C" { * @param[in] the_thread is the thread the scheduler is allocating * management memory for. */ -void * _Scheduler_priority_affinity_SMP_Allocate( +bool _Scheduler_priority_affinity_SMP_Allocate( const Scheduler_Control *scheduler, Thread_Control *the_thread ); diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h index df8af184e3..8506623c8f 100644 --- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h +++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h @@ -63,8 +63,8 @@ typedef struct { _Scheduler_priority_SMP_Yield, \ _Scheduler_priority_SMP_Block, \ _Scheduler_priority_SMP_Enqueue_fifo, \ - _Scheduler_priority_Allocate, \ - _Scheduler_priority_Free, \ + _Scheduler_default_Allocate, \ + _Scheduler_default_Free, \ _Scheduler_priority_SMP_Update, \ _Scheduler_priority_SMP_Enqueue_fifo, \ _Scheduler_priority_SMP_Enqueue_lifo, \ diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 2765f56286..77e105bf28 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -566,8 +566,6 @@ struct Thread_Control_struct { struct _reent *libc_reent; /** This array contains the API extension area pointers. */ void *API_Extensions[ THREAD_API_LAST + 1 ]; - /** This field points to the user extension pointers. */ - void **extensions; #if !defined(RTEMS_SMP) /** This field points to the set of per task variables. */ @@ -584,6 +582,13 @@ struct Thread_Control_struct { Chain_Control Key_Chain; Thread_Life_control Life; + + /** + * @brief Variable length array of user extension pointers. + * + * The length is defined by the application via <rtems/confdefs.h>. + */ + void *extensions[ RTEMS_ZERO_LENGTH_ARRAY ]; }; #if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE) @@ -638,6 +643,57 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_executing( void ) return executing; } +/** + * @brief Thread control add-on. + */ +typedef struct { + /** + * @brief Offset of the pointer field in Thread_Control referencing an + * application configuration dependent memory area in the thread control + * block. + */ + size_t destination_offset; + + /** + * @brief Offset relative to the thread control block begin to an application + * configuration dependent memory area. + */ + size_t source_offset; +} Thread_Control_add_on; + +/** + * @brief Thread control add-ons. + * + * The thread control block contains fields that point to application + * configuration dependent memory areas, like the scheduler information, the + * API control blocks, the user extension context table, the RTEMS notepads and + * the Newlib re-entrancy support. Account for these areas in the + * configuration and avoid extra workspace allocations for these areas. + * + * This array is provided via <rtems/confdefs.h>. + * + * @see _Thread_Control_add_on_count and _Thread_Control_size. + */ +extern const Thread_Control_add_on _Thread_Control_add_ons[]; + +/** + * @brief Thread control add-on count. + * + * Count of entries in _Thread_Control_add_ons. + * + * This value is provided via <rtems/confdefs.h>. + */ +extern const size_t _Thread_Control_add_on_count; + +/** + * @brief Size of the thread control block of a particular application. + * + * This value is provided via <rtems/confdefs.h>. + * + * @see _Thread_Control_add_ons. + */ +extern const size_t _Thread_Control_size; + /**@}*/ #ifdef __cplusplus |