summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-07 14:50:28 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-07 14:51:31 +0200
commitfb9e98ea22695e9fa7a668eb7e114e736ede4b3c (patch)
tree7bfdbb0b678beea853bc953ff04cae898b699106 /cpukit/sapi
parentscore: Clarify CPU port alignment requirements (diff)
downloadrtems-fb9e98ea22695e9fa7a668eb7e114e736ede4b3c.tar.bz2
score: Fix workspace size estimate
Diffstat (limited to 'cpukit/sapi')
-rw-r--r--cpukit/sapi/include/confdefs.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index a3ec7fa019..63d9082630 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1012,6 +1012,9 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0)
+#define _Configure_Align_up(_val, _align) \
+ (((_val) + (_align) - 1) & ~((_align) - 1))
+
/**
* This is a helper macro used in calculations in this file. It is used
* to noted when an element is allocated from the RTEMS Workspace and adds
@@ -1020,7 +1023,7 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#define _Configure_From_workspace(_size) \
(ssize_t) (_Configure_Zero_or_One(_size) * \
- ((_size) + HEAP_BLOCK_HEADER_SIZE + CPU_HEAP_ALIGNMENT - 1))
+ _Configure_Align_up((_size) + HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT))
/**
* This is a helper macro used in stack space calculations in this file. It
@@ -1049,13 +1052,14 @@ const rtems_libio_helper rtems_fs_init_helper =
* NOTE: It does NOT attempt to address the more complex case of unlimited
* objects.
*/
-#define _Configure_Object_RAM(_number, _size) \
- ( _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
+#define _Configure_Object_RAM(_number, _size) ( \
+ _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \
_Configure_From_workspace( \
- (_Configure_Zero_or_One(_number) * \
- (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *)) + \
- (_Configure_Zero_or_One(_number) * \
- (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *))) \
+ _Configure_Zero_or_One(_number) * ( \
+ (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \
+ _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \
+ _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \
+ ) \
) \
)