summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/thread.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-08 09:42:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-15 08:37:12 +0200
commit69aa33490b1cd357519ab70b15ad150e11bb752e (patch)
tree8aa1ac3807bfe65ae1157629d0ad21548c35a5cb /cpukit/score/include/rtems/score/thread.h
parentscore: Static scheduler configuration (diff)
downloadrtems-69aa33490b1cd357519ab70b15ad150e11bb752e.tar.bz2
score: Simplify thread control initialization
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 helps also to avoid heap fragementation and reduces the per thread memory due to a reduced heap allocation overhead.
Diffstat (limited to 'cpukit/score/include/rtems/score/thread.h')
-rw-r--r--cpukit/score/include/rtems/score/thread.h60
1 files changed, 58 insertions, 2 deletions
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