diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-08-23 21:06:31 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-08-23 21:06:31 +0000 |
commit | 5250ff39f042c09503b61eb81a2c705e9b06b917 (patch) | |
tree | c685bbf9969cc3ec5da6d24b7b353805d6371edb /c/src/exec | |
parent | Support for variable length names added to Object Handler. This supports (diff) | |
download | rtems-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 'c/src/exec')
26 files changed, 237 insertions, 96 deletions
diff --git a/c/src/exec/rtems/headers/tasks.h b/c/src/exec/rtems/headers/tasks.h index 88bf8e0e65..2f1021f8c9 100644 --- a/c/src/exec/rtems/headers/tasks.h +++ b/c/src/exec/rtems/headers/tasks.h @@ -62,6 +62,25 @@ extern "C" { #define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT /* + * The following defines the information control block used to + * manage this class of objects. + */ + +EXTERN Objects_Information _RTEMS_tasks_Information; + +/* + * _RTEMS_tasks_Manager_initialization + * + * DESCRIPTION: + * + * This routine initializes all Task Manager related data structures. + */ + +void _RTEMS_tasks_Manager_initialization( + unsigned32 maximum_tasks +); + +/* * rtems_task_create * * DESCRIPTION: diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h index 88bf8e0e65..2f1021f8c9 100644 --- a/c/src/exec/rtems/include/rtems/rtems/tasks.h +++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h @@ -62,6 +62,25 @@ extern "C" { #define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT /* + * The following defines the information control block used to + * manage this class of objects. + */ + +EXTERN Objects_Information _RTEMS_tasks_Information; + +/* + * _RTEMS_tasks_Manager_initialization + * + * DESCRIPTION: + * + * This routine initializes all Task Manager related data structures. + */ + +void _RTEMS_tasks_Manager_initialization( + unsigned32 maximum_tasks +); + +/* * rtems_task_create * * DESCRIPTION: diff --git a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl index 10d3e3c197..d392b8b370 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl @@ -30,7 +30,7 @@ STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void ) { - return (Thread_Control *) _Objects_Allocate( &_Thread_Information ); + return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information ); } /*PAGE @@ -43,7 +43,7 @@ STATIC INLINE void _RTEMS_tasks_Free ( Thread_Control *the_task ) { - _Objects_Free( &_Thread_Information, &the_task->Object ); + _Objects_Free( &_RTEMS_tasks_Information, &the_task->Object ); } /*PAGE diff --git a/c/src/exec/rtems/inline/tasks.inl b/c/src/exec/rtems/inline/tasks.inl index 10d3e3c197..d392b8b370 100644 --- a/c/src/exec/rtems/inline/tasks.inl +++ b/c/src/exec/rtems/inline/tasks.inl @@ -30,7 +30,7 @@ STATIC INLINE Thread_Control *_RTEMS_tasks_Allocate( void ) { - return (Thread_Control *) _Objects_Allocate( &_Thread_Information ); + return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information ); } /*PAGE @@ -43,7 +43,7 @@ STATIC INLINE void _RTEMS_tasks_Free ( Thread_Control *the_task ) { - _Objects_Free( &_Thread_Information, &the_task->Object ); + _Objects_Free( &_RTEMS_tasks_Information, &the_task->Object ); } /*PAGE diff --git a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl index 8fec704ea4..778d4867ca 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl @@ -29,7 +29,7 @@ */ #define _RTEMS_tasks_Allocate() \ - (Thread_Control *) _Objects_Allocate( &_Thread_Information ) + (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information ) /*PAGE * @@ -38,7 +38,7 @@ */ #define _RTEMS_tasks_Free( _the_task ) \ - _Objects_Free( &_Thread_Information, &(_the_task)->Object ) + _Objects_Free( &_RTEMS_tasks_Information, &(_the_task)->Object ) /*PAGE * diff --git a/c/src/exec/rtems/macros/tasks.inl b/c/src/exec/rtems/macros/tasks.inl index 8fec704ea4..778d4867ca 100644 --- a/c/src/exec/rtems/macros/tasks.inl +++ b/c/src/exec/rtems/macros/tasks.inl @@ -29,7 +29,7 @@ */ #define _RTEMS_tasks_Allocate() \ - (Thread_Control *) _Objects_Allocate( &_Thread_Information ) + (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information ) /*PAGE * @@ -38,7 +38,7 @@ */ #define _RTEMS_tasks_Free( _the_task ) \ - _Objects_Free( &_Thread_Information, &(_the_task)->Object ) + _Objects_Free( &_RTEMS_tasks_Information, &(_the_task)->Object ) /*PAGE * diff --git a/c/src/exec/rtems/src/dpmem.c b/c/src/exec/rtems/src/dpmem.c index ea2469f4c5..522c14866b 100644 --- a/c/src/exec/rtems/src/dpmem.c +++ b/c/src/exec/rtems/src/dpmem.c @@ -43,7 +43,8 @@ void _Dual_ported_memory_Manager_initialization( maximum_ports, sizeof( Dual_ported_memory_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/msg.c b/c/src/exec/rtems/src/msg.c index d7c456f90a..6dfd26a8f0 100644 --- a/c/src/exec/rtems/src/msg.c +++ b/c/src/exec/rtems/src/msg.c @@ -51,7 +51,8 @@ void _Message_queue_Manager_initialization( maximum_message_queues, sizeof( Message_queue_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c index b1e284c669..a7e4308a13 100644 --- a/c/src/exec/rtems/src/part.c +++ b/c/src/exec/rtems/src/part.c @@ -45,7 +45,8 @@ void _Partition_Manager_initialization( maximum_partitions, sizeof( Partition_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/ratemon.c b/c/src/exec/rtems/src/ratemon.c index 6e84c56fb3..c98de762af 100644 --- a/c/src/exec/rtems/src/ratemon.c +++ b/c/src/exec/rtems/src/ratemon.c @@ -47,7 +47,8 @@ void _Rate_monotonic_Manager_initialization( maximum_periods, sizeof( Rate_monotonic_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/region.c b/c/src/exec/rtems/src/region.c index 90916dcc3a..b54493eec7 100644 --- a/c/src/exec/rtems/src/region.c +++ b/c/src/exec/rtems/src/region.c @@ -45,7 +45,8 @@ void _Region_Manager_initialization( maximum_regions, sizeof( Region_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c index 2aad758269..68d9e4591b 100644 --- a/c/src/exec/rtems/src/rtemstimer.c +++ b/c/src/exec/rtems/src/rtemstimer.c @@ -44,7 +44,8 @@ void _Timer_Manager_initialization( maximum_timers, sizeof( Timer_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/sem.c b/c/src/exec/rtems/src/sem.c index 46dff9cdd7..d810c205ee 100644 --- a/c/src/exec/rtems/src/sem.c +++ b/c/src/exec/rtems/src/sem.c @@ -62,7 +62,8 @@ void _Semaphore_Manager_initialization( maximum_semaphores, sizeof( Semaphore_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/rtems/src/taskmp.c b/c/src/exec/rtems/src/taskmp.c index 17b08011ef..003c543c5a 100644 --- a/c/src/exec/rtems/src/taskmp.c +++ b/c/src/exec/rtems/src/taskmp.c @@ -194,7 +194,7 @@ void _RTEMS_tasks_MP_Process_packet ( case RTEMS_TASKS_MP_ANNOUNCE_CREATE: ignored = _Objects_MP_Open( - &_Thread_Information, + &_RTEMS_tasks_Information, the_packet->name, the_packet->Prefix.id, TRUE @@ -205,7 +205,7 @@ void _RTEMS_tasks_MP_Process_packet ( case RTEMS_TASKS_MP_ANNOUNCE_DELETE: - _Objects_MP_Close( &_Thread_Information, the_packet->Prefix.id ); + _Objects_MP_Close( &_RTEMS_tasks_Information, the_packet->Prefix.id ); _MPCI_Return_packet( the_packet_prefix ); break; diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 9cabbc50e9..5574a6633e 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -28,6 +28,34 @@ /*PAGE * + * _RTEMS_tasks_Manager_initialization + * + * This routine initializes all Task Manager related data structures. + * + * Input parameters: + * maximum_tasks - number of tasks to initialize + * + * Output parameters: NONE + */ + +void _RTEMS_tasks_Manager_initialization( + unsigned32 maximum_tasks +) +{ + _Objects_Initialize_information( + &_RTEMS_tasks_Information, + OBJECTS_RTEMS_TASKS, + TRUE, + maximum_tasks, + sizeof( Thread_Control ), + FALSE, + RTEMS_MAXIMUM_NAME_LENGTH, + TRUE + ); +} + +/*PAGE + * * rtems_task_create * * This directive creates a thread by allocating and initializing a @@ -136,7 +164,7 @@ rtems_status_code rtems_task_create( the_thread->Start.fp_context = the_thread->fp_context; if ( _Attributes_Is_global( the_attribute_set ) && - !( _Objects_MP_Open( &_Thread_Information, name, + !( _Objects_MP_Open( &_RTEMS_tasks_Information, name, the_thread->Object.id, FALSE ) ) ) { _RTEMS_tasks_Free( the_thread ); (void) _Workspace_Free( memory ); @@ -157,7 +185,7 @@ rtems_status_code rtems_task_create( _ASR_Initialize( &the_thread->Signal ); - _Objects_Open( &_Thread_Information, &the_thread->Object, &name ); + _Objects_Open( &_RTEMS_tasks_Information, &the_thread->Object, &name ); *id = the_thread->Object.id; @@ -199,7 +227,7 @@ rtems_status_code rtems_task_ident( ) { if ( name != OBJECTS_ID_OF_SELF ) - return( _Objects_Name_to_id( &_Thread_Information, &name, node, id ) ); + return( _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ) ); *id = _Thread_Executing->Object.id; return( RTEMS_SUCCESSFUL ); @@ -368,7 +396,7 @@ rtems_status_code rtems_task_delete( _Thread_Dispatch(); return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); case OBJECTS_LOCAL: - _Objects_Close( &_Thread_Information, &the_thread->Object ); + _Objects_Close( &_RTEMS_tasks_Information, &the_thread->Object ); _Thread_Set_state( the_thread, STATES_TRANSIENT ); @@ -388,7 +416,7 @@ rtems_status_code rtems_task_delete( if ( _Attributes_Is_global( the_thread->attribute_set ) ) { - _Objects_MP_Close( &_Thread_Information, the_thread->Object.id ); + _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id ); _RTEMS_tasks_MP_Send_process_packet( RTEMS_TASKS_MP_ANNOUNCE_DELETE, diff --git a/c/src/exec/rtems/src/timer.c b/c/src/exec/rtems/src/timer.c index 2aad758269..68d9e4591b 100644 --- a/c/src/exec/rtems/src/timer.c +++ b/c/src/exec/rtems/src/timer.c @@ -44,7 +44,8 @@ void _Timer_Manager_initialization( maximum_timers, sizeof( Timer_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/sapi/src/exinit.c b/c/src/exec/sapi/src/exinit.c index 2d3261c256..f85504b18d 100644 --- a/c/src/exec/sapi/src/exinit.c +++ b/c/src/exec/sapi/src/exinit.c @@ -152,7 +152,6 @@ rtems_interrupt_level rtems_initialize_executive_early( _TOD_Handler_initialization( configuration_table->microseconds_per_tick ); _Thread_Handler_initialization( - configuration_table->maximum_tasks, configuration_table->ticks_per_timeslice, multiprocessing_table->maximum_proxies ); @@ -165,6 +164,8 @@ rtems_interrupt_level rtems_initialize_executive_early( _Multiprocessing_Manager_initialization(); + _RTEMS_tasks_Manager_initialization( configuration_table->maximum_tasks ); + _Timer_Manager_initialization( configuration_table->maximum_timers ); _Extension_Manager_initialization( configuration_table->maximum_extensions ); diff --git a/c/src/exec/sapi/src/extension.c b/c/src/exec/sapi/src/extension.c index 8f5f5d998a..a962ad270e 100644 --- a/c/src/exec/sapi/src/extension.c +++ b/c/src/exec/sapi/src/extension.c @@ -42,7 +42,8 @@ void _Extension_Manager_initialization( maximum_extensions, sizeof( Extension_Control ), FALSE, - RTEMS_MAXIMUM_NAME_LENGTH + RTEMS_MAXIMUM_NAME_LENGTH, + FALSE ); } diff --git a/c/src/exec/score/headers/object.h b/c/src/exec/score/headers/object.h index c5226302d6..5c84868dc1 100644 --- a/c/src/exec/score/headers/object.h +++ b/c/src/exec/score/headers/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/c/src/exec/score/headers/thread.h b/c/src/exec/score/headers/thread.h index ddae52a363..9c5d0b040b 100644 --- a/c/src/exec/score/headers/thread.h +++ b/c/src/exec/score/headers/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/c/src/exec/score/include/rtems/score/object.h b/c/src/exec/score/include/rtems/score/object.h index c5226302d6..5c84868dc1 100644 --- a/c/src/exec/score/include/rtems/score/object.h +++ b/c/src/exec/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/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h index ddae52a363..9c5d0b040b 100644 --- a/c/src/exec/score/include/rtems/score/thread.h +++ b/c/src/exec/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/c/src/exec/score/inline/rtems/score/thread.inl b/c/src/exec/score/inline/rtems/score/thread.inl index 35b8eeccfe..2a1049f241 100644 --- a/c/src/exec/score/inline/rtems/score/thread.inl +++ b/c/src/exec/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/c/src/exec/score/inline/thread.inl b/c/src/exec/score/inline/thread.inl index 35b8eeccfe..2a1049f241 100644 --- a/c/src/exec/score/inline/thread.inl +++ b/c/src/exec/score/inline/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/c/src/exec/score/src/object.c b/c/src/exec/score/src/object.c index 5b64ea8802..b829258a48 100644 --- a/c/src/exec/score/src/object.c +++ b/c/src/exec/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/c/src/exec/score/src/thread.c b/c/src/exec/score/src/thread.c index 9793792b44..c4dde3e6f8 100644 --- a/c/src/exec/score/src/thread.c +++ b/c/src/exec/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 - |