diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-24 09:43:28 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-25 12:43:53 +0200 |
commit | 25e28d84d75bf4a3d2388cb3aff904c90122ddad (patch) | |
tree | a8a54ddeea6be4578ab395bffbeab7ad1f676ba1 /cpukit | |
parent | testsuite: Fix printk format warnings. (diff) | |
download | rtems-25e28d84d75bf4a3d2388cb3aff904c90122ddad.tar.bz2 |
confdefs.h: Fix heap alloc size estimate
Account for the heap minimum block size.
Diffstat (limited to '')
-rw-r--r-- | cpukit/sapi/include/confdefs.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 95f29fdfb9..d35aaa4a4d 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -1369,10 +1369,13 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0) /** - * General helper to aligned a value up to a power of two boundary. + * General helper to align up a value. */ #define _Configure_Align_up(_val, _align) \ - (((_val) + (_align) - 1) & ~((_align) - 1)) + (((_val) + (_align) - 1) - ((_val) + (_align) - 1) % (_align)) + +#define CONFIGURE_HEAP_MIN_BLOCK_SIZE \ + _Configure_Align_up(sizeof(Heap_Block), CPU_HEAP_ALIGNMENT) /** * This is a helper macro used in calculations in this file. It is used @@ -1381,8 +1384,9 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * may be applied. */ #define _Configure_From_workspace(_size) \ - (ssize_t) (_Configure_Zero_or_One(_size) * \ - _Configure_Align_up((_size) + HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT)) + (ssize_t) (_Configure_Zero_or_One(_size) * \ + _Configure_Align_up(_size + HEAP_BLOCK_HEADER_SIZE, \ + CONFIGURE_HEAP_MIN_BLOCK_SIZE)) /** * This is a helper macro used in stack space calculations in this file. It |