summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-08-23 21:06:31 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-08-23 21:06:31 +0000
commit5250ff39f042c09503b61eb81a2c705e9b06b917 (patch)
treec685bbf9969cc3ec5da6d24b7b353805d6371edb /cpukit/score
parentSupport for variable length names added to Object Handler. This supports (diff)
downloadrtems-5250ff39f042c09503b61eb81a2c705e9b06b917.tar.bz2
Moved _Thread_Information -> _RTEMS_tasks_Information.
Added a table of object information control blocks. Modified _Thread_Get so it looks up a thread regardless of which thread management "entity" (manager, internal, etc) actually "owns" it.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/include/rtems/score/object.h36
-rw-r--r--cpukit/score/include/rtems/score/thread.h8
-rw-r--r--cpukit/score/inline/rtems/score/thread.inl29
-rw-r--r--cpukit/score/src/object.c14
-rw-r--r--cpukit/score/src/thread.c47
5 files changed, 87 insertions, 47 deletions
diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h
index c5226302d6..5c84868dc1 100644
--- a/cpukit/score/include/rtems/score/object.h
+++ b/cpukit/score/include/rtems/score/object.h
@@ -78,17 +78,21 @@ typedef unsigned32 Objects_Id;
typedef enum {
OBJECTS_NO_CLASS = 0,
- OBJECTS_RTEMS_TASKS = 1,
- OBJECTS_RTEMS_TIMERS = 2,
- OBJECTS_RTEMS_SEMAPHORES = 3,
- OBJECTS_RTEMS_MESSAGE_QUEUES = 4,
- OBJECTS_RTEMS_PARTITIONS = 5,
- OBJECTS_RTEMS_REGIONS = 6,
- OBJECTS_RTEMS_PORTS = 7,
- OBJECTS_RTEMS_PERIODS = 8,
- OBJECTS_RTEMS_EXTENSIONS = 9
+ OBJECTS_INTERNAL_THREADS = 1,
+ OBJECTS_RTEMS_TASKS = 2,
+ OBJECTS_RTEMS_TIMERS = 3,
+ OBJECTS_RTEMS_SEMAPHORES = 4,
+ OBJECTS_RTEMS_MESSAGE_QUEUES = 5,
+ OBJECTS_RTEMS_PARTITIONS = 6,
+ OBJECTS_RTEMS_REGIONS = 7,
+ OBJECTS_RTEMS_PORTS = 8,
+ OBJECTS_RTEMS_PERIODS = 9,
+ OBJECTS_RTEMS_EXTENSIONS = 10
} Objects_Classes;
+#define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS
+#define OBJECTS_CLASSES_LAST OBJECTS_RTEMS_EXTENSIONS
+
/*
* This enumerated type lists the locations which may be returned
* by _Objects_Get. These codes indicate the success of locating
@@ -128,6 +132,8 @@ typedef struct {
Chain_Control Inactive; /* chain of inactive ctl blocks */
boolean is_string; /* TRUE if names are strings */
unsigned32 name_length; /* maximum length of names */
+ boolean is_thread; /* TRUE if these are threads */
+ /* irregardless of API */
} Objects_Information;
/*
@@ -138,6 +144,15 @@ typedef struct {
EXTERN unsigned32 _Objects_Local_node;
/*
+ * The following is the list of information blocks for each object
+ * class. From the ID, we can go to one of these information blocks,
+ * and obtain a pointer to the appropriate object control block.
+ */
+
+EXTERN Objects_Information
+ *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1];
+
+/*
* The following defines the constant which may be used
* with _Objects_Get to manipulate the calling task.
*
@@ -201,7 +216,8 @@ void _Objects_Initialize_information (
unsigned32 maximum,
unsigned32 size,
boolean is_string,
- unsigned32 maximum_name_length
+ unsigned32 maximum_name_length,
+ boolean is_task
);
/*
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index ddae52a363..9c5d0b040b 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -229,13 +229,6 @@ EXTERN Thread_Control *_Thread_Heir;
EXTERN Thread_Control *_Thread_Allocated_fp;
/*
- * The following defines the information control block used to
- * manage this class of objects.
- */
-
-EXTERN Objects_Information _Thread_Information;
-
-/*
* The following context area contains the context of the "thread"
* which invoked rtems_initialize_executive. This context is restored
* as the last action of the rtems_shutdown_executive directive. Thus
@@ -254,7 +247,6 @@ EXTERN Context_Control _Thread_BSP_context;
*/
void _Thread_Handler_initialization (
- unsigned32 maximum_tasks,
unsigned32 ticks_per_timeslice,
unsigned32 maximum_proxies
);
diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl
index 35b8eeccfe..2a1049f241 100644
--- a/cpukit/score/inline/rtems/score/thread.inl
+++ b/cpukit/score/inline/rtems/score/thread.inl
@@ -231,6 +231,7 @@ STATIC INLINE boolean _Thread_Is_null (
*
* _Thread_Get
*
+ * NOTE: XXX... This routine may be able to be optimized.
*/
STATIC INLINE Thread_Control *_Thread_Get (
@@ -238,14 +239,30 @@ STATIC INLINE Thread_Control *_Thread_Get (
Objects_Locations *location
)
{
+ Objects_Classes the_class;
+ Objects_Information *information;
+
if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
- _Thread_Disable_dispatch();
- *location = OBJECTS_LOCAL;
- return( _Thread_Executing );
+ _Thread_Disable_dispatch();
+ *location = OBJECTS_LOCAL;
+ return( _Thread_Executing );
}
-
- return (Thread_Control *)
- _Objects_Get( &_Thread_Information, id, location );
+
+ the_class = rtems_get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ return (Thread_Control *) _Objects_Get( information, id, location );
}
#endif
diff --git a/cpukit/score/src/object.c b/cpukit/score/src/object.c
index 5b64ea8802..b829258a48 100644
--- a/cpukit/score/src/object.c
+++ b/cpukit/score/src/object.c
@@ -68,7 +68,8 @@ void _Objects_Initialize_information(
unsigned32 maximum,
unsigned32 size,
boolean is_string,
- unsigned32 maximum_name_length
+ unsigned32 maximum_name_length,
+ boolean is_thread
)
{
unsigned32 minimum_index;
@@ -80,6 +81,13 @@ void _Objects_Initialize_information(
information->maximum = maximum;
information->the_class = the_class;
information->is_string = is_string;
+ information->is_thread = is_thread;
+
+ /*
+ * Set the entry in the object information table.
+ */
+
+ _Objects_Information_table[ the_class ] = information;
/*
* Calculate minimum and maximum Id's
@@ -379,8 +387,8 @@ rtems_status_code _Objects_Name_to_id(
Objects_Control *_Objects_Get(
Objects_Information *information,
- Objects_Id id,
- Objects_Locations *location
+ Objects_Id id,
+ Objects_Locations *location
)
{
Objects_Control *the_object;
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index 9793792b44..c4dde3e6f8 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -35,14 +35,13 @@
* This routine initializes all thread manager related data structures.
*
* Input parameters:
- * maximum_tasks - number of tasks to initialize
* ticks_per_timeslice - clock ticks per quantum
+ * maximum_proxies - number of proxies to initialize
*
* Output parameters: NONE
*/
void _Thread_Handler_initialization(
- unsigned32 maximum_tasks,
unsigned32 ticks_per_timeslice,
unsigned32 maximum_proxies
)
@@ -57,16 +56,6 @@ void _Thread_Handler_initialization(
_Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
- _Objects_Initialize_information(
- &_Thread_Information,
- OBJECTS_RTEMS_TASKS,
- TRUE,
- maximum_tasks,
- sizeof( Thread_Control ),
- FALSE,
- RTEMS_MAXIMUM_NAME_LENGTH
- );
-
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
(RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control)
);
@@ -789,22 +778,40 @@ boolean _Thread_Change_mode(
*
* NOTE: If we are not using static inlines, this must be a real
* subroutine call.
+ *
+ * NOTE: XXX... This routine may be able to be optimized.
*/
#ifndef USE_INLINES
STATIC INLINE Thread_Control *_Thread_Get (
- Objects_Id id,
- Objects_Locations *location
+ Objects_Id id,
+ Objects_Locations *location
)
{
+ Objects_Classes the_class;
+ Objects_Information *information;
+
if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
- _Thread_Disable_dispatch();
- *location = OBJECTS_LOCAL;
- return( _Thread_Executing );
+ _Thread_Disable_dispatch();
+ *location = OBJECTS_LOCAL;
+ return( _Thread_Executing );
}
-
- return (Thread_Control *) _Objects_Get( &_Thread_Information, id, location );
+
+ the_class = rtems_get_class( id );
+
+ if ( the_class > OBJECTS_CLASSES_LAST ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ information = _Objects_Information_table[ the_class ];
+
+ if ( !information || !information->is_thread ) {
+ *location = OBJECTS_ERROR;
+ return (Thread_Control *) 0;
+ }
+
+ return (Thread_Control *) _Objects_Get( information, id, location );
}
#endif
-