4.104.114.84.95
Last change
on this file since 1a505aae was
1a505aae,
checked in by Joel Sherrill <joel.sherrill@…>, on 12/06/00 at 15:47:02
|
2000-12-06 Joel Sherrill <joel@…>
- shared/src/cache_aligned_malloc.c: Added include of <stdlib.h>
to eliminate warnings.
|
-
Property mode set to
100644
|
File size:
935 bytes
|
Rev | Line | |
---|
[cf1f72e] | 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.OARcorp.com/rtems/license.html. |
---|
| 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <rtems.h> |
---|
| 16 | #include <cache_.h> |
---|
[1a505aae] | 17 | #include <stdlib.h> |
---|
[cf1f72e] | 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 | |
---|
| 28 | void *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 | */ |
---|
[5e77d129] | 36 | #if defined(CPU_DATA_CACHE_ALIGNMENT) |
---|
[cf1f72e] | 37 | return (void *) ((((unsigned long) |
---|
[5e77d129] | 38 | malloc( nbytes + CPU_DATA_CACHE_ALIGNMENT - 1 )) |
---|
| 39 | + CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(CPU_DATA_CACHE_ALIGNMENT - 1)) ); |
---|
[cf1f72e] | 40 | #else |
---|
| 41 | return malloc( nbytes ); |
---|
| 42 | #endif |
---|
| 43 | } |
---|
| 44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.