From aad726ebd45d0b25d62056639b0654fb74b1092e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 16 Nov 1999 22:56:38 +0000 Subject: Moved task_variable pointer to basic shared part of TCB instead of RTEMS API extension to avoid problems when the extension is freed. Eventually the task variable switch extension should become part of the core context switch and the Ada tcb self implemented in terms of it. --- cpukit/rtems/src/tasks.c | 20 ++++++-------------- cpukit/rtems/src/taskvariableadd.c | 8 +++----- cpukit/rtems/src/taskvariabledelete.c | 6 ++---- 3 files changed, 11 insertions(+), 23 deletions(-) (limited to 'cpukit/rtems/src') diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c index e05aecca3f..d49236cadf 100644 --- a/cpukit/rtems/src/tasks.c +++ b/cpukit/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/cpukit/rtems/src/taskvariableadd.c b/cpukit/rtems/src/taskvariableadd.c index 1bc38bdf46..8928f6d7d7 100644 --- a/cpukit/rtems/src/taskvariableadd.c +++ b/cpukit/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/cpukit/rtems/src/taskvariabledelete.c b/cpukit/rtems/src/taskvariabledelete.c index 551e7057a9..82fd444bd8 100644 --- a/cpukit/rtems/src/taskvariabledelete.c +++ b/cpukit/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; -- cgit v1.2.3