diff options
56 files changed, 378 insertions, 242 deletions
diff --git a/c/src/exec/rtems/ChangeLog b/c/src/exec/rtems/ChangeLog index a3e6d0729a..5073d3d127 100644 --- a/c/src/exec/rtems/ChangeLog +++ b/c/src/exec/rtems/ChangeLog @@ -1,3 +1,31 @@ +2002-07-01 Joel Sherrill <joel@OARcorp.com> + + * Mega patch merge to change the format of the object IDs to + loosen the dependency between the SCORE and the various APIs. + There was considerable work to simplify the object name management + and it appears that the name_table field is no longer needed. + This patch also includes the addition of the internal mutex + which is currently only used to protect some types of allocation + and deallocation. This significantly can reduce context + switch latency under certain circumstances. In particular, + some heap/region operations were O(n) and had dispatching + disabled. This should help enormously. With this merge, + the patch is not as clean as it should be. In particular, + the documentation has not been modified to reflect the new object + ID layout, the IDs in the test screens are not updated, and + _Objects_Get_information needs to be a real routine not inlined. + As part of this patch a lot of MP code for thread/proxy blocking + was made conditional and cleaned up. + * include/rtems.h, inline/rtems/rtems/region.inl, + macros/rtems/rtems/region.inl, src/dpmem.c, src/dpmemcreate.c, + src/msg.c, src/msgqcreate.c, src/part.c, src/partcreate.c, + src/ratemon.c, src/ratemoncreate.c, src/region.c, src/regioncreate.c, + src/regiondelete.c, src/regionextend.c, src/regiongetinfo.c, + src/regiongetsegment.c, src/regiongetsegmentsize.c, + src/regionident.c, src/regionreturnsegment.c, src/rtemstimer.c, + src/sem.c, src/semcreate.c, src/taskcreate.c, src/taskident.c, + src/tasks.c, src/timercreate.c: Modified as part of above. + 2001-04-08 Joel Sherrill <joel@OARcorp.com> * src/tasks.c: Pre-initialized switch extension for list. diff --git a/c/src/exec/rtems/include/rtems.h b/c/src/exec/rtems/include/rtems.h index 99457be2f0..0ca040e9e4 100644 --- a/c/src/exec/rtems/include/rtems.h +++ b/c/src/exec/rtems/include/rtems.h @@ -82,8 +82,8 @@ extern "C" { #define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX #define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX +#define RTEMS_OBJECT_ID_INITIAL(api, class, node) OBJECTS_ID_INITIAL(api, class, node) -#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node) #define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL /* diff --git a/c/src/exec/rtems/inline/rtems/rtems/region.inl b/c/src/exec/rtems/inline/rtems/rtems/region.inl index 1f2b8f766c..d61afaee3f 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/region.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/region.inl @@ -67,7 +67,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get ( ) { return (Region_Control *) - _Objects_Get( &_Region_Information, id, location ); + _Objects_Get_no_protection( &_Region_Information, id, location ); } /*PAGE diff --git a/c/src/exec/rtems/macros/rtems/rtems/region.inl b/c/src/exec/rtems/macros/rtems/rtems/region.inl index 2576a08bec..02e95fdea2 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/region.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/region.inl @@ -42,7 +42,7 @@ #define _Region_Get( _id, _location ) \ (Region_Control *) \ - _Objects_Get( &_Region_Information, (_id), (_location) ) + _Objects_Get_no_protection( &_Region_Information, (_id), (_location) ) /*PAGE * diff --git a/c/src/exec/rtems/src/dpmem.c b/c/src/exec/rtems/src/dpmem.c index 38ca108a1a..9a3b663260 100644 --- a/c/src/exec/rtems/src/dpmem.c +++ b/c/src/exec/rtems/src/dpmem.c @@ -38,13 +38,18 @@ void _Dual_ported_memory_Manager_initialization( ) { _Objects_Initialize_information( - &_Dual_ported_memory_Information, - OBJECTS_RTEMS_PORTS, - FALSE, - maximum_ports, + &_Dual_ported_memory_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_PORTS, /* object class */ + maximum_ports, /* maximum objects of this class */ sizeof( Dual_ported_memory_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + /* size of this object's control block */ + FALSE, /* TRUE if names of this object are strings */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); } diff --git a/c/src/exec/rtems/src/dpmemcreate.c b/c/src/exec/rtems/src/dpmemcreate.c index 8d4bdbdb10..951391d8b6 100644 --- a/c/src/exec/rtems/src/dpmemcreate.c +++ b/c/src/exec/rtems/src/dpmemcreate.c @@ -72,7 +72,7 @@ rtems_status_code rtems_port_create( _Objects_Open( &_Dual_ported_memory_Information, &the_port->Object, - &name + name ); *id = the_port->Object.id; diff --git a/c/src/exec/rtems/src/msg.c b/c/src/exec/rtems/src/msg.c index 4e68b175b3..62529b6dd2 100644 --- a/c/src/exec/rtems/src/msg.c +++ b/c/src/exec/rtems/src/msg.c @@ -48,14 +48,19 @@ void _Message_queue_Manager_initialization( ) { _Objects_Initialize_information( - &_Message_queue_Information, - OBJECTS_RTEMS_MESSAGE_QUEUES, - TRUE, - maximum_message_queues, + &_Message_queue_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_MESSAGE_QUEUES, /* object class */ + maximum_message_queues, /* maximum objects of this class */ sizeof( Message_queue_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + /* size of this object's control block */ + FALSE, /* TRUE if names of this object are strings */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/c/src/exec/rtems/src/msgqcreate.c b/c/src/exec/rtems/src/msgqcreate.c index 24bc35993d..537704360b 100644 --- a/c/src/exec/rtems/src/msgqcreate.c +++ b/c/src/exec/rtems/src/msgqcreate.c @@ -60,7 +60,6 @@ rtems_status_code rtems_message_queue_create( { register Message_queue_Control *the_message_queue; CORE_message_queue_Attributes the_msgq_attributes; - void *handler; #if defined(RTEMS_MULTIPROCESSING) boolean is_global; #endif @@ -119,18 +118,12 @@ rtems_status_code rtems_message_queue_create( else the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; - handler = NULL; -#if defined(RTEMS_MULTIPROCESSING) - handler = _Message_queue_MP_Send_extract_proxy; -#endif - if ( ! _CORE_message_queue_Initialize( &the_message_queue->message_queue, - OBJECTS_RTEMS_MESSAGE_QUEUES, &the_msgq_attributes, count, - max_message_size, - handler ) ) { + max_message_size + ) ) { #if defined(RTEMS_MULTIPROCESSING) if ( is_global ) _Objects_MP_Close( @@ -145,7 +138,7 @@ rtems_status_code rtems_message_queue_create( _Objects_Open( &_Message_queue_Information, &the_message_queue->Object, - &name + name ); *id = the_message_queue->Object.id; diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c index 7e13628450..add2a77f9f 100644 --- a/c/src/exec/rtems/src/part.c +++ b/c/src/exec/rtems/src/part.c @@ -39,14 +39,18 @@ void _Partition_Manager_initialization( ) { _Objects_Initialize_information( - &_Partition_Information, - OBJECTS_RTEMS_PARTITIONS, - TRUE, - maximum_partitions, - sizeof( Partition_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Partition_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_PARTITIONS, /* object class */ + maximum_partitions, /* maximum objects of this class */ + sizeof( Partition_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/c/src/exec/rtems/src/partcreate.c b/c/src/exec/rtems/src/partcreate.c index 70b0585df7..ffd398b3e1 100644 --- a/c/src/exec/rtems/src/partcreate.c +++ b/c/src/exec/rtems/src/partcreate.c @@ -97,7 +97,7 @@ rtems_status_code rtems_partition_create( _Chain_Initialize( &the_partition->Memory, starting_address, length / buffer_size, buffer_size ); - _Objects_Open( &_Partition_Information, &the_partition->Object, &name ); + _Objects_Open( &_Partition_Information, &the_partition->Object, name ); *id = the_partition->Object.id; #if defined(RTEMS_MULTIPROCESSING) diff --git a/c/src/exec/rtems/src/ratemon.c b/c/src/exec/rtems/src/ratemon.c index 29ded58b6a..979787afa3 100644 --- a/c/src/exec/rtems/src/ratemon.c +++ b/c/src/exec/rtems/src/ratemon.c @@ -41,13 +41,17 @@ void _Rate_monotonic_Manager_initialization( ) { _Objects_Initialize_information( - &_Rate_monotonic_Information, - OBJECTS_RTEMS_PERIODS, - FALSE, - maximum_periods, - sizeof( Rate_monotonic_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Rate_monotonic_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_PERIODS, /* object class */ + maximum_periods, /* maximum objects of this class */ + sizeof( Rate_monotonic_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); } diff --git a/c/src/exec/rtems/src/ratemoncreate.c b/c/src/exec/rtems/src/ratemoncreate.c index 1fb4a9d466..a27fa2ee7a 100644 --- a/c/src/exec/rtems/src/ratemoncreate.c +++ b/c/src/exec/rtems/src/ratemoncreate.c @@ -59,7 +59,7 @@ rtems_status_code rtems_rate_monotonic_create( the_period->owner = _Thread_Executing; the_period->state = RATE_MONOTONIC_INACTIVE; - _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name ); + _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, name ); *id = the_period->Object.id; _Thread_Enable_dispatch(); diff --git a/c/src/exec/rtems/src/region.c b/c/src/exec/rtems/src/region.c index b00ba8bf52..ee627e65a4 100644 --- a/c/src/exec/rtems/src/region.c +++ b/c/src/exec/rtems/src/region.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -37,15 +38,23 @@ void _Region_Manager_initialization( unsigned32 maximum_regions ) { + /* XXX move me */ + _API_Mutex_Initialization( 1 ); + _API_Mutex_Allocate( _RTEMS_Allocator_Mutex ); + _Objects_Initialize_information( - &_Region_Information, - OBJECTS_RTEMS_REGIONS, - FALSE, - maximum_regions, - sizeof( Region_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Region_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_REGIONS, /* object class */ + maximum_regions, /* maximum objects of this class */ + sizeof( Region_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/c/src/exec/rtems/src/regioncreate.c b/c/src/exec/rtems/src/regioncreate.c index cacef3fe0b..1bb8620a88 100644 --- a/c/src/exec/rtems/src/regioncreate.c +++ b/c/src/exec/rtems/src/regioncreate.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -59,12 +60,12 @@ rtems_status_code rtems_region_create( if ( !_Addresses_Is_aligned( starting_address ) ) return RTEMS_INVALID_ADDRESS; - _Thread_Disable_dispatch(); /* to prevent deletion */ + _RTEMS_Lock_allocator(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_TOO_MANY; } @@ -73,7 +74,7 @@ rtems_status_code rtems_region_create( if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_SIZE; } @@ -85,21 +86,15 @@ rtems_status_code rtems_region_create( _Thread_queue_Initialize( &the_region->Wait_queue, - OBJECTS_RTEMS_REGIONS, _Attributes_Is_priority( attribute_set ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, STATES_WAITING_FOR_SEGMENT, -#if defined(RTEMS_MULTIPROCESSING) - _Region_MP_Send_extract_proxy, -#else - NULL, -#endif RTEMS_TIMEOUT ); - _Objects_Open( &_Region_Information, &the_region->Object, &name ); + _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } diff --git a/c/src/exec/rtems/src/regiondelete.c b/c/src/exec/rtems/src/regiondelete.c index 669923c2e7..9b7c297d7a 100644 --- a/c/src/exec/rtems/src/regiondelete.c +++ b/c/src/exec/rtems/src/regiondelete.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -44,12 +45,15 @@ rtems_status_code rtems_region_delete( register Region_Control *the_region; Objects_Locations location; + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: @@ -57,10 +61,10 @@ rtems_status_code rtems_region_delete( if ( the_region->number_of_used_blocks == 0 ) { _Objects_Close( &_Region_Information, &the_region->Object ); _Region_Free( the_region ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_RESOURCE_IN_USE; } diff --git a/c/src/exec/rtems/src/regionextend.c b/c/src/exec/rtems/src/regionextend.c index 0bbfac73b4..c36969beda 100644 --- a/c/src/exec/rtems/src/regionextend.c +++ b/c/src/exec/rtems/src/regionextend.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -52,12 +53,15 @@ rtems_status_code rtems_region_extend( status = RTEMS_SUCCESSFUL; + _RTEMS_Lock_allocator(); /* to prevent deletion */ the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: @@ -81,7 +85,7 @@ rtems_status_code rtems_region_extend( status = RTEMS_NOT_IMPLEMENTED; break; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return( status ); } diff --git a/c/src/exec/rtems/src/regiongetinfo.c b/c/src/exec/rtems/src/regiongetinfo.c index 1e9338e3cd..2f7f21b72a 100644 --- a/c/src/exec/rtems/src/regiongetinfo.c +++ b/c/src/exec/rtems/src/regiongetinfo.c @@ -19,6 +19,7 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/region.h> #include <rtems/score/states.h> +#include <rtems/score/apimutex.h> #include <rtems/score/thread.h> /*PAGE @@ -48,21 +49,24 @@ rtems_status_code rtems_region_get_information( if ( !the_info ) return RTEMS_INVALID_ADDRESS; + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( _Heap_Get_information( &the_region->Memory, the_info ) ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } diff --git a/c/src/exec/rtems/src/regiongetsegment.c b/c/src/exec/rtems/src/regiongetsegment.c index 07a31c011e..613cec1303 100644 --- a/c/src/exec/rtems/src/regiongetsegment.c +++ b/c/src/exec/rtems/src/regiongetsegment.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -58,18 +59,21 @@ rtems_status_code rtems_region_get_segment( if ( size == 0 ) return RTEMS_INVALID_SIZE; + _RTEMS_Lock_allocator(); executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( size > the_region->maximum_segment_size ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_SIZE; } @@ -81,13 +85,13 @@ rtems_status_code rtems_region_get_segment( if ( the_segment ) { the_region->number_of_used_blocks += 1; - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); *segment = the_segment; return RTEMS_SUCCESSFUL; } if ( _Options_Is_no_wait( option_set ) ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_UNSATISFIED; } @@ -100,7 +104,7 @@ rtems_status_code rtems_region_get_segment( _Thread_queue_Enqueue( &the_region->Wait_queue, timeout ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return (rtems_status_code) executing->Wait.return_code; } diff --git a/c/src/exec/rtems/src/regiongetsegmentsize.c b/c/src/exec/rtems/src/regiongetsegmentsize.c index 63d8c96b1c..abdf755173 100644 --- a/c/src/exec/rtems/src/regiongetsegmentsize.c +++ b/c/src/exec/rtems/src/regiongetsegmentsize.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -48,22 +49,25 @@ rtems_status_code rtems_region_get_segment_size( Objects_Locations location; Thread_Control *executing; + _RTEMS_Lock_allocator(); executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } diff --git a/c/src/exec/rtems/src/regionident.c b/c/src/exec/rtems/src/regionident.c index 57ca7638ed..5a43f25a19 100644 --- a/c/src/exec/rtems/src/regionident.c +++ b/c/src/exec/rtems/src/regionident.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * diff --git a/c/src/exec/rtems/src/regionreturnsegment.c b/c/src/exec/rtems/src/regionreturnsegment.c index e5174e578b..f144145afd 100644 --- a/c/src/exec/rtems/src/regionreturnsegment.c +++ b/c/src/exec/rtems/src/regionreturnsegment.c @@ -28,6 +28,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -58,13 +59,16 @@ rtems_status_code rtems_region_return_segment( #endif int status; + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: @@ -75,7 +79,7 @@ rtems_status_code rtems_region_return_segment( if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size); } else { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } #endif @@ -85,7 +89,7 @@ rtems_status_code rtems_region_return_segment( _Region_Debug_Walk( the_region, 4 ); if ( !status ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } @@ -110,7 +114,7 @@ rtems_status_code rtems_region_return_segment( the_thread->Wait.return_code = RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c index 6954f1dec6..442f1656f7 100644 --- a/c/src/exec/rtems/src/rtemstimer.c +++ b/c/src/exec/rtems/src/rtemstimer.c @@ -38,14 +38,18 @@ void _Timer_Manager_initialization( ) { _Objects_Initialize_information( - &_Timer_Information, - OBJECTS_RTEMS_TIMERS, - FALSE, - maximum_timers, - sizeof( Timer_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Timer_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_TIMERS, /* object class */ + maximum_timers, /* maximum objects of this class */ + sizeof( Timer_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/c/src/exec/rtems/src/sem.c b/c/src/exec/rtems/src/sem.c index 6f2db08ded..8c8df032a9 100644 --- a/c/src/exec/rtems/src/sem.c +++ b/c/src/exec/rtems/src/sem.c @@ -62,14 +62,18 @@ void _Semaphore_Manager_initialization( ) { _Objects_Initialize_information( - &_Semaphore_Information, - OBJECTS_RTEMS_SEMAPHORES, - TRUE, - maximum_semaphores, - sizeof( Semaphore_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Semaphore_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_SEMAPHORES, /* object class */ + maximum_semaphores, /* maximum objects of this class */ + sizeof( Semaphore_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/c/src/exec/rtems/src/semcreate.c b/c/src/exec/rtems/src/semcreate.c index a0c015cde4..5d0fffb575 100644 --- a/c/src/exec/rtems/src/semcreate.c +++ b/c/src/exec/rtems/src/semcreate.c @@ -172,14 +172,8 @@ rtems_status_code rtems_semaphore_create( _CORE_mutex_Initialize( &the_semaphore->Core_control.mutex, - OBJECTS_RTEMS_SEMAPHORES, &the_mutex_attributes, - lock, -#if defined(RTEMS_MULTIPROCESSING) - _Semaphore_MP_Send_extract_proxy -#else - NULL -#endif + lock ); } else { if ( _Attributes_Is_priority( attribute_set ) ) @@ -202,18 +196,12 @@ rtems_status_code rtems_semaphore_create( _CORE_semaphore_Initialize( &the_semaphore->Core_control.semaphore, - OBJECTS_RTEMS_SEMAPHORES, &the_semaphore_attributes, - count, -#if defined(RTEMS_MULTIPROCESSING) - _Semaphore_MP_Send_extract_proxy -#else - NULL -#endif + count ); } - _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name ); + _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, name ); *id = the_semaphore->Object.id; diff --git a/c/src/exec/rtems/src/taskcreate.c b/c/src/exec/rtems/src/taskcreate.c index 6183079c66..c445589687 100644 --- a/c/src/exec/rtems/src/taskcreate.c +++ b/c/src/exec/rtems/src/taskcreate.c @@ -182,7 +182,7 @@ rtems_status_code rtems_task_create( THREAD_CPU_BUDGET_ALGORITHM_NONE, NULL, /* no budget algorithm callout */ _Modes_Get_interrupt_level(initial_modes), - &name + name ); if ( !status ) { diff --git a/c/src/exec/rtems/src/taskident.c b/c/src/exec/rtems/src/taskident.c index 7d6baff020..f58b462814 100644 --- a/c/src/exec/rtems/src/taskident.c +++ b/c/src/exec/rtems/src/taskident.c @@ -59,7 +59,7 @@ rtems_status_code rtems_task_ident( return RTEMS_SUCCESSFUL; } - status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ); + status = _Objects_Name_to_id( &_RTEMS_tasks_Information, name, node, id ); return _Status_Object_name_errors_to_status[ status ]; } diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index f9c7dfb5cf..d8fc8a0564 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -249,14 +249,18 @@ void _RTEMS_tasks_Manager_initialization( #endif _Objects_Initialize_information( - &_RTEMS_tasks_Information, - OBJECTS_RTEMS_TASKS, - TRUE, - maximum_tasks, - sizeof( Thread_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - TRUE + &_RTEMS_tasks_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_TASKS, /* object class */ + maximum_tasks, /* maximum objects of this class */ + sizeof( Thread_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/c/src/exec/rtems/src/timercreate.c b/c/src/exec/rtems/src/timercreate.c index a1734e980f..a2e1fb72c5 100644 --- a/c/src/exec/rtems/src/timercreate.c +++ b/c/src/exec/rtems/src/timercreate.c @@ -58,7 +58,7 @@ rtems_status_code rtems_timer_create( the_timer->the_class = TIMER_DORMANT; - _Objects_Open( &_Timer_Information, &the_timer->Object, &name ); + _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); diff --git a/cpukit/rtems/ChangeLog b/cpukit/rtems/ChangeLog index a3e6d0729a..5073d3d127 100644 --- a/cpukit/rtems/ChangeLog +++ b/cpukit/rtems/ChangeLog @@ -1,3 +1,31 @@ +2002-07-01 Joel Sherrill <joel@OARcorp.com> + + * Mega patch merge to change the format of the object IDs to + loosen the dependency between the SCORE and the various APIs. + There was considerable work to simplify the object name management + and it appears that the name_table field is no longer needed. + This patch also includes the addition of the internal mutex + which is currently only used to protect some types of allocation + and deallocation. This significantly can reduce context + switch latency under certain circumstances. In particular, + some heap/region operations were O(n) and had dispatching + disabled. This should help enormously. With this merge, + the patch is not as clean as it should be. In particular, + the documentation has not been modified to reflect the new object + ID layout, the IDs in the test screens are not updated, and + _Objects_Get_information needs to be a real routine not inlined. + As part of this patch a lot of MP code for thread/proxy blocking + was made conditional and cleaned up. + * include/rtems.h, inline/rtems/rtems/region.inl, + macros/rtems/rtems/region.inl, src/dpmem.c, src/dpmemcreate.c, + src/msg.c, src/msgqcreate.c, src/part.c, src/partcreate.c, + src/ratemon.c, src/ratemoncreate.c, src/region.c, src/regioncreate.c, + src/regiondelete.c, src/regionextend.c, src/regiongetinfo.c, + src/regiongetsegment.c, src/regiongetsegmentsize.c, + src/regionident.c, src/regionreturnsegment.c, src/rtemstimer.c, + src/sem.c, src/semcreate.c, src/taskcreate.c, src/taskident.c, + src/tasks.c, src/timercreate.c: Modified as part of above. + 2001-04-08 Joel Sherrill <joel@OARcorp.com> * src/tasks.c: Pre-initialized switch extension for list. diff --git a/cpukit/rtems/include/rtems.h b/cpukit/rtems/include/rtems.h index 99457be2f0..0ca040e9e4 100644 --- a/cpukit/rtems/include/rtems.h +++ b/cpukit/rtems/include/rtems.h @@ -82,8 +82,8 @@ extern "C" { #define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX #define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX +#define RTEMS_OBJECT_ID_INITIAL(api, class, node) OBJECTS_ID_INITIAL(api, class, node) -#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node) #define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL /* diff --git a/cpukit/rtems/inline/rtems/rtems/region.inl b/cpukit/rtems/inline/rtems/rtems/region.inl index 1f2b8f766c..d61afaee3f 100644 --- a/cpukit/rtems/inline/rtems/rtems/region.inl +++ b/cpukit/rtems/inline/rtems/rtems/region.inl @@ -67,7 +67,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get ( ) { return (Region_Control *) - _Objects_Get( &_Region_Information, id, location ); + _Objects_Get_no_protection( &_Region_Information, id, location ); } /*PAGE diff --git a/cpukit/rtems/macros/rtems/rtems/region.inl b/cpukit/rtems/macros/rtems/rtems/region.inl index 2576a08bec..02e95fdea2 100644 --- a/cpukit/rtems/macros/rtems/rtems/region.inl +++ b/cpukit/rtems/macros/rtems/rtems/region.inl @@ -42,7 +42,7 @@ #define _Region_Get( _id, _location ) \ (Region_Control *) \ - _Objects_Get( &_Region_Information, (_id), (_location) ) + _Objects_Get_no_protection( &_Region_Information, (_id), (_location) ) /*PAGE * diff --git a/cpukit/rtems/src/dpmem.c b/cpukit/rtems/src/dpmem.c index 38ca108a1a..9a3b663260 100644 --- a/cpukit/rtems/src/dpmem.c +++ b/cpukit/rtems/src/dpmem.c @@ -38,13 +38,18 @@ void _Dual_ported_memory_Manager_initialization( ) { _Objects_Initialize_information( - &_Dual_ported_memory_Information, - OBJECTS_RTEMS_PORTS, - FALSE, - maximum_ports, + &_Dual_ported_memory_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_PORTS, /* object class */ + maximum_ports, /* maximum objects of this class */ sizeof( Dual_ported_memory_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + /* size of this object's control block */ + FALSE, /* TRUE if names of this object are strings */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); } diff --git a/cpukit/rtems/src/dpmemcreate.c b/cpukit/rtems/src/dpmemcreate.c index 8d4bdbdb10..951391d8b6 100644 --- a/cpukit/rtems/src/dpmemcreate.c +++ b/cpukit/rtems/src/dpmemcreate.c @@ -72,7 +72,7 @@ rtems_status_code rtems_port_create( _Objects_Open( &_Dual_ported_memory_Information, &the_port->Object, - &name + name ); *id = the_port->Object.id; diff --git a/cpukit/rtems/src/msg.c b/cpukit/rtems/src/msg.c index 4e68b175b3..62529b6dd2 100644 --- a/cpukit/rtems/src/msg.c +++ b/cpukit/rtems/src/msg.c @@ -48,14 +48,19 @@ void _Message_queue_Manager_initialization( ) { _Objects_Initialize_information( - &_Message_queue_Information, - OBJECTS_RTEMS_MESSAGE_QUEUES, - TRUE, - maximum_message_queues, + &_Message_queue_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_MESSAGE_QUEUES, /* object class */ + maximum_message_queues, /* maximum objects of this class */ sizeof( Message_queue_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + /* size of this object's control block */ + FALSE, /* TRUE if names of this object are strings */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of each object's name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/cpukit/rtems/src/msgqcreate.c b/cpukit/rtems/src/msgqcreate.c index 24bc35993d..537704360b 100644 --- a/cpukit/rtems/src/msgqcreate.c +++ b/cpukit/rtems/src/msgqcreate.c @@ -60,7 +60,6 @@ rtems_status_code rtems_message_queue_create( { register Message_queue_Control *the_message_queue; CORE_message_queue_Attributes the_msgq_attributes; - void *handler; #if defined(RTEMS_MULTIPROCESSING) boolean is_global; #endif @@ -119,18 +118,12 @@ rtems_status_code rtems_message_queue_create( else the_msgq_attributes.discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; - handler = NULL; -#if defined(RTEMS_MULTIPROCESSING) - handler = _Message_queue_MP_Send_extract_proxy; -#endif - if ( ! _CORE_message_queue_Initialize( &the_message_queue->message_queue, - OBJECTS_RTEMS_MESSAGE_QUEUES, &the_msgq_attributes, count, - max_message_size, - handler ) ) { + max_message_size + ) ) { #if defined(RTEMS_MULTIPROCESSING) if ( is_global ) _Objects_MP_Close( @@ -145,7 +138,7 @@ rtems_status_code rtems_message_queue_create( _Objects_Open( &_Message_queue_Information, &the_message_queue->Object, - &name + name ); *id = the_message_queue->Object.id; diff --git a/cpukit/rtems/src/part.c b/cpukit/rtems/src/part.c index 7e13628450..add2a77f9f 100644 --- a/cpukit/rtems/src/part.c +++ b/cpukit/rtems/src/part.c @@ -39,14 +39,18 @@ void _Partition_Manager_initialization( ) { _Objects_Initialize_information( - &_Partition_Information, - OBJECTS_RTEMS_PARTITIONS, - TRUE, - maximum_partitions, - sizeof( Partition_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Partition_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_PARTITIONS, /* object class */ + maximum_partitions, /* maximum objects of this class */ + sizeof( Partition_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c index 70b0585df7..ffd398b3e1 100644 --- a/cpukit/rtems/src/partcreate.c +++ b/cpukit/rtems/src/partcreate.c @@ -97,7 +97,7 @@ rtems_status_code rtems_partition_create( _Chain_Initialize( &the_partition->Memory, starting_address, length / buffer_size, buffer_size ); - _Objects_Open( &_Partition_Information, &the_partition->Object, &name ); + _Objects_Open( &_Partition_Information, &the_partition->Object, name ); *id = the_partition->Object.id; #if defined(RTEMS_MULTIPROCESSING) diff --git a/cpukit/rtems/src/ratemon.c b/cpukit/rtems/src/ratemon.c index 29ded58b6a..979787afa3 100644 --- a/cpukit/rtems/src/ratemon.c +++ b/cpukit/rtems/src/ratemon.c @@ -41,13 +41,17 @@ void _Rate_monotonic_Manager_initialization( ) { _Objects_Initialize_information( - &_Rate_monotonic_Information, - OBJECTS_RTEMS_PERIODS, - FALSE, - maximum_periods, - sizeof( Rate_monotonic_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Rate_monotonic_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_PERIODS, /* object class */ + maximum_periods, /* maximum objects of this class */ + sizeof( Rate_monotonic_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); } diff --git a/cpukit/rtems/src/ratemoncreate.c b/cpukit/rtems/src/ratemoncreate.c index 1fb4a9d466..a27fa2ee7a 100644 --- a/cpukit/rtems/src/ratemoncreate.c +++ b/cpukit/rtems/src/ratemoncreate.c @@ -59,7 +59,7 @@ rtems_status_code rtems_rate_monotonic_create( the_period->owner = _Thread_Executing; the_period->state = RATE_MONOTONIC_INACTIVE; - _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, &name ); + _Objects_Open( &_Rate_monotonic_Information, &the_period->Object, name ); *id = the_period->Object.id; _Thread_Enable_dispatch(); diff --git a/cpukit/rtems/src/region.c b/cpukit/rtems/src/region.c index b00ba8bf52..ee627e65a4 100644 --- a/cpukit/rtems/src/region.c +++ b/cpukit/rtems/src/region.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -37,15 +38,23 @@ void _Region_Manager_initialization( unsigned32 maximum_regions ) { + /* XXX move me */ + _API_Mutex_Initialization( 1 ); + _API_Mutex_Allocate( _RTEMS_Allocator_Mutex ); + _Objects_Initialize_information( - &_Region_Information, - OBJECTS_RTEMS_REGIONS, - FALSE, - maximum_regions, - sizeof( Region_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Region_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_REGIONS, /* object class */ + maximum_regions, /* maximum objects of this class */ + sizeof( Region_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index cacef3fe0b..1bb8620a88 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -59,12 +60,12 @@ rtems_status_code rtems_region_create( if ( !_Addresses_Is_aligned( starting_address ) ) return RTEMS_INVALID_ADDRESS; - _Thread_Disable_dispatch(); /* to prevent deletion */ + _RTEMS_Lock_allocator(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_TOO_MANY; } @@ -73,7 +74,7 @@ rtems_status_code rtems_region_create( if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_SIZE; } @@ -85,21 +86,15 @@ rtems_status_code rtems_region_create( _Thread_queue_Initialize( &the_region->Wait_queue, - OBJECTS_RTEMS_REGIONS, _Attributes_Is_priority( attribute_set ) ? THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, STATES_WAITING_FOR_SEGMENT, -#if defined(RTEMS_MULTIPROCESSING) - _Region_MP_Send_extract_proxy, -#else - NULL, -#endif RTEMS_TIMEOUT ); - _Objects_Open( &_Region_Information, &the_region->Object, &name ); + _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } diff --git a/cpukit/rtems/src/regiondelete.c b/cpukit/rtems/src/regiondelete.c index 669923c2e7..9b7c297d7a 100644 --- a/cpukit/rtems/src/regiondelete.c +++ b/cpukit/rtems/src/regiondelete.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -44,12 +45,15 @@ rtems_status_code rtems_region_delete( register Region_Control *the_region; Objects_Locations location; + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: @@ -57,10 +61,10 @@ rtems_status_code rtems_region_delete( if ( the_region->number_of_used_blocks == 0 ) { _Objects_Close( &_Region_Information, &the_region->Object ); _Region_Free( the_region ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_RESOURCE_IN_USE; } diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c index 0bbfac73b4..c36969beda 100644 --- a/cpukit/rtems/src/regionextend.c +++ b/cpukit/rtems/src/regionextend.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -52,12 +53,15 @@ rtems_status_code rtems_region_extend( status = RTEMS_SUCCESSFUL; + _RTEMS_Lock_allocator(); /* to prevent deletion */ the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: @@ -81,7 +85,7 @@ rtems_status_code rtems_region_extend( status = RTEMS_NOT_IMPLEMENTED; break; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return( status ); } diff --git a/cpukit/rtems/src/regiongetinfo.c b/cpukit/rtems/src/regiongetinfo.c index 1e9338e3cd..2f7f21b72a 100644 --- a/cpukit/rtems/src/regiongetinfo.c +++ b/cpukit/rtems/src/regiongetinfo.c @@ -19,6 +19,7 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/region.h> #include <rtems/score/states.h> +#include <rtems/score/apimutex.h> #include <rtems/score/thread.h> /*PAGE @@ -48,21 +49,24 @@ rtems_status_code rtems_region_get_information( if ( !the_info ) return RTEMS_INVALID_ADDRESS; + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( _Heap_Get_information( &the_region->Memory, the_info ) ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c index 07a31c011e..613cec1303 100644 --- a/cpukit/rtems/src/regiongetsegment.c +++ b/cpukit/rtems/src/regiongetsegment.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -58,18 +59,21 @@ rtems_status_code rtems_region_get_segment( if ( size == 0 ) return RTEMS_INVALID_SIZE; + _RTEMS_Lock_allocator(); executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( size > the_region->maximum_segment_size ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_SIZE; } @@ -81,13 +85,13 @@ rtems_status_code rtems_region_get_segment( if ( the_segment ) { the_region->number_of_used_blocks += 1; - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); *segment = the_segment; return RTEMS_SUCCESSFUL; } if ( _Options_Is_no_wait( option_set ) ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_UNSATISFIED; } @@ -100,7 +104,7 @@ rtems_status_code rtems_region_get_segment( _Thread_queue_Enqueue( &the_region->Wait_queue, timeout ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return (rtems_status_code) executing->Wait.return_code; } diff --git a/cpukit/rtems/src/regiongetsegmentsize.c b/cpukit/rtems/src/regiongetsegmentsize.c index 63d8c96b1c..abdf755173 100644 --- a/cpukit/rtems/src/regiongetsegmentsize.c +++ b/cpukit/rtems/src/regiongetsegmentsize.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -48,22 +49,25 @@ rtems_status_code rtems_region_get_segment_size( Objects_Locations location; Thread_Control *executing; + _RTEMS_Lock_allocator(); executing = _Thread_Executing; the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } diff --git a/cpukit/rtems/src/regionident.c b/cpukit/rtems/src/regionident.c index 57ca7638ed..5a43f25a19 100644 --- a/cpukit/rtems/src/regionident.c +++ b/cpukit/rtems/src/regionident.c @@ -20,6 +20,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * diff --git a/cpukit/rtems/src/regionreturnsegment.c b/cpukit/rtems/src/regionreturnsegment.c index e5174e578b..f144145afd 100644 --- a/cpukit/rtems/src/regionreturnsegment.c +++ b/cpukit/rtems/src/regionreturnsegment.c @@ -28,6 +28,7 @@ #include <rtems/rtems/region.h> #include <rtems/score/states.h> #include <rtems/score/thread.h> +#include <rtems/score/apimutex.h> /*PAGE * @@ -58,13 +59,16 @@ rtems_status_code rtems_region_return_segment( #endif int status; + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE: /* this error cannot be returned */ + _RTEMS_Unlock_allocator(); return RTEMS_INTERNAL_ERROR; case OBJECTS_ERROR: + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ID; case OBJECTS_LOCAL: @@ -75,7 +79,7 @@ rtems_status_code rtems_region_return_segment( if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size); } else { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } #endif @@ -85,7 +89,7 @@ rtems_status_code rtems_region_return_segment( _Region_Debug_Walk( the_region, 4 ); if ( !status ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_INVALID_ADDRESS; } @@ -110,7 +114,7 @@ rtems_status_code rtems_region_return_segment( the_thread->Wait.return_code = RTEMS_SUCCESSFUL; } - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return RTEMS_SUCCESSFUL; } diff --git a/cpukit/rtems/src/rtemstimer.c b/cpukit/rtems/src/rtemstimer.c index 6954f1dec6..442f1656f7 100644 --- a/cpukit/rtems/src/rtemstimer.c +++ b/cpukit/rtems/src/rtemstimer.c @@ -38,14 +38,18 @@ void _Timer_Manager_initialization( ) { _Objects_Initialize_information( - &_Timer_Information, - OBJECTS_RTEMS_TIMERS, - FALSE, - maximum_timers, - sizeof( Timer_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Timer_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_TIMERS, /* object class */ + maximum_timers, /* maximum objects of this class */ + sizeof( Timer_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/cpukit/rtems/src/sem.c b/cpukit/rtems/src/sem.c index 6f2db08ded..8c8df032a9 100644 --- a/cpukit/rtems/src/sem.c +++ b/cpukit/rtems/src/sem.c @@ -62,14 +62,18 @@ void _Semaphore_Manager_initialization( ) { _Objects_Initialize_information( - &_Semaphore_Information, - OBJECTS_RTEMS_SEMAPHORES, - TRUE, - maximum_semaphores, - sizeof( Semaphore_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - FALSE + &_Semaphore_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_SEMAPHORES, /* object class */ + maximum_semaphores, /* maximum objects of this class */ + sizeof( Semaphore_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c index a0c015cde4..5d0fffb575 100644 --- a/cpukit/rtems/src/semcreate.c +++ b/cpukit/rtems/src/semcreate.c @@ -172,14 +172,8 @@ rtems_status_code rtems_semaphore_create( _CORE_mutex_Initialize( &the_semaphore->Core_control.mutex, - OBJECTS_RTEMS_SEMAPHORES, &the_mutex_attributes, - lock, -#if defined(RTEMS_MULTIPROCESSING) - _Semaphore_MP_Send_extract_proxy -#else - NULL -#endif + lock ); } else { if ( _Attributes_Is_priority( attribute_set ) ) @@ -202,18 +196,12 @@ rtems_status_code rtems_semaphore_create( _CORE_semaphore_Initialize( &the_semaphore->Core_control.semaphore, - OBJECTS_RTEMS_SEMAPHORES, &the_semaphore_attributes, - count, -#if defined(RTEMS_MULTIPROCESSING) - _Semaphore_MP_Send_extract_proxy -#else - NULL -#endif + count ); } - _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name ); + _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, name ); *id = the_semaphore->Object.id; diff --git a/cpukit/rtems/src/taskcreate.c b/cpukit/rtems/src/taskcreate.c index 6183079c66..c445589687 100644 --- a/cpukit/rtems/src/taskcreate.c +++ b/cpukit/rtems/src/taskcreate.c @@ -182,7 +182,7 @@ rtems_status_code rtems_task_create( THREAD_CPU_BUDGET_ALGORITHM_NONE, NULL, /* no budget algorithm callout */ _Modes_Get_interrupt_level(initial_modes), - &name + name ); if ( !status ) { diff --git a/cpukit/rtems/src/taskident.c b/cpukit/rtems/src/taskident.c index 7d6baff020..f58b462814 100644 --- a/cpukit/rtems/src/taskident.c +++ b/cpukit/rtems/src/taskident.c @@ -59,7 +59,7 @@ rtems_status_code rtems_task_ident( return RTEMS_SUCCESSFUL; } - status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ); + status = _Objects_Name_to_id( &_RTEMS_tasks_Information, name, node, id ); return _Status_Object_name_errors_to_status[ status ]; } diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c index f9c7dfb5cf..d8fc8a0564 100644 --- a/cpukit/rtems/src/tasks.c +++ b/cpukit/rtems/src/tasks.c @@ -249,14 +249,18 @@ void _RTEMS_tasks_Manager_initialization( #endif _Objects_Initialize_information( - &_RTEMS_tasks_Information, - OBJECTS_RTEMS_TASKS, - TRUE, - maximum_tasks, - sizeof( Thread_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH, - TRUE + &_RTEMS_tasks_Information, /* object information table */ + OBJECTS_CLASSIC_API, /* object API */ + OBJECTS_RTEMS_TASKS, /* object class */ + maximum_tasks, /* maximum objects of this class */ + sizeof( Thread_Control ), /* size of this object's control block */ + FALSE, /* TRUE if the name is a string */ + RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ +#if defined(RTEMS_MULTIPROCESSING) + , + FALSE, /* TRUE if this is a global object class */ + NULL /* Proxy extraction support callout */ +#endif ); /* diff --git a/cpukit/rtems/src/timercreate.c b/cpukit/rtems/src/timercreate.c index a1734e980f..a2e1fb72c5 100644 --- a/cpukit/rtems/src/timercreate.c +++ b/cpukit/rtems/src/timercreate.c @@ -58,7 +58,7 @@ rtems_status_code rtems_timer_create( the_timer->the_class = TIMER_DORMANT; - _Objects_Open( &_Timer_Information, &the_timer->Object, &name ); + _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); |