diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-06-13 21:53:38 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-06-13 21:53:38 +0000 |
commit | cf1f72ea339287cf6f780b2e34b8092ce08da6b0 (patch) | |
tree | 3b6eee762364ef5304ebae3bf5da4e9296eafa29 /c/src/lib/libcpu/shared/src/cache_aligned_malloc.c | |
parent | Added .cvsignore. (diff) | |
download | rtems-cf1f72ea339287cf6f780b2e34b8092ce08da6b0.tar.bz2 |
Moved i386 and m68k cache management code to libcpu. Everything
now is an implementation of the prototypes in rtems/rtems/cache.h.
The libcpu/i386/wrapup directory is no longer needed.
The PowerPC needs this done to it.
Diffstat (limited to 'c/src/lib/libcpu/shared/src/cache_aligned_malloc.c')
-rw-r--r-- | c/src/lib/libcpu/shared/src/cache_aligned_malloc.c | 43 |
1 files changed, 43 insertions, 0 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 new file mode 100644 index 0000000000..3289317132 --- /dev/null +++ b/c/src/lib/libcpu/shared/src/cache_aligned_malloc.c @@ -0,0 +1,43 @@ +/* + * 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include <rtems.h> +#include <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 +} + |