source: rtems/c/src/lib/libcpu/shared/src/cache_aligned_malloc.c @ 73b5bd5d

4.104.114.84.95
Last change on this file since 73b5bd5d was 73b5bd5d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/15/04 at 13:33:58

Remove stray white spaces.

  • Property mode set to 100644
File size: 929 bytes
Line 
1/*
2 *  RTEMS Cache Aligned Malloc
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#include <rtems.h>
16#include <cache_.h>
17#include <stdlib.h>
18
19/*
20 *  rtems_cache_aligned_malloc
21 *
22 *  DESCRIPTION:
23 *
24 *  This function is used to allocate storage that spans an
25 *  integral number of cache blocks.
26 */
27
28void *rtems_cache_aligned_malloc (
29  size_t nbytes
30)
31{
32  /*
33   * Arrange to have the user storage start on the first cache
34   * block beyond the header.
35   */
36#if defined(CPU_DATA_CACHE_ALIGNMENT)
37  return (void *) ((((unsigned long)
38     malloc( nbytes + CPU_DATA_CACHE_ALIGNMENT - 1 ))
39        + CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(CPU_DATA_CACHE_ALIGNMENT - 1)) );
40#else
41  return malloc( nbytes );
42#endif
43}
Note: See TracBrowser for help on using the repository browser.