summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-01-05 20:09:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-01-05 20:09:02 +0000
commitb028e725e35629e0405d237942e97a73843ae35b (patch)
tree5cac5182644fcd11fe996272790b2b9a62cec67b /cpukit
parent2009-01-05 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-b028e725e35629e0405d237942e97a73843ae35b.tar.bz2
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.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog11
-rw-r--r--cpukit/score/include/rtems/score/object.h2
-rw-r--r--cpukit/score/src/objectallocatebyindex.c9
-rw-r--r--cpukit/score/src/objectextendinformation.c8
-rw-r--r--cpukit/score/src/objectgetisr.c7
5 files changed, 25 insertions, 12 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 6942ceb907..9ad638c7a1 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,16 @@
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
integer size.
diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h
index af46659069..6bd5358869 100644
--- a/cpukit/score/include/rtems/score/object.h
+++ b/cpukit/score/include/rtems/score/object.h
@@ -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
);
diff --git a/cpukit/score/src/objectallocatebyindex.c b/cpukit/score/src/objectallocatebyindex.c
index 474fec0d6f..32a2c15e14 100644
--- a/cpukit/score/src/objectallocatebyindex.c
+++ b/cpukit/score/src/objectallocatebyindex.c
@@ -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.
*/
diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index 4e525110a9..f699e940a3 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -114,6 +114,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.
*/
diff --git a/cpukit/score/src/objectgetisr.c b/cpukit/score/src/objectgetisr.c
index 8a53c7b8b5..aca5f0d059 100644
--- a/cpukit/score/src/objectgetisr.c
+++ b/cpukit/score/src/objectgetisr.c
@@ -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 ) {