Changeset 7c411bd in rtems


Ignore:
Timestamp:
Sep 14, 2009, 2:48:38 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
eebcc5b
Parents:
1e2d7510
Message:

2009-09-14 Sebastian Huber <Sebastian.Huber@…>

  • score/src/wkspace.c: Removed work space area consistency checks.
  • libblock/include/rtems/ide_part_table.h: Functions are now deprecated.
  • libcsupport/include/rtems/libcsupport.h, libcsupport/src/calloc.c, libcsupport/src/malloc_boundary.c, libcsupport/src/malloc_initialize.c, libcsupport/src/malloc_report_statistics_plugin.c, libcsupport/src/malloc_statistics_helpers.c, libcsupport/src/malloc_walk.c, libcsupport/src/realloc.c, rtems/inline/rtems/rtems/region.inl: Update for heap API changes.

2009-09-14 Christian Mauderer <christian.mauderer@…>

  • libcsupport/src/vprintk.c: Fixed warnings. Print nothing in case the pointer to the string is NULL.
Location:
cpukit
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r1e2d7510 r7c411bd  
     12009-09-14      Sebastian Huber <Sebastian.Huber@embedded-brains.de>
     2
     3        * score/src/wkspace.c: Removed work space area consistency checks.
     4        * libblock/include/rtems/ide_part_table.h: Functions are now
     5        deprecated.
     6        * libcsupport/include/rtems/libcsupport.h, libcsupport/src/calloc.c,
     7        libcsupport/src/malloc_boundary.c,
     8        libcsupport/src/malloc_initialize.c,
     9        libcsupport/src/malloc_report_statistics_plugin.c,
     10        libcsupport/src/malloc_statistics_helpers.c,
     11        libcsupport/src/malloc_walk.c, libcsupport/src/realloc.c,
     12        rtems/inline/rtems/rtems/region.inl: Update for heap API changes.
     13
     142009-09-14      Christian Mauderer <christian.mauderer@embedded-brains.de>
     15
     16        * libcsupport/src/vprintk.c: Fixed warnings. Print nothing in case the
     17        pointer to the string is NULL.
     18
     192009-09-14      Sebastian Huber <Sebastian.Huber@embedded-brains.de>
     20
     21        * score/src/wkspace.c: Removed work space area consistency checks.
     22        * libblock/include/rtems/ide_part_table.h: Functions are now
     23        deprecated.
     24        * libcsupport/include/rtems/libcsupport.h, libcsupport/src/calloc.c,
     25        libcsupport/src/malloc_boundary.c,
     26        libcsupport/src/malloc_initialize.c,
     27        libcsupport/src/malloc_report_statistics_plugin.c,
     28        libcsupport/src/malloc_statistics_helpers.c,
     29        libcsupport/src/malloc_walk.c, libcsupport/src/realloc.c,
     30        rtems/inline/rtems/rtems/region.inl: Update for heap API changes.
     31
     322009-09-14      Christian Mauderer <christian.mauderer@embedded-brains.de>
     33
     34        * libcsupport/src/vprintk.c: Fixed warnings. Print nothing in case the
     35        pointer to the string is NULL.
     36
    1372009-09-13      Joel Sherrill <joel.sherrill@oarcorp.com>
    238
  • cpukit/libblock/include/rtems/ide_part_table.h

    r1e2d7510 r7c411bd  
    166166 *      N/A
    167167 */
    168 void
    169 rtems_ide_part_table_free(rtems_disk_desc_t *disk_desc);
     168/**
     169 * @deprecated Use the @ref rtems_bdpart "block device partition module" instead.
     170 */
     171void rtems_ide_part_table_free(
     172  rtems_disk_desc_t *disk_desc
     173) RTEMS_COMPILER_DEPRECATED_ATTRIBUTE;
    170174
    171175
     
    182186 *      RTEMS_SUCCESSFUL if success, or -1 and corresponding errno else
    183187 */
    184 rtems_status_code
    185 rtems_ide_part_table_get(const char *dev_name, rtems_disk_desc_t *disk_desc);
     188/**
     189 * @deprecated Use the @ref rtems_bdpart "block device partition module" instead.
     190 */
     191rtems_status_code rtems_ide_part_table_get(
     192  const char *dev_name,
     193  rtems_disk_desc_t *disk_desc
     194) RTEMS_COMPILER_DEPRECATED_ATTRIBUTE;
    186195
    187196
     
    196205 *      RTEMS_SUCCESSFUL if success, or -1 and corresponding errno else
    197206 */
    198 rtems_status_code
    199 rtems_ide_part_table_initialize(char *dev_name);
     207/**
     208 * @deprecated Use the @ref rtems_bdpart "block device partition module" instead.
     209 */
     210rtems_status_code rtems_ide_part_table_initialize(
     211  char *dev_name
     212) RTEMS_COMPILER_DEPRECATED_ATTRIBUTE;
    200213
    201214#ifdef __cplusplus
  • cpukit/libcsupport/include/rtems/libcsupport.h

    r1e2d7510 r7c411bd  
    3030
    3131void RTEMS_Malloc_Initialize(
    32   void   *start,
    33   size_t  length,
    34   size_t  sbrk_amount
     32  void *heap_begin,
     33  uintptr_t heap_size,
     34  size_t sbrk_amount
    3535);
    3636
  • cpukit/libcsupport/src/calloc.c

    r1e2d7510 r7c411bd  
    2626{
    2727  register char *cptr;
    28   int            length;
     28  size_t length;
    2929
    3030  MSBUMP(calloc_calls, 1);
     
    3535    memset( cptr, '\0', length );
    3636
    37   MSBUMP(malloc_calls, -1);   /* subtract off the malloc */
     37  MSBUMP(malloc_calls, (uint32_t) -1);   /* subtract off the malloc */
    3838
    3939  return cptr;
  • cpukit/libcsupport/src/malloc_boundary.c

    r1e2d7510 r7c411bd  
    5858struct mallocNode mallocNodeHead;
    5959
    60 void rtems_malloc_boundary_initialize(void)
     60static void rtems_malloc_boundary_initialize(void)
    6161{
    6262  mallocNodeHead.back = &mallocNodeHead;
     
    6464}
    6565
    66 uint32_t rtems_malloc_boundary_overhead(void)
     66static uint32_t rtems_malloc_boundary_overhead(void)
    6767{
    6868  return sizeof(struct mallocNode) + SENTINELSIZE;
    6969}
    7070
    71 void rtems_malloc_boundary_at_malloc(
     71static void rtems_malloc_boundary_at_malloc(
    7272  void     *pointer,
    7373  size_t    size
     
    100100}
    101101
    102 void reportMallocError(const char *msg, struct mallocNode *mp);
     102static void reportMallocError(const char *msg, struct mallocNode *mp);
    103103
    104 void rtems_malloc_boundary_at_free(
     104static void rtems_malloc_boundary_at_free(
    105105  void     *pointer
    106106)
     
    128128}
    129129
    130 void rtems_malloc_boundary_at_realloc(
     130static void rtems_malloc_boundary_at_realloc(
    131131  void     *pointer,
    132132  size_t    size
     
    150150/*   &rtems_malloc_boundary_functions_table; */
    151151
    152 void reportMallocError(const char *msg, struct mallocNode *mp)
     152static void reportMallocError(const char *msg, struct mallocNode *mp)
    153153{
    154154    unsigned char *sp = (unsigned char *)mp->memory + mp->size;
     
    179179}
    180180
    181 void checkMallocArena(void)
     181static void checkMallocArena(void)
    182182{
    183183  struct mallocNode *mp;
  • cpukit/libcsupport/src/malloc_initialize.c

    r1e2d7510 r7c411bd  
     1/**
     2 * @file
     3 *
     4 * @brief Malloc initialization implementation.
     5 */
     6
    17/*
    2  *  RTEMS Malloc Family Implementation --Initialization
    3  *
    4  *
    58 *  COPYRIGHT (c) 1989-2007.
    69 *  On-Line Applications Research Corporation (OAR).
     
    2528#ifndef RTEMS_NEWLIB
    2629void RTEMS_Malloc_Initialize(
    27   void   *start,
    28   size_t  length,
    29   size_t  sbrk_amount
     30  void *heap_begin,
     31  uintptr_t heap_size,
     32  size_t sbrk_amount
    3033)
    3134{
     
    3639
    3740void RTEMS_Malloc_Initialize(
    38   void   *start,
    39   size_t  length,
    40   size_t  sbrk_amount
     41  void *heap_begin,
     42  uintptr_t heap_size,
     43  size_t sbrk_amount
    4144)
    4245{
    43   uint32_t      status;
    44   void         *starting_address;
    45 
    4646  #if defined(RTEMS_MALLOC_BOUNDARY_HELPERS)
    4747    /*
    4848     *  If configured, initialize the boundary support
    4949     */
    50     if (rtems_malloc_boundary_helpers)
     50    if ( rtems_malloc_boundary_helpers != NULL ) {
    5151      (*rtems_malloc_boundary_helpers->initialize)();
     52    }
    5253  #endif
    5354
     
    5556   *  If configured, initialize the statistics support
    5657   */
    57   if ( rtems_malloc_statistics_helpers )
     58  if ( rtems_malloc_statistics_helpers != NULL ) {
    5859    (*rtems_malloc_statistics_helpers->initialize)();
     60  }
    5961
    6062  /*
     
    6365  malloc_deferred_frees_initialize();
    6466
    65   starting_address = start;
    66 
    6767  /*
    6868   *  Initialize the optional sbrk support for extending the heap
    6969   */
    70   if (rtems_malloc_sbrk_helpers) {
    71     starting_address = (*rtems_malloc_sbrk_helpers->initialize)(
    72       start,
     70  if ( rtems_malloc_sbrk_helpers != NULL ) {
     71    void *new_heap_begin = (*rtems_malloc_sbrk_helpers->initialize)(
     72      heap_begin,
    7373      sbrk_amount
    7474    );
     75
     76    heap_size -= (uintptr_t) new_heap_begin - (uintptr_t) heap_begin;
     77    heap_begin = new_heap_begin;
    7578  }
    7679
     
    9396   */
    9497
    95   if ( !rtems_unified_work_area &&
    96        rtems_configuration_get_do_zero_of_workspace() )
    97      memset( starting_address, 0, length );
     98  if (
     99    !rtems_unified_work_area
     100      && rtems_configuration_get_do_zero_of_workspace()
     101  ) {
     102     memset( heap_begin, 0, heap_size );
     103  }
    98104
    99105  /*
     
    104110
    105111  if ( !rtems_unified_work_area ) {
    106     status = _Protected_heap_Initialize(
     112    uintptr_t status = _Protected_heap_Initialize(
    107113      RTEMS_Malloc_Heap,
    108       starting_address,
    109       length,
     114      heap_begin,
     115      heap_size,
    110116      CPU_HEAP_ALIGNMENT
    111117    );
    112     if ( !status )
    113       rtems_fatal_error_occurred( status );
     118    if ( status == 0 ) {
     119      rtems_fatal_error_occurred( RTEMS_NO_MEMORY );
     120    }
    114121  }
    115122
     
    119126    if ( _Protected_heap_Walk( RTEMS_Malloc_Heap, 0, false ) ) {
    120127      printk( "Malloc heap not initialized correctly\n" );
    121       rtems_print_buffer( start, 32 );
     128      rtems_print_buffer( heap_begin, 32 );
    122129      printk( "\n" );
    123       rtems_print_buffer( (start + length) - 48, 48 );
     130      rtems_print_buffer( (heap_begin + heap_size) - 48, 48 );
    124131      rtems_fatal_error_occurred( RTEMS_NO_MEMORY );
    125132    }
  • cpukit/libcsupport/src/malloc_report_statistics_plugin.c

    r1e2d7510 r7c411bd  
    2626{
    2727  rtems_malloc_statistics_t *s;
    28   uint32_t                  allocated;
     28  uintmax_t allocated;
    2929
    3030  s = &rtems_malloc_statistics;
     
    4949  (*print)(
    5050    context,
    51     "  Call counts:   malloc:%"PRIu32"   free:%"PRIu32
     51    "  Call counts:   malloc:%"PRIu32"   memalign:%"PRIu32"   free:%"PRIu32
    5252       "   realloc:%"PRIu32"   calloc:%"PRIu32"\n",
    5353    s->malloc_calls,
     54    s->memalign_calls,
    5455    s->free_calls,
    5556    s->realloc_calls,
  • cpukit/libcsupport/src/malloc_statistics_helpers.c

    r1e2d7510 r7c411bd  
    2424
    2525
    26 void rtems_malloc_statistics_initialize( void )
     26static void rtems_malloc_statistics_initialize( void )
    2727{
    2828  /*
     
    3232}
    3333
    34 void rtems_malloc_statistics_at_malloc(
     34static void rtems_malloc_statistics_at_malloc(
    3535  void *pointer
    3636)
    3737{
    38   intptr_t actual_size = 0;
    39   uint32_t  current_depth;
     38  uintptr_t actual_size = 0;
     39  uint32_t current_depth;
    4040  rtems_malloc_statistics_t *s = &rtems_malloc_statistics;
    4141
     
    4747  MSBUMP(lifetime_allocated, actual_size);
    4848
    49   current_depth = s->lifetime_allocated - s->lifetime_freed;
     49  current_depth = (uint32_t) (s->lifetime_allocated - s->lifetime_freed);
    5050  if (current_depth > s->max_depth)
    5151      s->max_depth = current_depth;
     
    5656 *  size and thus we skip updating the statistics.
    5757 */
    58 void rtems_malloc_statistics_at_free(
     58static void rtems_malloc_statistics_at_free(
    5959  void *pointer
    6060)
    6161{
    62   intptr_t size;
     62  uintptr_t size;
    6363
    6464  if (_Protected_heap_Get_block_size(RTEMS_Malloc_Heap, pointer, &size) ) {
  • cpukit/libcsupport/src/malloc_walk.c

    r1e2d7510 r7c411bd  
    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, (int) source, printf_enabled );
    2626}
    2727
  • cpukit/libcsupport/src/realloc.c

    r1e2d7510 r7c411bd  
    2626)
    2727{
    28   intptr_t old_size;
     28  uintptr_t old_size;
    2929  char    *new_area;
    30   intptr_t resize;
     30  uintptr_t resize;
    3131
    3232  MSBUMP(realloc_calls, 1);
     
    8989  new_area = malloc( size );
    9090
    91   MSBUMP(malloc_calls, -1);   /* subtract off the malloc */
     91  MSBUMP(malloc_calls, (uint32_t) -1);   /* subtract off the malloc */
    9292
    9393  if ( !new_area ) {
  • cpukit/libcsupport/src/vprintk.c

    r1e2d7510 r7c411bd  
    2626
    2727static void printNum(
    28   long unsigned int num,
    29   int               base,
    30   int               sign,
    31   int               maxwidth,
    32   int               lead
     28  long num,
     29  int base,
     30  int sign,
     31  int maxwidth,
     32  int lead
    3333);
    3434
     
    4747)
    4848{
    49   char     c, *str;
     49  char     c;
    5050  int      lflag, base, sign, width, lead, minus;
    5151
     
    8181    }
    8282    if ( c == 'c' ) {
    83       BSP_output_char(va_arg(ap, int));
     83      char chr = (char) va_arg(ap, int);
     84      BSP_output_char(chr);
    8485      continue;
    8586    }
    8687    if ( c == 's' ) {
    8788      int i, len;
    88       char *s;
     89      char *s, *str;
    8990
    9091      str = va_arg(ap, char *);
     92
     93      if ( str == NULL ) {
     94        str = "";
     95      }
    9196
    9297      /* calculate length of string */
     
    134139
    135140    printNum(
    136       lflag ? va_arg(ap, long int) : (long int)va_arg(ap, int),
     141      lflag ? va_arg(ap, long) : (long) va_arg(ap, int),
    137142      base,
    138143      sign,
     
    150155 */
    151156static void printNum(
    152   long unsigned int num,
    153   int               base,
    154   int               sign,
    155   int               maxwidth,
    156   int               lead
     157  long num,
     158  int base,
     159  int sign,
     160  int maxwidth,
     161  int lead
    157162)
    158163{
    159   long unsigned int n;
    160   int               count;
    161   char              toPrint[20];
     164  long n;
     165  int count;
     166  char toPrint[20];
    162167
    163168  if ( (sign == 1) && ((long)num <  0) ) {
     
    169174  count = 0;
    170175  while ((n = num / base) > 0) {
    171     toPrint[count++] = (num - (n*base));
     176    toPrint[count++] = (char) (num - (n*base));
    172177    num = n;
    173178  }
    174   toPrint[count++] = num;
     179  toPrint[count++] = (char) num;
    175180
    176181  for (n=maxwidth ; n > count; n-- )
    177     BSP_output_char(lead);
     182    BSP_output_char((char) lead);
    178183
    179184  for (n = 0; n < count; n++) {
  • cpukit/rtems/inline/rtems/rtems/region.inl

    r1e2d7510 r7c411bd  
    7979RTEMS_INLINE_ROUTINE void *_Region_Allocate_segment (
    8080  Region_Control *the_region,
    81   intptr_t        size
     81  uintptr_t       size
    8282)
    8383{
    84    return _Heap_Allocate( &the_region->Memory, size );
     84  return _Heap_Allocate( &the_region->Memory, size );
    8585}
    8686
  • cpukit/score/src/wkspace.c

    r1e2d7510 r7c411bd  
    3434void _Workspace_Handler_initialization(void)
    3535{
    36   uint32_t    memory_available;
    37   void       *starting_address;
    38   size_t      size;
    39 
    40   starting_address = Configuration.work_space_start;
    41   size             = Configuration.work_space_size;
    42 
    43   if ( !starting_address || !_Addresses_Is_aligned( starting_address ) )
    44     _Internal_error_Occurred(
    45       INTERNAL_ERROR_CORE,
    46       true,
    47       INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS
    48     );
     36  uintptr_t memory_available = 0;
     37  void *starting_address = Configuration.work_space_start;
     38  uintptr_t size = Configuration.work_space_size;
    4939
    5040  if ( Configuration.do_zero_of_workspace )
Note: See TracChangeset for help on using the changeset viewer.