2001-11-07 Joel Sherrill <joel@OARcorp.com>

* include/rtems/score/object.h: Added prototype for
	_Objects_Get_by_index().
	* src/objectget.c: Corrected procedure for getting index from Id so
	it is correct and optimal for both single and multiprocessor
	configurations.
This commit is contained in:
Joel Sherrill
2001-11-07 22:51:28 +00:00
parent e7585ed517
commit 7d573e9e15
2 changed files with 16 additions and 8 deletions

View File

@@ -443,6 +443,12 @@ Objects_Control *_Objects_Get (
Objects_Locations *location
);
Objects_Control *_Objects_Get_by_index (
Objects_Information *information,
Objects_Id id,
Objects_Locations *location
);
/*
* _Objects_Get_next
*

View File

@@ -53,11 +53,18 @@ Objects_Control *_Objects_Get(
Objects_Control *the_object;
unsigned32 index;
index = _Objects_Get_index( id );
#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 ) {
_Thread_Disable_dispatch();
if ( (the_object = _Objects_Get_local_object( information, index )) != NULL ) {
if ( (the_object = information->local_table[ index ]) != NULL ) {
*location = OBJECTS_LOCAL;
return( the_object );
}
@@ -67,12 +74,7 @@ Objects_Control *_Objects_Get(
}
*location = OBJECTS_ERROR;
#if defined(RTEMS_MULTIPROCESSING)
_Objects_MP_Is_remote(
information,
_Objects_Build_id( information->the_class, _Objects_Local_node, index ),
location,
&the_object
);
_Objects_MP_Is_remote( information, id, location, &the_object );
return the_object;
#else
return NULL;