summaryrefslogtreecommitdiffstats
path: root/c/src/exec
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/exec')
-rw-r--r--c/src/exec/rtems/include/rtems/rtems/tasks.h15
-rw-r--r--c/src/exec/rtems/src/tasks.c20
-rw-r--r--c/src/exec/rtems/src/taskvariableadd.c8
-rw-r--r--c/src/exec/rtems/src/taskvariabledelete.c6
-rw-r--r--c/src/exec/score/include/rtems/score/thread.h15
5 files changed, 26 insertions, 38 deletions
diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h
index d7147586a8..3ed495bed1 100644
--- a/c/src/exec/rtems/include/rtems/rtems/tasks.h
+++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h
@@ -147,20 +147,6 @@ typedef struct {
} rtems_initialization_tasks_table;
/*
- * Per task variable structure
- */
-
-struct rtems_task_variable_tt;
-
-struct rtems_task_variable_tt {
- struct rtems_task_variable_tt *next;
- int *ptr;
- int var;
-};
-
-typedef struct rtems_task_variable_tt rtems_task_variable_t;
-
-/*
* This is the API specific information required by each thread for
* the RTEMS API to function correctly.
*/
@@ -171,7 +157,6 @@ typedef struct {
rtems_event_set pending_events;
rtems_event_set event_condition;
ASR_Information Signal;
- rtems_task_variable_t *task_variables;
} RTEMS_API_Control;
/*
diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c
index e05aecca3f..d49236cadf 100644
--- a/c/src/exec/rtems/src/tasks.c
+++ b/c/src/exec/rtems/src/tasks.c
@@ -56,7 +56,7 @@ boolean _RTEMS_tasks_Create_extension(
api->pending_events = EVENT_SETS_NONE_PENDING;
_ASR_Initialize( &api->Signal );
- api->task_variables = NULL;
+ created->task_variables = NULL;
return TRUE;
}
@@ -94,17 +94,14 @@ User_extensions_routine _RTEMS_tasks_Delete_extension(
Thread_Control *deleted
)
{
- RTEMS_API_Control *api;
rtems_task_variable_t *tvp, *next;
- api = executing->API_Extensions[ THREAD_API_RTEMS ];
-
/*
* Free per task variable memory
*/
- tvp = api->task_variables;
- api->task_variables = NULL;
+ tvp = deleted->task_variables;
+ deleted->task_variables = NULL;
while (tvp) {
next = tvp->next;
_Workspace_Free( tvp );
@@ -115,8 +112,7 @@ User_extensions_routine _RTEMS_tasks_Delete_extension(
* Free API specific memory
*/
- (void) _Workspace_Free( api );
-
+ (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] );
deleted->API_Extensions[ THREAD_API_RTEMS ] = NULL;
}
@@ -132,23 +128,19 @@ void _RTEMS_tasks_Switch_extension(
Thread_Control *heir
)
{
- RTEMS_API_Control *api;
rtems_task_variable_t *tvp;
/*
* Per Task Variables
*/
-
- api = executing->API_Extensions[ THREAD_API_RTEMS ];
- tvp = api->task_variables;
+ tvp = executing->task_variables;
while (tvp) {
tvp->var = *tvp->ptr;
tvp = tvp->next;
}
- api = heir->API_Extensions[ THREAD_API_RTEMS ];
- tvp = api->task_variables;
+ tvp = heir->task_variables;
while (tvp) {
*tvp->ptr = tvp->var;
tvp = tvp->next;
diff --git a/c/src/exec/rtems/src/taskvariableadd.c b/c/src/exec/rtems/src/taskvariableadd.c
index 1bc38bdf46..8928f6d7d7 100644
--- a/c/src/exec/rtems/src/taskvariableadd.c
+++ b/c/src/exec/rtems/src/taskvariableadd.c
@@ -30,7 +30,6 @@ rtems_status_code rtems_task_variable_add(
{
Thread_Control *the_thread;
Objects_Locations location;
- RTEMS_API_Control *api;
rtems_task_variable_t *tvp, *new;
the_thread = _Thread_Get (tid, &location);
@@ -48,13 +47,12 @@ rtems_status_code rtems_task_variable_add(
return RTEMS_INTERNAL_ERROR;
case OBJECTS_LOCAL:
- api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
/*
* Figure out if the variable is already in this task's list.
*/
- tvp = api->task_variables;
+ tvp = the_thread->task_variables;
while (tvp) {
if (tvp->ptr == ptr) {
_Thread_Enable_dispatch();
@@ -76,8 +74,8 @@ rtems_status_code rtems_task_variable_add(
new->var = 0;
new->ptr = ptr;
- new->next = api->task_variables;
- api->task_variables = new;
+ new->next = the_thread->task_variables;
+ the_thread->task_variables = new;
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
}
diff --git a/c/src/exec/rtems/src/taskvariabledelete.c b/c/src/exec/rtems/src/taskvariabledelete.c
index 551e7057a9..82fd444bd8 100644
--- a/c/src/exec/rtems/src/taskvariabledelete.c
+++ b/c/src/exec/rtems/src/taskvariabledelete.c
@@ -30,7 +30,6 @@ rtems_status_code rtems_task_variable_delete(
{
Thread_Control *the_thread;
Objects_Locations location;
- RTEMS_API_Control *api;
rtems_task_variable_t *tvp, *prev;
prev = NULL;
@@ -50,12 +49,11 @@ rtems_status_code rtems_task_variable_delete(
return RTEMS_INTERNAL_ERROR;
case OBJECTS_LOCAL:
- api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
- tvp = api->task_variables;
+ tvp = the_thread->task_variables;
while (tvp) {
if (tvp->ptr == ptr) {
if (prev) prev->next = tvp->next;
- else api->task_variables = tvp->next;
+ else the_thread->task_variables = tvp->next;
_Thread_Enable_dispatch();
_Workspace_Free(tvp);
return RTEMS_SUCCESSFUL;
diff --git a/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h
index 8ac9e8ed26..59c61f7365 100644
--- a/c/src/exec/score/include/rtems/score/thread.h
+++ b/c/src/exec/score/include/rtems/score/thread.h
@@ -87,6 +87,20 @@ typedef struct Thread_Control_struct Thread_Control;
typedef void (*Thread_CPU_budget_algorithm_callout )( Thread_Control * );
/*
+ * Per task variable structure
+ */
+
+struct rtems_task_variable_tt;
+
+struct rtems_task_variable_tt {
+ struct rtems_task_variable_tt *next;
+ int *ptr;
+ int var;
+};
+
+typedef struct rtems_task_variable_tt rtems_task_variable_t;
+
+/*
* The following structure contains the information which defines
* the starting state of a thread.
*/
@@ -203,6 +217,7 @@ struct Thread_Control_struct {
void *fp_context;
void *API_Extensions[ THREAD_API_LAST + 1 ];
void **extensions;
+ rtems_task_variable_t *task_variables;
};
/*