Changeset bd5984de in rtems


Ignore:
Timestamp:
Sep 17, 2008, 6:37:55 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
1986152
Parents:
2f3e2e0
Message:

2008-09-17 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/free.c, libcsupport/src/malloc.c, libcsupport/src/malloc_initialize.c, libcsupport/src/malloc_p.h, libcsupport/src/malloc_sbrk_helpers.c, libcsupport/src/malloc_statistics_helpers.c, libcsupport/src/malloc_walk.c, libcsupport/src/mallocfreespace.c, libcsupport/src/mallocinfo.c, libcsupport/src/realloc.c, libcsupport/src/rtems_memalign.c, sapi/include/confdefs.h, score/inline/rtems/score/thread.inl: Add support for optionally having a unified work area. In other words, the RTEMS Workspace and C Program Heap are the same pool of memory.
Location:
cpukit
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r2f3e2e0 rbd5984de  
     12008-09-17      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * libcsupport/src/free.c, libcsupport/src/malloc.c,
     4        libcsupport/src/malloc_initialize.c, libcsupport/src/malloc_p.h,
     5        libcsupport/src/malloc_sbrk_helpers.c,
     6        libcsupport/src/malloc_statistics_helpers.c,
     7        libcsupport/src/malloc_walk.c, libcsupport/src/mallocfreespace.c,
     8        libcsupport/src/mallocinfo.c, libcsupport/src/realloc.c,
     9        libcsupport/src/rtems_memalign.c, sapi/include/confdefs.h,
     10        score/inline/rtems/score/thread.inl: Add support for optionally
     11        having a unified work area. In other words, the RTEMS Workspace and C
     12        Program Heap are the same pool of memory.
     13
    1142008-09-17      Miao Yan <yanmiaobest@gmail.com>
    215
  • cpukit/libcsupport/src/free.c

    r2f3e2e0 rbd5984de  
    3030
    3131  #if defined(RTEMS_HEAP_DEBUG)
    32     _Protected_heap_Walk( &RTEMS_Malloc_Heap, 0, false );
     32    _Protected_heap_Walk( RTEMS_Malloc_Heap, 0, false );
    3333  #endif
    3434
     
    5757    (*rtems_malloc_statistics_helpers->at_free)(ptr);
    5858
    59   if ( !_Protected_heap_Free( &RTEMS_Malloc_Heap, ptr ) ) {
     59  if ( !_Protected_heap_Free( RTEMS_Malloc_Heap, ptr ) ) {
    6060    printk( "Program heap: free of bad pointer %p -- range %p - %p \n",
    6161      ptr,
    62       RTEMS_Malloc_Heap.start,
    63       RTEMS_Malloc_Heap.end
     62      RTEMS_Malloc_Heap->start,
     63      RTEMS_Malloc_Heap->end
    6464    );
    6565  }
  • cpukit/libcsupport/src/malloc.c

    r2f3e2e0 rbd5984de  
    5353   */
    5454  #if defined(RTEMS_HEAP_DEBUG)
    55     _Protected_heap_Walk( &RTEMS_Malloc_Heap, 0, false );
     55    _Protected_heap_Walk( RTEMS_Malloc_Heap, 0, false );
    5656  #endif
    5757
     
    7171   */
    7272
    73   return_this = _Protected_heap_Allocate( &RTEMS_Malloc_Heap, size );
     73  return_this = _Protected_heap_Allocate( RTEMS_Malloc_Heap, size );
    7474
    7575  if ( !return_this ) {
  • cpukit/libcsupport/src/malloc_initialize.c

    r2f3e2e0 rbd5984de  
    1919#include <rtems.h>
    2020#include <rtems/malloc.h>
     21#include <rtems/score/wkspace.h>
    2122#include "malloc_p.h"
    2223
    23 Heap_Control              RTEMS_Malloc_Heap;
    2424rtems_malloc_statistics_t rtems_malloc_statistics;
     25extern bool rtems_unified_work_area;
    2526
    2627void RTEMS_Malloc_Initialize(
     
    6364    );
    6465  }
     66
     67  /*
     68   *  If this system is configured to use the same heap for
     69   *  the RTEMS Workspace and C Program Heap, then we need to
     70   *  be very very careful about destroying the initialization
     71   *  that has already been done.
     72   */
    6573   
    6674  /*
     
    7583   */
    7684
    77   if ( rtems_configuration_get_do_zero_of_workspace() )
     85  if ( !rtems_unified_work_area &&
     86       rtems_configuration_get_do_zero_of_workspace() )
    7887     memset( starting_address, 0, length );
    7988
     
    8493   */
    8594
    86   status = _Protected_heap_Initialize(
    87     &RTEMS_Malloc_Heap,
    88     starting_address,
    89     length,
    90     CPU_HEAP_ALIGNMENT
    91   );
    92   if ( !status )
    93     rtems_fatal_error_occurred( status );
     95  if ( !rtems_unified_work_area ) {
     96    status = _Protected_heap_Initialize(
     97      RTEMS_Malloc_Heap,
     98      starting_address,
     99      length,
     100      CPU_HEAP_ALIGNMENT
     101    );
     102    if ( !status )
     103      rtems_fatal_error_occurred( status );
     104  }
    94105
    95106  #if defined(RTEMS_HEAP_DEBUG)
    96     if ( _Protected_heap_Walk( &RTEMS_Malloc_Heap, 0, false ) ) {
     107    if ( _Protected_heap_Walk( RTEMS_Malloc_Heap, 0, false ) ) {
    97108      printk( "Malloc heap not initialized correctly\n" );
    98109      rtems_print_buffer( start, 32 );
  • cpukit/libcsupport/src/malloc_p.h

    r2f3e2e0 rbd5984de  
    3838 * Basic management data
    3939 */
    40 extern Heap_Control  RTEMS_Malloc_Heap;
     40extern Heap_Control  *RTEMS_Malloc_Heap;
    4141
    4242/*
  • cpukit/libcsupport/src/malloc_sbrk_helpers.c

    r2f3e2e0 rbd5984de  
    9090
    9191  if ( !_Protected_heap_Extend(
    92           &RTEMS_Malloc_Heap, starting_address, the_size) ) {
     92          RTEMS_Malloc_Heap, starting_address, the_size) ) {
    9393    sbrk(-the_size);
    9494    errno = ENOMEM;
     
    9898  MSBUMP(space_available, the_size);
    9999
    100   return_this = _Protected_heap_Allocate( &RTEMS_Malloc_Heap, size );
     100  return_this = _Protected_heap_Allocate( RTEMS_Malloc_Heap, size );
    101101  return return_this;
    102102}
  • cpukit/libcsupport/src/malloc_statistics_helpers.c

    r2f3e2e0 rbd5984de  
    4343    return;
    4444
    45   _Protected_heap_Get_block_size(&RTEMS_Malloc_Heap, pointer, &actual_size);
     45  _Protected_heap_Get_block_size(RTEMS_Malloc_Heap, pointer, &actual_size);
    4646
    4747  MSBUMP(lifetime_allocated, actual_size);
     
    6262  size_t size;
    6363
    64   if (_Protected_heap_Get_block_size(&RTEMS_Malloc_Heap, pointer, &size) ) {
     64  if (_Protected_heap_Get_block_size(RTEMS_Malloc_Heap, pointer, &size) ) {
    6565    MSBUMP(lifetime_freed, size);
    6666  }
  • cpukit/libcsupport/src/malloc_walk.c

    r2f3e2e0 rbd5984de  
    2323void malloc_walk(size_t source, size_t printf_enabled)
    2424{
    25   _Protected_heap_Walk( &RTEMS_Malloc_Heap, source, printf_enabled );
     25  _Protected_heap_Walk( RTEMS_Malloc_Heap, source, printf_enabled );
    2626}
    2727
  • cpukit/libcsupport/src/mallocfreespace.c

    r2f3e2e0 rbd5984de  
    2929#include <string.h>
    3030
    31 extern Heap_Control  RTEMS_Malloc_Heap;
     31#include "malloc_p.h"
    3232
    3333/*
     
    3939  Heap_Information info;
    4040
    41   _Protected_heap_Get_free_information( &RTEMS_Malloc_Heap, &info );
     41  _Protected_heap_Get_free_information( RTEMS_Malloc_Heap, &info );
    4242  return (size_t) info.largest;
    4343}
  • cpukit/libcsupport/src/mallocinfo.c

    r2f3e2e0 rbd5984de  
    2222#include <rtems/score/protectedheap.h>
    2323
    24 extern Heap_Control  RTEMS_Malloc_Heap;
     24extern Heap_Control  *RTEMS_Malloc_Heap;
    2525
    2626/*
     
    3535    return -1;
    3636
    37   _Protected_heap_Get_information( &RTEMS_Malloc_Heap, the_info );
     37  _Protected_heap_Get_information( RTEMS_Malloc_Heap, the_info );
    3838  return 0;
    3939}
  • cpukit/libcsupport/src/realloc.c

    r2f3e2e0 rbd5984de  
    5555  }
    5656
    57   if ( !_Protected_heap_Get_block_size(&RTEMS_Malloc_Heap, ptr, &old_size) ) {
     57  if ( !_Protected_heap_Get_block_size(RTEMS_Malloc_Heap, ptr, &old_size) ) {
    5858    errno = EINVAL;
    5959    return (void *) 0;
     
    7070  #endif
    7171
    72   if ( _Protected_heap_Resize_block( &RTEMS_Malloc_Heap, ptr, resize ) ) {
     72  if ( _Protected_heap_Resize_block( RTEMS_Malloc_Heap, ptr, resize ) ) {
    7373    #if defined(RTEMS_MALLOC_BOUNDARY_HELPERS)
    7474      /*
  • cpukit/libcsupport/src/rtems_memalign.c

    r2f3e2e0 rbd5984de  
    6565
    6666  return_this = _Protected_heap_Allocate_aligned(
    67     &RTEMS_Malloc_Heap,
     67    RTEMS_Malloc_Heap,
    6868    size,
    6969    alignment
  • cpukit/sapi/include/confdefs.h

    r2f3e2e0 rbd5984de  
    377377#ifdef CONFIGURE_INIT
    378378  /**
     379   *  By default, RTEMS uses separate heaps for the RTEMS Workspace and
     380   *  the C Program Heap.  On many BSPs, these can be optionally
     381   *  combined provided one larger memory pool. This is particularly
     382   *  useful in combination with the unlimited objects configuration.
     383   */
     384  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
     385    #include <rtems/score/wkspace.h>
     386    Heap_Control  *RTEMS_Malloc_Heap = &_Workspace_Area;
     387    bool           rtems_unified_work_area = true;
     388  #else
     389    Heap_Control   RTEMS_Malloc_Area;
     390    Heap_Control  *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area;
     391    bool           rtems_unified_work_area = false;
     392  #endif
     393#endif
     394
     395#ifdef CONFIGURE_INIT
     396  /**
    379397   *  This configures the malloc family statistics to be available.
    380398   *  By default only function call counts are kept.
  • cpukit/score/inline/rtems/score/thread.inl

    r2f3e2e0 rbd5984de  
    77
    88/*
    9  *  COPYRIGHT (c) 1989-2007.
     9 *  COPYRIGHT (c) 1989-2008.
    1010 *  On-Line Applications Research Corporation (OAR).
    1111 *
     
    163163   * extern it here.
    164164   */
    165   extern Heap_Control  RTEMS_Malloc_Heap;
     165  extern Heap_Control  *RTEMS_Malloc_Heap;
    166166#endif
    167167
     
    193193  #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
    194194    if ( _Thread_Dispatch_disable_level == 1 ) {
    195       _Heap_Walk( &RTEMS_Malloc_Heap,99, FALSE );
     195      _Heap_Walk( RTEMS_Malloc_Heap,99, FALSE );
    196196    }
    197197  #endif
Note: See TracChangeset for help on using the changeset viewer.