Changeset 11290355 in rtems for c/src/lib


Ignore:
Timestamp:
09/29/95 17:19:16 (28 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
1ceface
Parents:
1039ae4
Message:

all targets compile .. tony's patches in place

Location:
c/src/lib
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h

    r1039ae4 r11290355  
    1414 */
    1515
    16 #ifndef __SIMHPPA_h
    17 #define __SIMHPPA_h
     16#ifndef __PXFL_BSP_h
     17#define __PXFL_BSP_h
    1818
    1919#ifdef __cplusplus
     
    2424#include <clockdrv.h>
    2525#include <rtems/ttydrv.h>
    26 #include <libcsupport.h>
    2726
    2827/*
  • c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c

    r1039ae4 r11290355  
    5353shm_config_table BSP_shm_cfgtbl;
    5454
    55 void Shm_Cause_interrupt_simhppa(
    56   rtems_unsigned32 node
    57 );
     55void Shm_Cause_interrupt_pxfl( rtems_unsigned32 node );
    5856
    5957void Shm_Get_configuration(
     
    6664   BSP_shm_cfgtbl.format       = SHM_BIG;
    6765
    68    BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt_simhppa;
     66   BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt_pxfl;
    6967
    7068#ifdef NEUTRAL_BIG
  • c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c

    r1039ae4 r11290355  
    1 /*  void Shm_Cause_interrupt_simhppa( node )
     1/*  void Shm_Cause_interrupt_pxfl( node )
    22 *
    33 *  This routine is the shared memory driver routine which
     
    2525#include <shm.h>
    2626
    27 void Shm_Cause_interrupt_simhppa(
     27void Shm_Cause_interrupt_pxfl(
    2828  rtems_unsigned32 node
    2929)
    3030{
    3131  Shm_Interrupt_information *intr;
    32   rtems_unsigned8  *u8;
    33   rtems_unsigned16 *u16;
    3432  rtems_unsigned32 *u32;
    3533  rtems_unsigned32  value;
     
    4139    case NO_INTERRUPT:
    4240       break;
    43     case BYTE:
    44       u8   = (rtems_unsigned8 *)intr->address;
    45       fprintf(
    46         stderr,
    47         "Shm_Cause_interrupt_simhppa: Writes of unsigned8 not supported!!!\n"
    48       );
    49       rtems_shutdown_executive( 0 );
    50       break;
    51     case WORD:
    52       u16   = (rtems_unsigned16 *)intr->address;
    53       fprintf(
    54         stderr,
    55         "Shm_Cause_interrupt_simhppa: Writes of unsigned8 not supported!!!\n"
    56       );
    57       rtems_shutdown_executive( 0 );
    58       break;
    5941    case LONG:
    6042      u32   = (rtems_unsigned32 *)intr->address;
    6143      HPPA_ASM_STWAS( value, 0, u32 );
    6244      break;
     45    default:
     46      fprintf( stderr, "Shm_Cause_interrupt_pxfl: Unsupported length!!!\n" );
     47      rtems_shutdown_executive( 0 );
     48      break;
    6349  }
    6450}
  • c/src/lib/libbsp/hppa1.1/simhppa/startup/setvec.c

    r1039ae4 r11290355  
    5656             (vector < (HPPA_INTERRUPT_BSP_BASE + HPPA_BSP_INTERRUPTS)))
    5757    {
    58         simhppa_interrupt_install(handler,
    59                                   vector - HPPA_INTERRUPT_BSP_BASE,
    60                                   (rtems_isr_entry *) &previous_isr);
     58        pxfl_interrupt_install(handler,
     59                               vector - HPPA_INTERRUPT_BSP_BASE,
     60                               (rtems_isr_entry *) &previous_isr);
    6161    }
    6262#endif
  • c/src/lib/libbsp/m68k/gen68302/startup/linkcmds

    r1039ae4 r11290355  
    2020
    2121m302 = 0xf7f000;
     22_VBR = 0x000000;                /* location of the VBR table (in RAM) */
    2223
    2324SECTIONS
  • c/src/lib/libbsp/shmdr/dump.c

    r1039ae4 r11290355  
    2020#include <rtems.h>
    2121#include <stdio.h>
    22 #include <libcsupport.h>
    2322
    2423#include "shm.h"
  • c/src/lib/libbsp/shmdr/fatal.c

    r1039ae4 r11290355  
    2323
    2424void MPCI_Fatal(
    25   rtems_unsigned32 error
     25  Internal_errors_Source  source,
     26  boolean                 is_internal,
     27  rtems_unsigned32        error
    2628)
    2729{
  • c/src/lib/libbsp/shmdr/getlq.c

    r1039ae4 r11290355  
    3434  tmp_ecb = NULL;
    3535  Shm_Lock( lq_cb );
     36
    3637    tmpfront = Shm_Convert(lq_cb->front);
    3738    if ( tmpfront != Shm_Locked_queue_End_of_list ) {
     
    4243      tmp_ecb->next = Shm_Locked_queue_Not_on_list;
    4344    }
     45
    4446  Shm_Unlock( lq_cb );
    4547  return( tmp_ecb );
  • c/src/lib/libbsp/shmdr/shm.h

    r1039ae4 r11290355  
    471471void           Init_env_pool();
    472472void           Shm_Print_statistics( void );
    473 void           MPCI_Fatal( rtems_unsigned32 );
     473void           MPCI_Fatal(
     474  Internal_errors_Source  source,
     475  boolean                 is_internal,
     476  rtems_unsigned32        error
     477 );
    474478rtems_task     Shm_Cause_interrupt( rtems_unsigned32 );
    475479void           Shm_Poll();
  • c/src/lib/libbsp/shmdr/shm_driver.h

    r1039ae4 r11290355  
    471471void           Init_env_pool();
    472472void           Shm_Print_statistics( void );
    473 void           MPCI_Fatal( rtems_unsigned32 );
     473void           MPCI_Fatal(
     474  Internal_errors_Source  source,
     475  boolean                 is_internal,
     476  rtems_unsigned32        error
     477 );
    474478rtems_task     Shm_Cause_interrupt( rtems_unsigned32 );
    475479void           Shm_Poll();
  • c/src/lib/libbsp/unix/posix/include/bsp.h

    r1039ae4 r11290355  
    2525#include <console.h>
    2626#include <iosupp.h>
    27 #include <libcsupport.h>
    2827
    2928/*
  • c/src/lib/libbsp/unix/posix/startup/bspstart.c

    r1039ae4 r11290355  
    196196    rtems_fatal_error_occurred('STIO');
    197197#endif
     198
     199#if defined(MALLOC_STATS)
     200  atexit(malloc_dump);
     201#endif
     202
    198203}
    199204
  • c/src/lib/libbsp/unix/posix/startup/setvec.c

    r1039ae4 r11290355  
    88 *    type    - 0 indicates raw hardware connect
    99 *              1 indicates RTEMS interrupt connect
    10  *
    11  *  NOTE 'type' is ignored on hppa; all interrupts are owned by RTEMS
    1210 *
    1311 *  RETURNS:
     
    2624
    2725#include <bsp.h>
    28 
    29 /*
    30  * Install an interrupt handler in the right place
    31  * given its vector number from cpu/hppa.h
    32  * There are 2 places an interrupt can be installed
    33  *      _ISR_Vector_table
    34  *      bsp interrupt      XXX: nyi
    35  *
    36  * We decide which based on the vector number
    37  */
    3826
    3927rtems_isr_entry
  • c/src/lib/libc/error.c

    r1039ae4 r11290355  
    4040 *        if ((fd = open(pathname, O_RDNLY)) < 0)
    4141 *        {
    42  *            rtems_error(FLOSS_ERROR_ERRNO, "open of '%s' failed", pathname);
     42 *            rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
    4343 *            goto failed;
    4444 *        }
  • c/src/lib/libc/malloc.c

    r1039ae4 r11290355  
    1515
    1616#include <rtems.h>
    17 #ifdef RTEMS_LIBC
    18 #include <memory.h>
    19 #endif
    2017#include "libcsupport.h"
    2118#ifdef RTEMS_NEWLIB
     
    3027#include <string.h>
    3128
    32 /*
    33  *  XXX: Do we really need to duplicate these? It appears that they
    34  *       only cause typing problems.
    35  */
    36 
    37 #if 0
    38 void *malloc(size_t);
    39 void *calloc(size_t, size_t);
    40 void *realloc(void *, size_t);
    41 void free(void *);
    42 void *sbrk(size_t);
    43 #endif
    44 
    4529rtems_id RTEMS_Malloc_Heap;
    4630size_t RTEMS_Malloc_Sbrk_amount;
     31
     32#ifdef RTEMS_DEBUG
     33#define MALLOC_STATS
     34#endif
     35
     36#ifdef MALLOC_STATS
     37#define MSBUMP(f,n)    malloc_stats.f += (n)
     38
     39struct {
     40    unsigned32  space_available;             /* current size of malloc area */
     41    unsigned32  malloc_calls;                /* # calls to malloc */
     42    unsigned32  free_calls;
     43    unsigned32  realloc_calls;
     44    unsigned32  calloc_calls;
     45    unsigned32  max_depth;                   /* most ever malloc'd at 1 time */
     46    unsigned64  lifetime_allocated;
     47    unsigned64  lifetime_freed;
     48} malloc_stats;
     49
     50#else                   /* No malloc_stats */
     51#define MSBUMP(f,n)
     52#endif
    4753
    4854void RTEMS_Malloc_Initialize(
     
    7884      u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    7985
    80       /*
    81        *  Adjust the length by whatever we aligned by
    82        */
     86       /*
     87        * adjust the length by whatever we aligned by
     88        */
    8389
    8490      length -= u32_address - old_address;
     
    98104    starting_address,
    99105    length,
    100     8,                     /* XXX : use CPU dependent RTEMS constant */
     106    CPU_ALIGNMENT,
    101107    RTEMS_DEFAULT_ATTRIBUTES,
    102108    &RTEMS_Malloc_Heap
     
    104110  if ( status != RTEMS_SUCCESSFUL )
    105111    rtems_fatal_error_occurred( status );
     112
     113#ifdef MALLOC_STATS
     114  /* zero all the stats */
     115  (void) memset(&malloc_stats, 0, sizeof(malloc_stats));
     116#endif
     117 
     118  MSBUMP(space_available, length);
    106119}
    107120
     
    115128  rtems_unsigned32   sbrk_amount;
    116129  rtems_status_code  status;
     130
     131  MSBUMP(malloc_calls, 1);
    117132
    118133  if ( !size )
     
    150165      return (void *) 0;
    151166
    152     /*
    153     fprintf(stderr, "Extended the C heap starting at 0x%x for %d bytes\n",
    154         (unsigned32)starting_address, the_size);
    155      */
    156 
    157167    status = rtems_region_extend(
    158168      RTEMS_Malloc_Heap,
     
    162172    if ( status != RTEMS_SUCCESSFUL ) {
    163173      sbrk(-the_size);
    164       return(FALSE);
    165174      errno = ENOMEM;
    166175      return (void *) 0;
    167176    }
     177   
     178    MSBUMP(space_available, the_size);
     179
    168180    status = rtems_region_get_segment(
    169181      RTEMS_Malloc_Heap,
     
    179191  }
    180192
     193#ifdef MALLOC_STATS
     194  if (return_this)
     195  {
     196      unsigned32 current_depth;
     197      MSBUMP(lifetime_allocated, size);
     198      current_depth = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
     199      if (current_depth > malloc_stats.max_depth)
     200          malloc_stats.max_depth = current_depth;
     201  }
     202#endif
     203 
    181204  return return_this;
    182205}
     
    189212  register char *cptr;
    190213  int length;
     214
     215  MSBUMP(calloc_calls, 1);
    191216
    192217  length = nelem * elsize;
     
    207232  char *new_area;
    208233
     234  MSBUMP(realloc_calls, 1);
     235
    209236  if ( !ptr )
    210237    return malloc( size );
    211238
    212239  if ( !size ) {
     240    free( ptr );
     241    return (void *) 0;
     242  }
     243
     244  new_area = malloc( size );
     245  if ( !new_area ) {
    213246    free( ptr );
    214247    return (void *) 0;
     
    221254  }
    222255
    223   new_area = malloc( size );
    224   if ( !new_area ) {
    225     free( ptr );
    226     return (void *) 0;
    227   }
    228 
    229256  memcpy( new_area, ptr, (size < old_size) ? size : old_size );
    230257  free( ptr );
     
    240267  rtems_status_code status;
    241268
     269  MSBUMP(free_calls, 1);
     270
    242271  if ( !ptr )
    243272    return;
    244273
     274#ifdef MALLOC_STATS
     275  {
     276      unsigned32        size;
     277      status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size );
     278      if ( status == RTEMS_SUCCESSFUL ) {
     279          MSBUMP(lifetime_freed, size);
     280      }
     281  }
     282#endif
     283 
    245284  status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr );
    246285  if ( status != RTEMS_SUCCESSFUL ) {
     
    250289}
    251290
     291#ifdef MALLOC_STATS
     292/*
     293 * Dump the malloc statistics
     294 * May be called via atexit()  (installable by our bsp) or
     295 * at any time by user
     296 */
     297
     298void malloc_dump(void)
     299{
     300    unsigned32 allocated = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
     301
     302    printf("Malloc stats\n");
     303    printf("  avail:%uk  allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n",
     304           (unsigned int) malloc_stats.space_available / 1024,
     305           (unsigned int) allocated / 1024,
     306           /* avoid float! */
     307           (allocated * 100) / malloc_stats.space_available,
     308           (unsigned int) malloc_stats.max_depth / 1024,
     309           (malloc_stats.max_depth * 100) / malloc_stats.space_available,
     310           (unsigned long long) malloc_stats.lifetime_allocated / 1024,
     311           (unsigned long long) malloc_stats.lifetime_freed / 1024);
     312    printf("  Call counts:   malloc:%d   free:%d   realloc:%d   calloc:%d\n",
     313           malloc_stats.malloc_calls,
     314           malloc_stats.free_calls,
     315           malloc_stats.realloc_calls,
     316           malloc_stats.calloc_calls);
     317}       
     318#endif
     319
    252320/*
    253321 *  "Reentrant" versions of the above routines implemented above.
  • c/src/lib/libcpu/hppa1.1/clock/clock.c

    r1039ae4 r11290355  
    1616
    1717#include <rtems.h>
    18 #include <bsp.h>
    1918#include <rtems/libio.h>
     19
     20/* should get this from bsp.h, but it is not installed yet */
     21rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
     22extern rtems_configuration_table BSP_Configuration;
    2023
    2124#include <stdlib.h>                     /* for atexit() */
  • c/src/lib/libmisc/error/error.c

    r1039ae4 r11290355  
    4040 *        if ((fd = open(pathname, O_RDNLY)) < 0)
    4141 *        {
    42  *            rtems_error(FLOSS_ERROR_ERRNO, "open of '%s' failed", pathname);
     42 *            rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
    4343 *            goto failed;
    4444 *        }
  • c/src/lib/libmisc/monitor/mon-extension.c

    r1039ae4 r11290355  
    11/*
    2  *      @(#)extension.c 1.3 - 95/07/31
     2 *      @(#)extension.c 1.6 - 95/09/25
    33 *     
    44 *
     
    2222    rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
    2323
    24     rtems_monitor_symbol_canonical_by_value(&canonical_extension->create,
     24    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_create,
    2525                                            e->thread_create);
    2626
    27     rtems_monitor_symbol_canonical_by_value(&canonical_extension->start,
     27    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_start,
    2828                                            e->thread_start);
    29     rtems_monitor_symbol_canonical_by_value(&canonical_extension->restart,
     29    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_restart,
    3030                                            e->thread_restart);
    31     rtems_monitor_symbol_canonical_by_value(&canonical_extension->delete,
     31    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_delete,
    3232                                            e->thread_delete);
    33     rtems_monitor_symbol_canonical_by_value(&canonical_extension->tswitch,
     33    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_tswitch,
    3434                                            e->thread_switch);
    35     rtems_monitor_symbol_canonical_by_value(&canonical_extension->begin,
     35    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_begin,
    3636                                            e->thread_begin);
    37     rtems_monitor_symbol_canonical_by_value(&canonical_extension->exitted,
     37    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_exitted,
    3838                                            e->thread_exitted);
    39     rtems_monitor_symbol_canonical_by_value(&canonical_extension->fatal,
     39    rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_fatal,
    4040                                            e->fatal);
    4141}
     
    7373    length += rtems_monitor_pad(18, length);
    7474    length += printf("create: ");
    75     length += rtems_monitor_symbol_dump(&monitor_extension->create, verbose);
     75    length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose);
    7676    length += printf(";  start: ");
    77     length += rtems_monitor_symbol_dump(&monitor_extension->start, verbose);
     77    length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose);
    7878    length += printf(";  restart: ");
    79     length += rtems_monitor_symbol_dump(&monitor_extension->restart, verbose);
     79    length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose);
    8080    length += printf("\n");
    8181    length = 0;
     
    8383    length += rtems_monitor_pad(18, length);
    8484    length += printf("delete: ");
    85     length += rtems_monitor_symbol_dump(&monitor_extension->delete, verbose);
     85    length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose);
    8686    length += printf(";  switch: ");
    87     length += rtems_monitor_symbol_dump(&monitor_extension->tswitch, verbose);
     87    length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose);
    8888    length += printf(";  begin: ");
    89     length += rtems_monitor_symbol_dump(&monitor_extension->begin, verbose);
     89    length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose);
    9090    length += printf("\n");
    9191    length = 0;
     
    9393    length += rtems_monitor_pad(18, length);
    9494    length += printf("exitted: ");
    95     length += rtems_monitor_symbol_dump(&monitor_extension->exitted, verbose);
     95    length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose);
    9696    length += printf(";  fatal: ");
    97     length += rtems_monitor_symbol_dump(&monitor_extension->fatal, verbose);
     97    length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose);
    9898    length += printf("\n");
    9999    length = 0;
  • c/src/lib/libmisc/monitor/mon-symbols.c

    r1039ae4 r11290355  
    185185rtems_symbol_sort(rtems_symbol_table_t *table)
    186186{
    187 #ifdef simhppa
     187#ifdef RTEMS_ON_SIMULATOR
    188188    printf("Sorting symbols ... ");         /* so slow we need a msg */
    189189    fflush(stdout);
     
    196196          sizeof(rtems_symbol_t), rtems_symbol_string_compare);
    197197
    198 #ifdef simhppa
     198#ifdef RTEMS_ON_SIMULATOR
    199199    /* so slow we need a msg */
    200200    printf("done\n");
     
    402402        if (canonical_symbol->offset == 0)
    403403            length += printf("%.*s",
    404                              sizeof(canonical_symbol->name),
     404                             (int) sizeof(canonical_symbol->name),
    405405                             canonical_symbol->name);
    406406        else
    407407            length += printf("<%.*s+0x%x>",
    408                              sizeof(canonical_symbol->name),
     408                             (int) sizeof(canonical_symbol->name),
    409409                             canonical_symbol->name,
    410410                             canonical_symbol->offset);
  • c/src/lib/libmisc/monitor/monitor.h

    r1039ae4 r11290355  
    141141    rtems_name               name;
    142142  /* end of common portion */
    143     rtems_monitor_symbol_t  create;
    144     rtems_monitor_symbol_t  start;
    145     rtems_monitor_symbol_t  restart;
    146     rtems_monitor_symbol_t  delete;
    147     rtems_monitor_symbol_t  tswitch;
    148     rtems_monitor_symbol_t  begin;
    149     rtems_monitor_symbol_t  exitted;
    150     rtems_monitor_symbol_t  fatal;
     143    rtems_monitor_symbol_t  e_create;
     144    rtems_monitor_symbol_t  e_start;
     145    rtems_monitor_symbol_t  e_restart;
     146    rtems_monitor_symbol_t  e_delete;
     147    rtems_monitor_symbol_t  e_tswitch;
     148    rtems_monitor_symbol_t  e_begin;
     149    rtems_monitor_symbol_t  e_exitted;
     150    rtems_monitor_symbol_t  e_fatal;
    151151} rtems_monitor_extension_t;
    152152
  • c/src/lib/libmisc/stackchk/check.c

    r1039ae4 r11290355  
    129129  Objects_Id           id_ignored;
    130130  unsigned32          *p;
     131#if 0
    131132  unsigned32           i;
    132133  unsigned32           class_index;
    133134  Thread_Control      *the_thread;
    134135  Objects_Information *information;
     136#endif
    135137
    136138  if (stack_check_initialized)
     
    421423 */
    422424
    423 void Stack_check_Fatal_extension( unsigned32 status )
     425void Stack_check_Fatal_extension(
     426    Internal_errors_Source  source,
     427    boolean                 is_internal,
     428    unsigned32              status
     429)
    424430{
    425431    if (status == 0)
     
    444450      return;
    445451
     452  printf("Stack usage by thread\n");
    446453  printf(
    447454    "   ID          NAME         LOW        HIGH      AVAILABLE     USED\n"
  • c/src/lib/libmisc/stackchk/internal.h

    r1039ae4 r11290355  
    7878
    7979void Stack_check_Fatal_extension(
    80   unsigned32
     80    Internal_errors_Source  source,
     81    boolean                 is_internal,
     82    unsigned32              status
    8183);
    8284
Note: See TracChangeset for help on using the changeset viewer.