From 8b6a0560564a03f05bbe90f94210795461f0a14f Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 5 Jan 2009 20:15:51 +0000 Subject: 2009-01-05 Joel Sherrill PR 1351/cpukit * sapi/include/confdefs.h: Mask off unlimited object bit before using configured number in calculations. --- cpukit/ChangeLog | 6 ++++++ cpukit/sapi/include/confdefs.h | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index f01c4aff5d..42b08b2d25 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2009-01-05 Joel Sherrill + + PR 1351/cpukit + * sapi/include/confdefs.h: Mask off unlimited object bit before using + configured number in calculations. + 2009-01-02 Ralf Corsépius * posix/include/aio.h, posix/src/aio_suspend.c: Make aio_suspend() diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 4881ec2221..cfb1facc89 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -377,6 +377,13 @@ extern rtems_configuration_table Configuration; #define _Configure_From_workspace(_size) \ ((_size) + (2 * sizeof(uint32_t)) + CPU_ALIGNMENT) +/** + * Do not use the unlimited bit as part of the multiplication + * for memory usage. + */ +#define _Configure_Max_Objects(_max) \ + ((_max) & ~RTEMS_UNLIMITED_OBJECTS) + /** * This macro accounts for how memory for a set of configured objects is * allocated from the Executive Workspace. @@ -385,9 +392,9 @@ extern rtems_configuration_table Configuration; * objects. */ #define _Configure_Object_RAM(_number, _size) \ - ( _Configure_From_workspace((_number) * (_size)) + \ + ( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \ _Configure_From_workspace( \ - (((_number) + 1) * sizeof(Objects_Control *)) + \ + ((_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \ (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) \ ) \ ) @@ -1334,13 +1341,14 @@ extern rtems_configuration_table Configuration; #define CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \ ( \ _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \ - ((_tasks) * \ + (_Configure_Max_Objects(_tasks) * \ (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \ _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API) + \ CONFIGURE_MEMORY_PER_TASK_FOR_NEWLIB + \ CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \ CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API)) + \ - _Configure_From_workspace((_number_FP_tasks) * CONTEXT_FP_SIZE) \ + _Configure_From_workspace( \ + _Configure_Max_Objects(_number_FP_tasks) * CONTEXT_FP_SIZE) \ ) /** @@ -1574,6 +1582,7 @@ extern rtems_configuration_table Configuration; uint32_t MEMORY_FOR_IDLE_TASK; /* Classic API Pieces */ + uint32_t CLASSIC_TASKS; uint32_t TASK_VARIABLES; uint32_t TIMERS; uint32_t SEMAPHORES; @@ -1627,6 +1636,7 @@ extern rtems_configuration_table Configuration; CONFIGURE_MEMORY_FOR_IDLE_TASK, /* Classic API Pieces */ + CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0), CONFIGURE_MEMORY_FOR_TASK_VARIABLES(CONFIGURE_MAXIMUM_TASK_VARIABLES), CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS), CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES + -- cgit v1.2.3