summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-01 22:30:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-01 22:30:12 +0000
commitef9505a92f6c9c962dc2649f49002311466e009e (patch)
tree5a869b6101918ff8b37f19ca2b36f0b835d69d58 /c/src/exec/score/src
parent2002-07-01 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-ef9505a92f6c9c962dc2649f49002311466e009e.tar.bz2
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/Makefile.am, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/object.h, include/rtems/score/threadq.h, inline/rtems/score/object.inl, inline/rtems/score/thread.inl, macros/rtems/score/object.inl, src/Makefile.am, src/coremsg.c, src/coremutex.c, src/coresem.c, src/mpci.c, src/objectcomparenameraw.c, src/objectextendinformation.c, src/objectinitializeinformation.c, src/objectnametoid.c, src/thread.c, src/threadclose.c, src/threadget.c, src/threadq.c, src/threadqextractwithproxy.c: Modified as part of above. * include/rtems/score/apimutex.h, src/objectgetnoprotection.c: New files.
Diffstat (limited to '')
-rw-r--r--c/src/exec/score/src/Makefile.am5
-rw-r--r--c/src/exec/score/src/coremsg.c7
-rw-r--r--c/src/exec/score/src/coremutex.c8
-rw-r--r--c/src/exec/score/src/coresem.c8
-rw-r--r--c/src/exec/score/src/mpci.c6
-rw-r--r--c/src/exec/score/src/objectcomparenameraw.c8
-rw-r--r--c/src/exec/score/src/objectextendinformation.c16
-rw-r--r--c/src/exec/score/src/objectgetnoprotection.c83
-rw-r--r--c/src/exec/score/src/objectinitializeinformation.c33
-rw-r--r--c/src/exec/score/src/objectnametoid.c2
-rw-r--r--c/src/exec/score/src/thread.c13
-rw-r--r--c/src/exec/score/src/threadclose.c1
-rw-r--r--c/src/exec/score/src/threadget.c31
-rw-r--r--c/src/exec/score/src/threadq.c6
-rw-r--r--c/src/exec/score/src/threadqextractwithproxy.c11
15 files changed, 164 insertions, 74 deletions
diff --git a/c/src/exec/score/src/Makefile.am b/c/src/exec/score/src/Makefile.am
index 407f9f51fb..64d0d50a15 100644
--- a/c/src/exec/score/src/Makefile.am
+++ b/c/src/exec/score/src/Makefile.am
@@ -28,7 +28,7 @@ OBJECT_C_FILES = object.c objectallocate.c objectallocatebyindex.c \
objectcopynameraw.c objectcopynamestring.c objectextendinformation.c \
objectfree.c objectget.c objectgetisr.c objectgetbyindex.c \
objectgetnext.c objectinitializeinformation.c objectnametoid.c \
- objectshrinkinformation.c
+ objectshrinkinformation.c objectgetnoprotection.c
THREAD_C_FILES = thread.c threadchangepriority.c threadclearstate.c \
threadclose.c threadcreateidle.c threaddelayended.c threaddispatch.c \
@@ -44,8 +44,7 @@ THREADQ_C_FILES = threadq.c threadqdequeue.c threadqdequeuefifo.c \
threadqdequeuepriority.c threadqenqueue.c threadqenqueuefifo.c \
threadqenqueuepriority.c threadqextract.c threadqextractfifo.c \
threadqextractpriority.c threadqextractwithproxy.c threadqfirst.c \
- threadqfirstfifo.c threadqfirstpriority.c threadqflush.c \
- threadqtimeout.c
+ threadqfirstfifo.c threadqfirstpriority.c threadqflush.c threadqtimeout.c
TOD_C_FILES = coretod.c coretodset.c coretodtickle.c coretodtoseconds.c \
coretodvalidate.c
diff --git a/c/src/exec/score/src/coremsg.c b/c/src/exec/score/src/coremsg.c
index 9895d52f68..5ae58a2908 100644
--- a/c/src/exec/score/src/coremsg.c
+++ b/c/src/exec/score/src/coremsg.c
@@ -42,7 +42,6 @@
* the_message_queue_attributes - the message queue's attributes
* maximum_pending_messages - maximum message and reserved buffer count
* maximum_message_size - maximum size of each message
- * proxy_extract_callout - remote extract support
*
* Output parameters:
* TRUE - if the message queue is initialized
@@ -51,11 +50,9 @@
boolean _CORE_message_queue_Initialize(
CORE_message_queue_Control *the_message_queue,
- Objects_Classes the_class,
CORE_message_queue_Attributes *the_message_queue_attributes,
unsigned32 maximum_pending_messages,
- unsigned32 maximum_message_size,
- Thread_queue_Extract_callout proxy_extract_callout
+ unsigned32 maximum_message_size
)
{
unsigned32 message_buffering_required;
@@ -96,11 +93,9 @@ boolean _CORE_message_queue_Initialize(
_Thread_queue_Initialize(
&the_message_queue->Wait_queue,
- the_class,
_CORE_message_queue_Is_priority( the_message_queue_attributes ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_MESSAGE,
- proxy_extract_callout,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
);
diff --git a/c/src/exec/score/src/coremutex.c b/c/src/exec/score/src/coremutex.c
index 8edb80fcfb..e2ef275b75 100644
--- a/c/src/exec/score/src/coremutex.c
+++ b/c/src/exec/score/src/coremutex.c
@@ -32,20 +32,16 @@
*
* Input parameters:
* the_mutex - the mutex control block to initialize
- * the_class - the API class of the object
* the_mutex_attributes - the mutex attributes specified at create time
* initial_lock - mutex initial lock or unlocked status
- * proxy_extract_callout - MP specific extract callout
*
* Output parameters: NONE
*/
void _CORE_mutex_Initialize(
CORE_mutex_Control *the_mutex,
- Objects_Classes the_class,
CORE_mutex_Attributes *the_mutex_attributes,
- unsigned32 initial_lock,
- Thread_queue_Extract_callout proxy_extract_callout
+ unsigned32 initial_lock
)
{
@@ -84,11 +80,9 @@ void _CORE_mutex_Initialize(
_Thread_queue_Initialize(
&the_mutex->Wait_queue,
- the_class,
_CORE_mutex_Is_fifo( the_mutex_attributes ) ?
THREAD_QUEUE_DISCIPLINE_FIFO : THREAD_QUEUE_DISCIPLINE_PRIORITY,
STATES_WAITING_FOR_MUTEX,
- proxy_extract_callout,
CORE_MUTEX_TIMEOUT
);
}
diff --git a/c/src/exec/score/src/coresem.c b/c/src/exec/score/src/coresem.c
index 8cbaaef486..9dc878ca6c 100644
--- a/c/src/exec/score/src/coresem.c
+++ b/c/src/exec/score/src/coresem.c
@@ -36,20 +36,16 @@
*
* Input parameters:
* the_semaphore - the semaphore control block to initialize
- * the_class - the API class of the object
* the_semaphore_attributes - the attributes specified at create time
* initial_value - semaphore's initial value
- * proxy_extract_callout - MP specific extract callout
*
* Output parameters: NONE
*/
void _CORE_semaphore_Initialize(
CORE_semaphore_Control *the_semaphore,
- Objects_Classes the_class,
CORE_semaphore_Attributes *the_semaphore_attributes,
- unsigned32 initial_value,
- Thread_queue_Extract_callout proxy_extract_callout
+ unsigned32 initial_value
)
{
@@ -58,11 +54,9 @@ void _CORE_semaphore_Initialize(
_Thread_queue_Initialize(
&the_semaphore->Wait_queue,
- the_class,
_CORE_semaphore_Is_priority( the_semaphore_attributes ) ?
THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_SEMAPHORE,
- proxy_extract_callout,
CORE_SEMAPHORE_TIMEOUT
);
}
diff --git a/c/src/exec/score/src/mpci.c b/c/src/exec/score/src/mpci.c
index fb51a5f494..547b690178 100644
--- a/c/src/exec/score/src/mpci.c
+++ b/c/src/exec/score/src/mpci.c
@@ -71,18 +71,14 @@ void _MPCI_Handler_initialization(
_CORE_semaphore_Initialize(
&_MPCI_Semaphore,
- OBJECTS_NO_CLASS, /* free floating semaphore */
&attributes, /* the_semaphore_attributes */
- 0, /* initial_value */
- NULL /* proxy_extract_callout */
+ 0 /* initial_value */
);
_Thread_queue_Initialize(
&_MPCI_Remote_blocked_threads,
- OBJECTS_NO_CLASS,
THREAD_QUEUE_DISCIPLINE_FIFO,
STATES_WAITING_FOR_RPC_REPLY,
- NULL,
timeout_status
);
}
diff --git a/c/src/exec/score/src/objectcomparenameraw.c b/c/src/exec/score/src/objectcomparenameraw.c
index 2092d7f822..13962c811a 100644
--- a/c/src/exec/score/src/objectcomparenameraw.c
+++ b/c/src/exec/score/src/objectcomparenameraw.c
@@ -37,13 +37,21 @@ boolean _Objects_Compare_name_raw(
unsigned32 length
)
{
+#if 0
unsigned32 *name_1_p = (unsigned32 *) name_1;
unsigned32 *name_2_p = (unsigned32 *) name_2;
unsigned32 tmp_length = length / OBJECTS_NAME_ALIGNMENT;
+#endif
+ if ( name_1 == name_2 )
+ return TRUE;
+ return FALSE;
+
+#if 0
while ( tmp_length-- )
if ( *name_1_p++ != *name_2_p++ )
return FALSE;
return TRUE;
+#endif
}
diff --git a/c/src/exec/score/src/objectextendinformation.c b/c/src/exec/score/src/objectextendinformation.c
index e2d07a16e1..ddd38e29c5 100644
--- a/c/src/exec/score/src/objectextendinformation.c
+++ b/c/src/exec/score/src/objectextendinformation.c
@@ -208,9 +208,11 @@ void _Objects_Extend_information(
information->name_table = name_table;
information->local_table = local_table;
information->maximum = maximum;
- information->maximum_id =
- _Objects_Build_id(
- information->the_class, _Objects_Local_node, information->maximum
+ information->maximum_id = _Objects_Build_id(
+ information->the_api,
+ information->the_class,
+ _Objects_Local_node,
+ information->maximum
);
_ISR_Enable( level );
@@ -268,9 +270,11 @@ void _Objects_Extend_information(
while ( (the_object = (Objects_Control *) _Chain_Get( &Inactive ) ) != NULL ) {
- the_object->id =
- _Objects_Build_id(
- information->the_class, _Objects_Local_node, index
+ the_object->id = _Objects_Build_id(
+ information->the_api,
+ information->the_class,
+ _Objects_Local_node,
+ index
);
the_object->name = (void *) name_area;
diff --git a/c/src/exec/score/src/objectgetnoprotection.c b/c/src/exec/score/src/objectgetnoprotection.c
new file mode 100644
index 0000000000..f1ca407218
--- /dev/null
+++ b/c/src/exec/score/src/objectgetnoprotection.c
@@ -0,0 +1,83 @@
+/*
+ * Object Handler -- Object Get
+ *
+ *
+ * COPYRIGHT (c) 1989-2002.
+ * 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.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/object.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/score/objectmp.h>
+#endif
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/isr.h>
+
+/*PAGE
+ *
+ * _Objects_Get_no_protection
+ *
+ * This routine sets the object pointer for the given
+ * object id based on the given object information structure.
+ *
+ * Input parameters:
+ * information - pointer to entry in table for this class
+ * id - object id to search for
+ * location - address of where to store the location
+ *
+ * Output parameters:
+ * returns - address of object if local
+ * location - one of the following:
+ * OBJECTS_ERROR - invalid object ID
+ * OBJECTS_REMOTE - remote object
+ * OBJECTS_LOCAL - local object
+ */
+
+Objects_Control *_Objects_Get_no_protection(
+ Objects_Information *information,
+ Objects_Id id,
+ Objects_Locations *location
+)
+{
+ Objects_Control *the_object;
+ unsigned32 index;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ index = id - information->minimum_id + 1;
+#else
+ /* index = _Objects_Get_index( id ); */
+ index = id & 0x0000ffff;
+ /* This should work but doesn't always :( */
+ /* index = (unsigned16) id; */
+#endif
+
+ if ( information->maximum >= index ) {
+ if ( (the_object = information->local_table[ index ]) != NULL ) {
+ *location = OBJECTS_LOCAL;
+ return the_object;
+ }
+ *location = OBJECTS_ERROR;
+ return NULL;
+ }
+ *location = OBJECTS_ERROR;
+
+/*
+ * Not supported for multiprocessing
+ */
+#if 0 && defined(RTEMS_MULTIPROCESSING)
+ _Objects_MP_Is_remote( information, id, location, &the_object );
+ return the_object;
+#endif
+ return NULL;
+}
diff --git a/c/src/exec/score/src/objectinitializeinformation.c b/c/src/exec/score/src/objectinitializeinformation.c
index 9c21820888..02f09236f3 100644
--- a/c/src/exec/score/src/objectinitializeinformation.c
+++ b/c/src/exec/score/src/objectinitializeinformation.c
@@ -32,37 +32,42 @@
*
* Input parameters:
* information - object information table
- * the_class - object class
- * supports_global - TRUE if this is a global object class
* maximum - maximum objects of this class
* size - size of this object's control block
* is_string - TRUE if names for this object are strings
* maximum_name_length - maximum length of each object's name
- * is_thread - TRUE if this class is threads
+ * When multiprocessing is configured,
+ * supports_global - TRUE if this is a global object class
+ * extract_callout - pointer to threadq extract callout if MP
*
* Output parameters: NONE
*/
void _Objects_Initialize_information(
Objects_Information *information,
- Objects_Classes the_class,
- boolean supports_global,
+ Objects_APIs the_api,
+ unsigned32 the_class,
unsigned32 maximum,
unsigned32 size,
boolean is_string,
- unsigned32 maximum_name_length,
- boolean is_thread
+ unsigned32 maximum_name_length
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ boolean supports_global,
+ Objects_Thread_queue_Extract_callout *extract
+#endif
)
{
static Objects_Control *null_local_table = NULL;
-
unsigned32 minimum_index;
- unsigned32 index;
unsigned32 name_length;
+#if defined(RTEMS_MULTIPROCESSING)
+ unsigned32 index;
+#endif
+ information->the_api = the_api;
information->the_class = the_class;
information->is_string = is_string;
- information->is_thread = is_thread;
information->local_table = 0;
information->name_table = 0;
@@ -75,7 +80,7 @@ void _Objects_Initialize_information(
* Set the entry in the object information table.
*/
- _Objects_Information_table[ the_class ] = information;
+ _Objects_Information_table[ the_api ][ the_class ] = information;
/*
* Set the size of the object
@@ -110,7 +115,7 @@ void _Objects_Initialize_information(
else minimum_index = 1;
information->minimum_id =
- _Objects_Build_id( the_class, _Objects_Local_node, minimum_index );
+ _Objects_Build_id( the_api, the_class, _Objects_Local_node, minimum_index );
/*
* Calculate the maximum name length
@@ -153,6 +158,9 @@ void _Objects_Initialize_information(
* Take care of multiprocessing
*/
+#if defined(RTEMS_MULTIPROCESSING)
+ information->extract = extract;
+
if ( supports_global == TRUE && _System_state_Is_multiprocessing ) {
information->global_table =
@@ -165,4 +173,5 @@ void _Objects_Initialize_information(
}
else
information->global_table = NULL;
+#endif
}
diff --git a/c/src/exec/score/src/objectnametoid.c b/c/src/exec/score/src/objectnametoid.c
index 086a9fd74d..3bbf20900c 100644
--- a/c/src/exec/score/src/objectnametoid.c
+++ b/c/src/exec/score/src/objectnametoid.c
@@ -73,9 +73,7 @@ Objects_Name_to_id_errors _Objects_Name_to_id(
else compare_them = _Objects_Compare_name_raw;
for ( index = 1; index <= information->maximum; index++ ) {
-
the_object = information->local_table[ index ];
-
if ( !the_object || !the_object->name )
continue;
diff --git a/c/src/exec/score/src/thread.c b/c/src/exec/score/src/thread.c
index c71f025d39..a05dd0fd75 100644
--- a/c/src/exec/score/src/thread.c
+++ b/c/src/exec/score/src/thread.c
@@ -90,13 +90,18 @@ void _Thread_Handler_initialization(
_Objects_Initialize_information(
&_Thread_Internal_information,
+ OBJECTS_INTERNAL_API,
OBJECTS_INTERNAL_THREADS,
- FALSE,
( _System_state_Is_multiprocessing ) ? 2 : 1,
sizeof( Thread_Control ),
- TRUE,
- 8,
- TRUE
+ /* size of this object's control block */
+ TRUE, /* TRUE if names for this object are strings */
+ 8 /* 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/score/src/threadclose.c b/c/src/exec/score/src/threadclose.c
index 882672d47e..b589461eaa 100644
--- a/c/src/exec/score/src/threadclose.c
+++ b/c/src/exec/score/src/threadclose.c
@@ -46,7 +46,6 @@ void _Thread_Close(
_Thread_Set_state( the_thread, STATES_TRANSIENT );
if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
-
if ( _Watchdog_Is_active( &the_thread->Timer ) )
(void) _Watchdog_Remove( &the_thread->Timer );
}
diff --git a/c/src/exec/score/src/threadget.c b/c/src/exec/score/src/threadget.c
index cf0cfaffd2..c8747f76fa 100644
--- a/c/src/exec/score/src/threadget.c
+++ b/c/src/exec/score/src/threadget.c
@@ -43,30 +43,41 @@ Thread_Control *_Thread_Get (
Objects_Locations *location
)
{
- Objects_Classes the_class;
+ unsigned32 the_api;
+ unsigned32 the_class;
Objects_Information *information;
+ Thread_Control *tp = (Thread_Control *) 0;
if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
_Thread_Disable_dispatch();
*location = OBJECTS_LOCAL;
- return( _Thread_Executing );
+ tp = _Thread_Executing;
+ goto done;
}
+ the_api = _Objects_Get_API( id );
+ if ( the_api && the_api > OBJECTS_APIS_LAST ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
the_class = _Objects_Get_class( id );
-
- if ( the_class > OBJECTS_CLASSES_LAST ) {
+ if ( the_class != 1 ) { /* threads are always first class :) */
*location = OBJECTS_ERROR;
- return (Thread_Control *) 0;
- }
+ goto done;
+ }
- information = _Objects_Information_table[ the_class ];
+ information = _Objects_Information_table[ the_api ][ the_class ];
- if ( !information || !information->is_thread ) {
+ if ( !information ) {
*location = OBJECTS_ERROR;
- return (Thread_Control *) 0;
+ goto done;
}
- return (Thread_Control *) _Objects_Get( information, id, location );
+ tp = (Thread_Control *) _Objects_Get( information, id, location );
+
+done:
+ return tp;
}
#endif
diff --git a/c/src/exec/score/src/threadq.c b/c/src/exec/score/src/threadq.c
index 1deaa61045..a216a4ffcd 100644
--- a/c/src/exec/score/src/threadq.c
+++ b/c/src/exec/score/src/threadq.c
@@ -29,10 +29,8 @@
*
* Input parameters:
* the_thread_queue - pointer to a threadq header
- * the_class - class of the object to which this belongs
* discipline - queueing discipline
* state - state of waiting threads
- * proxy_extract_callout - MP specific callout
* timeout_status - return on a timeout
*
* Output parameters: NONE
@@ -40,17 +38,13 @@
void _Thread_queue_Initialize(
Thread_queue_Control *the_thread_queue,
- Objects_Classes the_class,
Thread_queue_Disciplines the_discipline,
States_Control state,
- Thread_queue_Extract_callout proxy_extract_callout,
unsigned32 timeout_status
)
{
unsigned32 index;
- _Thread_queue_Extract_table[ the_class ] = proxy_extract_callout;
-
the_thread_queue->state = state;
the_thread_queue->discipline = the_discipline;
the_thread_queue->timeout_status = timeout_status;
diff --git a/c/src/exec/score/src/threadqextractwithproxy.c b/c/src/exec/score/src/threadqextractwithproxy.c
index 68b3daff5b..5c47b215ae 100644
--- a/c/src/exec/score/src/threadqextractwithproxy.c
+++ b/c/src/exec/score/src/threadqextractwithproxy.c
@@ -26,7 +26,7 @@
* _Thread_queue_Extract_with_proxy
*
* This routine extracts the_thread from the_thread_queue
- * and insures that if there is a proxy for this task on
+ * and ensures that if there is a proxy for this task on
* another node, it is also dealt with.
*
* XXX
@@ -37,8 +37,8 @@ boolean _Thread_queue_Extract_with_proxy(
)
{
States_Control state;
- Objects_Classes the_class;
- Thread_queue_Extract_callout proxy_extract_callout;
+ Objects_Information *the_information;
+ Objects_Thread_queue_Extract_callout proxy_extract_callout;
state = the_thread->current_state;
@@ -46,9 +46,10 @@ boolean _Thread_queue_Extract_with_proxy(
if ( _States_Is_waiting_for_rpc_reply( state ) &&
_States_Is_locally_blocked( state ) ) {
- the_class = _Objects_Get_class( the_thread->Wait.id );
+ the_information = _Objects_Get_information( the_thread->Wait.id );
- proxy_extract_callout = _Thread_queue_Extract_table[ the_class ];
+ proxy_extract_callout =
+ (Objects_Thread_queue_Extract_callout) the_information->extract;
if ( proxy_extract_callout )
(*proxy_extract_callout)( the_thread );