mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-20 14:46:42 +08:00
2009-01-05 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/include/rtems/score/object.h, score/src/objectallocatebyindex.c: Object index should be int. Fix bug when index is negative. * score/src/objectextendinformation.c: Do not allow maximum number of allocated objects to exceed maximum representable in index field of Object Id. * score/src/objectgetisr.c: Use same code that is in _Objects_Get to extract index field of Object Id.
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
2009-01-05 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* score/include/rtems/score/object.h,
|
||||
score/src/objectallocatebyindex.c: Object index should be int.
|
||||
Fix bug when index is negative.
|
||||
* score/src/objectextendinformation.c: Do not allow maximum number
|
||||
of allocated objects to exceed maximum representable in index
|
||||
field of Object Id.
|
||||
* score/src/objectgetisr.c: Use same code that is in _Objects_Get
|
||||
to extract index field of Object Id.
|
||||
|
||||
2009-01-05 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* itron/include/itronsys/types.h: ITRON types should follow native
|
||||
|
||||
@@ -519,7 +519,7 @@ Objects_Control *_Objects_Allocate(
|
||||
*/
|
||||
Objects_Control *_Objects_Allocate_by_index(
|
||||
Objects_Information *information,
|
||||
uint16_t the_index,
|
||||
int the_index,
|
||||
uint16_t sizeof_control
|
||||
);
|
||||
|
||||
|
||||
@@ -41,21 +41,22 @@
|
||||
|
||||
Objects_Control *_Objects_Allocate_by_index(
|
||||
Objects_Information *information,
|
||||
uint16_t the_index,
|
||||
int the_index,
|
||||
uint16_t sizeof_control
|
||||
)
|
||||
{
|
||||
Objects_Control *the_object;
|
||||
|
||||
if ( the_index && information->maximum >= the_index ) {
|
||||
if ( the_index > 0 && information->maximum >= the_index ) {
|
||||
the_object = information->local_table[ the_index ];
|
||||
if ( the_object )
|
||||
return NULL;
|
||||
|
||||
/* XXX
|
||||
* This whole section of code needs to be addressed.
|
||||
* This whole section of code needs to be evaluated for unlimited objects.
|
||||
* + The 0 should be dealt with more properly so we can autoextend.
|
||||
* + The pointer arithmetic is probably too expensive.
|
||||
* + The pointer arithmetic is probably too expensive but is likely
|
||||
* necessary especially on targets with 16 bit offset limits.
|
||||
* + etc.
|
||||
*/
|
||||
|
||||
|
||||
@@ -113,6 +113,14 @@ void _Objects_Extend_information(
|
||||
|
||||
maximum = information->maximum + information->allocation_size;
|
||||
|
||||
/*
|
||||
* We need to limit the number of objects to the maximum number
|
||||
* representable in the index portion of the object Id. In the
|
||||
* case of 16-bit Ids, this is only 256 object instances.
|
||||
*/
|
||||
if ( maximum > OBJECTS_ID_FINAL_INDEX )
|
||||
return;
|
||||
|
||||
/*
|
||||
* Allocate the tables and break it up.
|
||||
*/
|
||||
|
||||
@@ -61,14 +61,7 @@ Objects_Control *_Objects_Get_isr_disable(
|
||||
uint32_t index;
|
||||
ISR_Level level;
|
||||
|
||||
#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 = (uint16_t ) id; */
|
||||
#endif
|
||||
|
||||
_ISR_Disable( level );
|
||||
if ( information->maximum >= index ) {
|
||||
|
||||
Reference in New Issue
Block a user