summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-03 07:38:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-04 07:24:30 +0200
commit1d40d81b4b8dd50e4162b0b79b60d3312d2744e5 (patch)
tree9c7dc074ea705a924742d965dcd22afef579cb5b /cpukit/rtems/src
parentbsp/mvme5500: Use thread local variable (diff)
downloadrtems-1d40d81b4b8dd50e4162b0b79b60d3312d2744e5.tar.bz2
rtems: Remove task variables
Update #2494. Update #2555.
Diffstat (limited to '')
-rw-r--r--cpukit/rtems/src/tasks.c92
-rw-r--r--cpukit/rtems/src/taskvariable_invoke_dtor.c52
-rw-r--r--cpukit/rtems/src/taskvariableadd.c97
-rw-r--r--cpukit/rtems/src/taskvariabledelete.c86
-rw-r--r--cpukit/rtems/src/taskvariableget.c88
5 files changed, 5 insertions, 410 deletions
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index f18e0ab3db..56b2455ad7 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -18,20 +18,13 @@
#include "config.h"
#endif
-#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/sysinit.h>
#include <rtems/rtems/asrimpl.h>
#include <rtems/rtems/eventimpl.h>
-#include <rtems/rtems/signalimpl.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/stack.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/userextimpl.h>
-#include <rtems/score/wkspace.h>
Thread_Information _RTEMS_tasks_Information;
@@ -91,87 +84,12 @@ static void _RTEMS_tasks_Delete_extension(
_ASR_Destroy( &api->Signal );
}
-static void _RTEMS_tasks_Terminate_extension(
- Thread_Control *executing
-)
-{
- /*
- * Free per task variable memory
- *
- * Per Task Variables are only enabled in uniprocessor configurations.
- */
- #if !defined(RTEMS_SMP)
- /*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- do {
- rtems_task_variable_t *tvp, *next;
-
- tvp = executing->task_variables;
- executing->task_variables = NULL;
- while (tvp) {
- next = (rtems_task_variable_t *)tvp->next;
- _RTEMS_Tasks_Invoke_task_variable_dtor( executing, tvp );
- tvp = next;
- }
- } while (0);
- #pragma GCC diagnostic pop
- #endif
-}
-
-#if !defined(RTEMS_SMP)
-/*
- * _RTEMS_tasks_Switch_extension
- *
- * This extension routine is invoked at each context switch.
- *
- * @note Since this only needs to address per-task variables, it is
- * disabled entirely for SMP configurations.
- */
-static void _RTEMS_tasks_Switch_extension(
- Thread_Control *executing,
- Thread_Control *heir
-)
-{
- rtems_task_variable_t *tvp;
-
- /*
- * Per Task Variables are only enabled in uniprocessor configurations
- */
-
- tvp = executing->task_variables;
- while (tvp) {
- tvp->tval = *tvp->ptr;
- *tvp->ptr = tvp->gval;
- tvp = (rtems_task_variable_t *)tvp->next;
- }
-
- tvp = heir->task_variables;
- while (tvp) {
- tvp->gval = *tvp->ptr;
- *tvp->ptr = tvp->tval;
- tvp = (rtems_task_variable_t *)tvp->next;
- }
-}
-#define RTEMS_TASKS_SWITCH_EXTENSION _RTEMS_tasks_Switch_extension
-#else
-#define RTEMS_TASKS_SWITCH_EXTENSION NULL
-#endif
-
User_extensions_Control _RTEMS_tasks_User_extensions = {
- { NULL, NULL },
- { { NULL, NULL }, RTEMS_TASKS_SWITCH_EXTENSION },
- { _RTEMS_tasks_Create_extension, /* create */
- _RTEMS_tasks_Start_extension, /* start */
- _RTEMS_tasks_Start_extension, /* restart */
- _RTEMS_tasks_Delete_extension, /* delete */
- RTEMS_TASKS_SWITCH_EXTENSION, /* switch */
- NULL, /* begin */
- NULL, /* exitted */
- NULL, /* fatal */
- _RTEMS_tasks_Terminate_extension /* terminate */
+ .Callouts = {
+ .thread_create = _RTEMS_tasks_Create_extension,
+ .thread_start = _RTEMS_tasks_Start_extension,
+ .thread_restart = _RTEMS_tasks_Start_extension,
+ .thread_delete = _RTEMS_tasks_Delete_extension
}
};
diff --git a/cpukit/rtems/src/taskvariable_invoke_dtor.c b/cpukit/rtems/src/taskvariable_invoke_dtor.c
deleted file mode 100644
index b9213f2bd6..0000000000
--- a/cpukit/rtems/src/taskvariable_invoke_dtor.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @file
- *
- * @brief RTEMS Tasks Invoke Task Variable Destructor
- * @ingroup ClassicTasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-void _RTEMS_Tasks_Invoke_task_variable_dtor(
- Thread_Control *the_thread,
- rtems_task_variable_t *tvp
-)
-{
- void (*dtor)(void *);
- void *value;
-
- dtor = tvp->dtor;
- if (_Thread_Get_executing() == the_thread) {
- value = *tvp->ptr;
- *tvp->ptr = tvp->gval;
- } else {
- value = tvp->tval;
- }
-
- if ( dtor )
- (*dtor)(value);
-
- _Workspace_Free(tvp);
-}
-#endif
diff --git a/cpukit/rtems/src/taskvariableadd.c b/cpukit/rtems/src/taskvariableadd.c
deleted file mode 100644
index 0fea945fba..0000000000
--- a/cpukit/rtems/src/taskvariableadd.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file
- *
- * @brief RTEMS Add Task Variable
- * @ingroup ClassicTasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasks.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/config.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-rtems_status_code rtems_task_variable_add(
- rtems_id tid,
- void **ptr,
- void (*dtor)(void *)
-)
-{
- Thread_Control *the_thread;
- Objects_Locations location;
- rtems_task_variable_t *tvp, *new;
-
-#if defined( RTEMS_SMP )
- if ( rtems_configuration_is_smp_enabled() ) {
- return RTEMS_NOT_IMPLEMENTED;
- }
-#endif
-
- if ( !ptr )
- return RTEMS_INVALID_ADDRESS;
-
- the_thread = _Thread_Get (tid, &location);
- switch (location) {
-
- case OBJECTS_LOCAL:
- /*
- * Figure out if the variable is already in this task's list.
- */
- tvp = the_thread->task_variables;
- while (tvp) {
- if (tvp->ptr == ptr) {
- tvp->dtor = dtor;
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
- }
- tvp = (rtems_task_variable_t *)tvp->next;
- }
-
- /*
- * Now allocate memory for this task variable.
- */
- new = (rtems_task_variable_t *)
- _Workspace_Allocate(sizeof(rtems_task_variable_t));
- if (new == NULL) {
- _Objects_Put( &the_thread->Object );
- return RTEMS_NO_MEMORY;
- }
- new->gval = *ptr;
- new->ptr = ptr;
- new->dtor = dtor;
-
- new->next = (struct rtems_task_variable_tt *)the_thread->task_variables;
- the_thread->task_variables = new;
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- break;
- }
- return RTEMS_INVALID_ID;
-}
-#endif
diff --git a/cpukit/rtems/src/taskvariabledelete.c b/cpukit/rtems/src/taskvariabledelete.c
deleted file mode 100644
index 3f7f84e103..0000000000
--- a/cpukit/rtems/src/taskvariabledelete.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file
- *
- * @brief RTEMS Delete Task Variable
- * @ingroup ClassicTasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/config.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-rtems_status_code rtems_task_variable_delete(
- rtems_id tid,
- void **ptr
-)
-{
- Thread_Control *the_thread;
- Objects_Locations location;
- rtems_task_variable_t *tvp, *prev;
-
-#if defined( RTEMS_SMP )
- if ( rtems_configuration_is_smp_enabled() ) {
- return RTEMS_NOT_IMPLEMENTED;
- }
-#endif
-
- if ( !ptr )
- return RTEMS_INVALID_ADDRESS;
-
- prev = NULL;
-
- the_thread = _Thread_Get (tid, &location);
- switch (location) {
-
- case OBJECTS_LOCAL:
- tvp = the_thread->task_variables;
- while (tvp) {
- if (tvp->ptr == ptr) {
- if (prev)
- prev->next = tvp->next;
- else
- the_thread->task_variables = (rtems_task_variable_t *)tvp->next;
-
- _RTEMS_Tasks_Invoke_task_variable_dtor( the_thread, tvp );
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
- }
- prev = tvp;
- tvp = (rtems_task_variable_t *)tvp->next;
- }
- _Objects_Put( &the_thread->Object );
- return RTEMS_INVALID_ADDRESS;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- break;
- }
-
- return RTEMS_INVALID_ID;
-}
-#endif
diff --git a/cpukit/rtems/src/taskvariableget.c b/cpukit/rtems/src/taskvariableget.c
deleted file mode 100644
index 3b9cd25a86..0000000000
--- a/cpukit/rtems/src/taskvariableget.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- *
- * @brief Get a per-task variable
- * @ingroup ClassicTasks Tasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/config.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-rtems_status_code rtems_task_variable_get(
- rtems_id tid,
- void **ptr,
- void **result
-)
-{
- Thread_Control *the_thread;
- Objects_Locations location;
- rtems_task_variable_t *tvp;
-
-#if defined( RTEMS_SMP )
- if ( rtems_configuration_is_smp_enabled() ) {
- return RTEMS_NOT_IMPLEMENTED;
- }
-#endif
-
- if ( !ptr )
- return RTEMS_INVALID_ADDRESS;
-
- if ( !result )
- return RTEMS_INVALID_ADDRESS;
-
- the_thread = _Thread_Get (tid, &location);
- switch (location) {
-
- case OBJECTS_LOCAL:
- /*
- * Figure out if the variable is in this task's list.
- */
- tvp = the_thread->task_variables;
- while (tvp) {
- if (tvp->ptr == ptr) {
- /*
- * Should this return the current (i.e not the
- * saved) value if `tid' is the current task?
- */
- *result = tvp->tval;
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
- }
- tvp = (rtems_task_variable_t *)tvp->next;
- }
- _Objects_Put( &the_thread->Object );
- return RTEMS_INVALID_ADDRESS;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- break;
- }
- return RTEMS_INVALID_ID;
-}
-#endif