Changeset 9224a751 in rtems


Ignore:
Timestamp:
Nov 30, 2009, 1:06:21 PM (9 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, master
Children:
5ad790ff
Parents:
51bdbca1
Message:

Changed base implementation of protected heap allocations to use _Heap_Allocate_aligned_with_boundary().

Location:
cpukit
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r51bdbca1 r9224a751  
     12009-11-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * score/include/rtems/score/protectedheap.h,
     4        score/src/pheapallocate.c: Changed base implementation of protected
     5        heap allocations to use _Heap_Allocate_aligned_with_boundary().
     6        * libcsupport/include/rtems/malloc.h, libcsupport/src/rtems_malloc.c:
     7        Check system state. Process deferred frees. Renamed rtems_malloc() in
     8        rtems_heap_allocate_aligned_with_boundary().
     9        * score/src/pheapallocatealigned.c: Removed file.
     10        * score/Makefile.am: Update for removed file.
     11
    1122009-11-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
    213
  • cpukit/libcsupport/include/rtems/malloc.h

    r51bdbca1 r9224a751  
    170170 * no memory is available or the parameters are inconsistent.
    171171 */
    172 void *rtems_malloc(size_t size, uintptr_t alignment, uintptr_t boundary);
     172void *rtems_heap_allocate_aligned_with_boundary(
     173  size_t size,
     174  uintptr_t alignment,
     175  uintptr_t boundary
     176);
    173177
    174178#ifdef __cplusplus
  • cpukit/libcsupport/src/rtems_malloc.c

    r51bdbca1 r9224a751  
    2929#include "malloc_p.h"
    3030
    31 #include <stdlib.h>
    32 #include <errno.h>
     31void *rtems_heap_allocate_aligned_with_boundary(
     32  size_t size,
     33  uintptr_t alignment,
     34  uintptr_t boundary
     35)
     36{
     37  if (
     38    _System_state_Is_up( _System_state_Get() )
     39      && !malloc_is_system_state_OK()
     40  ) {
     41    return NULL;
     42  }
    3343
    34 void *rtems_malloc(size_t size, uintptr_t alignment, uintptr_t boundary)
    35 {
    36   void *p = NULL;
     44  malloc_deferred_frees_process();
    3745
    38   _RTEMS_Lock_allocator();
    39    p = _Heap_Allocate_aligned_with_boundary(
    40      RTEMS_Malloc_Heap,
    41      size,
    42      alignment,
    43      boundary
    44    );
    45   _RTEMS_Unlock_allocator();
     46  /* FIXME: Statistics, boundary checks */
    4647
    47   return p;
     48  return _Protected_heap_Allocate_aligned_with_boundary(
     49    RTEMS_Malloc_Heap,
     50    size,
     51    alignment,
     52    boundary
     53  );
    4854}
    4955
  • cpukit/score/Makefile.am

    r51bdbca1 r9224a751  
    139139
    140140## PROTECTED_HEAP_C_FILES
    141 libscore_a_SOURCES += src/pheapallocatealigned.c src/pheapallocate.c \
     141libscore_a_SOURCES += src/pheapallocate.c \
    142142    src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \
    143143    src/pheapgetblocksize.c src/pheapgetfreeinfo.c src/pheapgetinfo.c \
  • cpukit/score/include/rtems/score/protectedheap.h

    r51bdbca1 r9224a751  
    6767 * @brief See _Heap_Allocate_aligned_with_boundary().
    6868 */
    69 void *_Protected_heap_Allocate(
     69void *_Protected_heap_Allocate_aligned_with_boundary(
    7070  Heap_Control *heap,
    71   uintptr_t size
     71  uintptr_t size,
     72  uintptr_t alignment,
     73  uintptr_t boundary
    7274);
    7375
    7476/**
    75  * @brief See _Heap_Allocate_aligned_with_boundary().
     77 * @brief See _Heap_Allocate_aligned_with_boundary() with boundary equals zero.
    7678 */
    77 void *_Protected_heap_Allocate_aligned(
     79RTEMS_INLINE_ROUTINE void *_Protected_heap_Allocate_aligned(
    7880  Heap_Control *heap,
    7981  uintptr_t size,
    8082  uintptr_t alignment
    81 );
     83)
     84{
     85  return
     86    _Protected_heap_Allocate_aligned_with_boundary( heap, size, alignment, 0 );
     87}
     88
     89/**
     90 * @brief See _Heap_Allocate_aligned_with_boundary() with alignment and
     91 * boundary equals zero.
     92 */
     93RTEMS_INLINE_ROUTINE void *_Protected_heap_Allocate(
     94  Heap_Control *heap,
     95  uintptr_t size
     96)
     97{
     98  return _Protected_heap_Allocate_aligned_with_boundary( heap, size, 0, 0 );
     99}
    82100
    83101/**
  • cpukit/score/src/pheapallocate.c

    r51bdbca1 r9224a751  
    2525#include <rtems/score/protectedheap.h>
    2626
    27 void *_Protected_heap_Allocate(
    28   Heap_Control *the_heap,
    29   uintptr_t     size
     27void *_Protected_heap_Allocate_aligned_with_boundary(
     28  Heap_Control *heap,
     29  uintptr_t     size,
     30  uintptr_t     alignment,
     31  uintptr_t     boundary
    3032)
    3133{
     
    3335
    3436  _RTEMS_Lock_allocator();
    35     p = _Heap_Allocate( the_heap, size );
     37    p = _Heap_Allocate_aligned_with_boundary(
     38      heap,
     39      size,
     40      alignment,
     41      boundary
     42    );
    3643  _RTEMS_Unlock_allocator();
     44
    3745  return p;
    3846}
    39 
Note: See TracChangeset for help on using the changeset viewer.