From 21275b58a5a69c3c838082ffc8a7a3641f32ea9a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 22 Nov 2018 19:14:51 +0100 Subject: score: Static Objects_Information initialization Statically allocate the objects information together with the initial set of objects either via . Provide default object informations with zero objects via librtemscpu.a. This greatly simplifies the workspace size estimate. RTEMS applications which do not use the unlimited objects option are easier to debug since all objects reside now in statically allocated objects of the right types. Close #3621. --- cpukit/score/src/objectallocate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cpukit/score/src/objectallocate.c') diff --git a/cpukit/score/src/objectallocate.c b/cpukit/score/src/objectallocate.c index 9213cf8eb7..ad73884a07 100644 --- a/cpukit/score/src/objectallocate.c +++ b/cpukit/score/src/objectallocate.c @@ -68,13 +68,18 @@ Objects_Control *_Objects_Allocate_unprotected( } if ( the_object != NULL ) { + Objects_Maximum objects_per_block; Objects_Maximum block; + objects_per_block = information->objects_per_block; block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; - block /= information->objects_per_block; - information->inactive_per_block[ block ]--; - information->inactive--; + if ( block > objects_per_block ) { + block /= objects_per_block; + + information->inactive_per_block[ block ]--; + information->inactive--; + } } } -- cgit v1.2.3