diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-11-25 14:58:13 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-11-25 16:08:16 +0100 |
commit | 7e5c9b895e52c76376386e54a0008c3a9e4a1698 (patch) | |
tree | bb8f7db25258fc1438c58a60aa950d782d0d77ab /c/src/lib/libcpu/shared | |
parent | sptest/spcache01: New test cases (diff) | |
download | rtems-7e5c9b895e52c76376386e54a0008c3a9e4a1698.tar.bz2 |
rtems: Move rtems_cache_aligned_malloc()
Make sure also the size is cache aligned since otherwise we may have
some overlap with the next allocation block. A cache invalidate on this
area would be fatal.
Diffstat (limited to 'c/src/lib/libcpu/shared')
-rw-r--r-- | c/src/lib/libcpu/shared/src/cache_aligned_malloc.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/c/src/lib/libcpu/shared/src/cache_aligned_malloc.c b/c/src/lib/libcpu/shared/src/cache_aligned_malloc.c deleted file mode 100644 index 17fc46814b..0000000000 --- a/c/src/lib/libcpu/shared/src/cache_aligned_malloc.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * RTEMS Cache Aligned Malloc - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include <stdlib.h> - -#include <rtems.h> -#include <cache_.h> -#include <rtems/rtems/cache.h> - -/* - * rtems_cache_aligned_malloc - * - * DESCRIPTION: - * - * This function is used to allocate storage that spans an - * integral number of cache blocks. - */ - -void *rtems_cache_aligned_malloc ( - size_t nbytes -) -{ - /* - * Arrange to have the user storage start on the first cache - * block beyond the header. - */ -#if defined(CPU_DATA_CACHE_ALIGNMENT) - return (void *) ((((unsigned long) - malloc( nbytes + CPU_DATA_CACHE_ALIGNMENT - 1 )) - + CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(CPU_DATA_CACHE_ALIGNMENT - 1)) ); -#else - return malloc( nbytes ); -#endif -} |