summaryrefslogtreecommitdiffstats
path: root/c/src/exec/libcsupport/src/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/src/exec/libcsupport/src/malloc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/c/src/exec/libcsupport/src/malloc.c b/c/src/exec/libcsupport/src/malloc.c
index 08660d75cc..dc6824891a 100644
--- a/c/src/exec/libcsupport/src/malloc.c
+++ b/c/src/exec/libcsupport/src/malloc.c
@@ -418,5 +418,27 @@ void _free_r(
{
free( ptr );
}
+
+
+/*
+ * rtems_cache_aligned_malloc
+ *
+ * DESCRIPTION:
+ *
+ * This function is used to allocate storage that spans an
+ * integral number of cache blocks.
+ */
+RTEMS_INLINE_ROUTINE void * rtems_cache_aligned_malloc (
+ size_t nbytes
+)
+{
+ /*
+ * Arrange to have the user storage start on the first cache
+ * block beyond the header.
+ */
+ return (void *) ((((unsigned long) malloc( nbytes + _CPU_DATA_CACHE_ALIGNMENT - 1 ))
+ + _CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(_CPU_DATA_CACHE_ALIGNMENT - 1)) );
+}
+
#endif