Changeset 37f4c2d in rtems for c


Ignore:
Timestamp:
09/27/95 20:53:58 (28 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
07058e7
Parents:
c701f197
Message:

Modified UNIX simulator port so all references to native unix
stuff is in the executive source proper in the file cpu.c. This
should help avoid conflicts between RTEMS POSIX files and UNIX files.

Location:
c/src
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/cpu/unix/cpu.c

    rc701f197 r37f4c2d  
    2121#include <rtems/score/interr.h>
    2222
     23#if defined(solaris2)
     24#undef  _POSIX_C_SOURCE
     25#define _POSIX_C_SOURCE 3
     26#undef  __STRICT_ANSI__
     27#define __STRICT_ANSI__
     28#endif
     29 
     30#if defined(linux)
     31#define MALLOC_0_RETURNS_NULL
     32#endif
     33 
    2334#include <stdio.h>
    2435#include <stdlib.h>
     36#include <setjmp.h>
    2537#include <signal.h>
    2638#include <time.h>
    2739#include <sys/time.h>
     40#include <sys/types.h>
     41#include <errno.h>
     42#include <unistd.h>
     43#include <sys/ipc.h>
     44#include <sys/shm.h>
     45#include <sys/sem.h>
    2846
    2947#ifndef SA_RESTART
    3048#define SA_RESTART 0
    3149#endif
     50
     51typedef struct {
     52  jmp_buf   regs;
     53  sigset_t  isr_level;
     54} Context_Control_overlay;
    3255
    3356void  _CPU_Signal_initialize(void);
     
    376399
    377400  if ( _new_level == 0 )
    378     source = _CPU_Context_Default_with_ISRs_enabled.regs;
     401    source = &_CPU_Context_Default_with_ISRs_enabled;
    379402  else
    380     source = _CPU_Context_Default_with_ISRs_disabled.regs;
     403    source = &_CPU_Context_Default_with_ISRs_disabled;
    381404     
    382405  memcpy(_the_context, source, sizeof(Context_Control) ); /* sizeof(jmp_buf)); */
     
    453476)
    454477{
    455   sigprocmask( SIG_SETMASK, &next->isr_level, 0 );
    456   longjmp( next->regs, 0 );
     478  Context_Control_overlay *nextp = (Context_Control_overlay *)next;
     479
     480  sigprocmask( SIG_SETMASK, &nextp->isr_level, 0 );
     481  longjmp( nextp->regs, 0 );
    457482}
    458483
     
    467492)
    468493{
     494  Context_Control_overlay *currentp = (Context_Control_overlay *)current;
     495  Context_Control_overlay *nextp = (Context_Control_overlay *)next;
     496
    469497  int status;
    470498
     
    473501   */
    474502
    475   status = sigprocmask( SIG_SETMASK, &next->isr_level, &current->isr_level );
     503  status = sigprocmask( SIG_SETMASK, &nextp->isr_level, &currentp->isr_level );
    476504  if ( status )
    477505    _Internal_error_Occurred(
     
    481509    );
    482510
    483   if (setjmp(current->regs) == 0) {    /* Save the current context */
    484      longjmp(next->regs, 0);           /* Switch to the new context */
     511  if (setjmp(currentp->regs) == 0) {    /* Save the current context */
     512     longjmp(nextp->regs, 0);           /* Switch to the new context */
    485513     if ( status )
    486514       _Internal_error_Occurred(
     
    611639void _CPU_Stray_signal(int sig_num)
    612640{
    613   char buffer[ 80 ];   
     641  char buffer[ 4 ];   
    614642
    615643  /*
     
    618646   */
    619647
    620   write(
    621     2,
    622     buffer,
    623     sprintf( buffer, "Stray signal %d\n", sig_num )
    624   );
     648  buffer[ 0 ] = (sig_num >> 4) + 0x30;
     649  buffer[ 1 ] = (sig_num & 0xf) + 0x30;
     650  buffer[ 2 ] = '\n';
     651
     652  write( 2, "Stray signal 0x", 12 );
     653  write( 2, buffer, 3 );
    625654 
    626655  /*
     
    681710  return output;
    682711}
     712
     713
     714/*
     715 *  Special Purpose Routines to hide the use of UNIX system calls.
     716 */
     717
     718#if 0
     719/* XXX clock had this set of #define's */
     720
     721/*
     722 *  In order to get the types and prototypes used in this file under
     723 *  Solaris 2.3, it is necessary to pull the following magic.
     724 */
     725 
     726#if defined(solaris)
     727#warning "Ignore the undefining __STDC__ warning"
     728#undef __STDC__
     729#define __STDC__ 0
     730#undef  _POSIX_C_SOURCE
     731#endif
     732#endif
     733
     734int _CPU_Get_clock_vector( void )
     735{
     736  return SIGALRM;
     737}
     738
     739
     740void _CPU_Start_clock(
     741  int microseconds
     742)
     743{
     744  struct itimerval  new;
     745
     746  new.it_value.tv_sec = 0;
     747  new.it_value.tv_usec = microseconds;
     748  new.it_interval.tv_sec = 0;
     749  new.it_interval.tv_usec = microseconds;
     750
     751  setitimer(ITIMER_REAL, &new, 0);
     752}
     753
     754void _CPU_Stop_clock( void )
     755{
     756  struct itimerval  new;
     757  struct sigaction  act;
     758 
     759  /*
     760   * Set the SIGALRM signal to ignore any last
     761   * signals that might come in while we are
     762   * disarming the timer and removing the interrupt
     763   * vector.
     764   */
     765 
     766  act.sa_handler = SIG_IGN;
     767
     768  sigaction(SIGALRM, &act, 0);
     769 
     770  new.it_value.tv_sec = 0;
     771  new.it_value.tv_usec = 0;
     772 
     773  setitimer(ITIMER_REAL, &new, 0);
     774}
     775
     776int  _CPU_SHM_Semid;
     777extern       void fix_syscall_errno( void );
     778
     779void _CPU_SHM_Init(
     780  unsigned32   maximum_nodes,
     781  boolean      is_master_node,
     782  void       **shm_address,
     783  unsigned32  *shm_length
     784)
     785{
     786  int          i;
     787  int          shmid;
     788  char        *shm_addr;
     789  key_t        shm_key;
     790  key_t        sem_key;
     791  int          status;
     792  int          shm_size;
     793 
     794  if (getenv("RTEMS_SHM_KEY"))
     795    shm_key = strtol(getenv("RTEMS_SHM_KEY"), 0, 0);
     796  else
     797#ifdef RTEMS_SHM_KEY
     798    shm_key = RTEMS_SHM_KEY;
     799#else
     800    shm_key = 0xa000;
     801#endif
     802 
     803    if (getenv("RTEMS_SHM_SIZE"))
     804      shm_size = strtol(getenv("RTEMS_SHM_SIZE"), 0, 0);
     805    else
     806#ifdef RTEMS_SHM_SIZE
     807      shm_size = RTEMS_SHM_SIZE;
     808#else
     809      shm_size = 64 * 1024;
     810#endif
     811 
     812    if (getenv("RTEMS_SHM_SEMAPHORE_KEY"))
     813      sem_key = strtol(getenv("RTEMS_SHM_SEMAPHORE_KEY"), 0, 0);
     814    else
     815#ifdef RTEMS_SHM_SEMAPHORE_KEY
     816      sem_key = RTEMS_SHM_SEMAPHORE_KEY;
     817#else
     818      sem_key = 0xa001;
     819#endif
     820 
     821    shmid = shmget(shm_key, shm_size, IPC_CREAT | 0660);
     822    if ( shmid == -1 ) {
     823      fix_syscall_errno(); /* in case of newlib */
     824      perror( "shmget" );
     825      _CPU_Fatal_halt( 0xdead0001 );
     826    }
     827 
     828    shm_addr = shmat(shmid, (char *)0, SHM_RND);
     829    if ( shm_addr == (void *)-1 ) {
     830      fix_syscall_errno(); /* in case of newlib */
     831      perror( "shmat" );
     832      _CPU_Fatal_halt( 0xdead0002 );
     833    }
     834 
     835    _CPU_SHM_Semid = semget(sem_key, maximum_nodes + 1, IPC_CREAT | 0660);
     836    if ( _CPU_SHM_Semid == -1 ) {
     837      fix_syscall_errno(); /* in case of newlib */
     838      perror( "semget" );
     839      _CPU_Fatal_halt( 0xdead0003 );
     840    }
     841 
     842    if ( is_master_node ) {
     843      for ( i=0 ; i <= maximum_nodes ; i++ ) {
     844#if defined(solaris2)
     845        union semun {
     846          int val;
     847          struct semid_ds *buf;
     848          ushort *array;
     849        } help;
     850 
     851        help.val = 1;
     852        status = semctl( _CPU_SHM_Semid, i, SETVAL, help );
     853#endif
     854#if defined(hpux)
     855        status = semctl( _CPU_SHM_Semid, i, SETVAL, 1 );
     856#endif
     857 
     858        fix_syscall_errno(); /* in case of newlib */
     859        if ( status == -1 ) {
     860          _CPU_Fatal_halt( 0xdead0004 );
     861        }
     862      }
     863    }
     864 
     865  *shm_address = shm_addr;
     866  *shm_length = shm_size;
     867
     868}
     869
     870int _CPU_Get_pid( void )
     871{
     872  return getpid();
     873}
     874
     875/*
     876 * Define this to use signals for MPCI shared memory driver.
     877 * If undefined, the shared memory driver will poll from the
     878 * clock interrupt.
     879 * Ref: ../shmsupp/getcfg.c
     880 *
     881 * BEWARE:: many UN*X kernels and debuggers become severely confused when
     882 *          debugging programs which use signals.  The problem is *much*
     883 *          worse when using multiple signals, since ptrace(2) tends to
     884 *          drop all signals except 1 in the case of multiples.
     885 *          On hpux9, this problem was so bad, we couldn't use interrupts
     886 *          with the shared memory driver if we ever hoped to debug
     887 *          RTEMS programs.
     888 *          Maybe systems that use /proc don't have this problem...
     889 */
     890 
     891 
     892int _CPU_SHM_Get_vector( void )
     893{
     894#ifdef CPU_USE_SHM_INTERRUPTS
     895  return SIGUSR1;
     896#else
     897  return 0;
     898#endif
     899}
     900
     901void _CPU_SHM_Send_interrupt(
     902  int pid,
     903  int vector
     904)
     905{
     906  kill((pid_t) pid, vector);
     907}
     908
     909void _CPU_SHM_Lock(
     910  int semaphore
     911)
     912{
     913  struct sembuf      sb;
     914  int                status;
     915 
     916  sb.sem_num = semaphore;
     917  sb.sem_op  = -1;
     918  sb.sem_flg = 0;
     919 
     920  while (1) {
     921    status = semop(_CPU_SHM_Semid, &sb, 1);
     922    if ( status >= 0 )
     923      break;
     924    if ( status == -1 ) {
     925       fix_syscall_errno();    /* in case of newlib */
     926        if (errno == EINTR)
     927            continue;
     928        perror("shm lock");
     929        _CPU_Fatal_halt( 0xdead0005 );
     930    }
     931  }
     932
     933}
     934
     935void _CPU_SHM_Unlock(
     936  int semaphore
     937)
     938{
     939  struct sembuf  sb;
     940  int            status;
     941 
     942  sb.sem_num = semaphore;
     943  sb.sem_op  = 1;
     944  sb.sem_flg = 0;
     945 
     946  while (1) {
     947    status = semop(_CPU_SHM_Semid, &sb, 1);
     948    if ( status >= 0 )
     949      break;
     950 
     951    if ( status == -1 ) {
     952      fix_syscall_errno();    /* in case of newlib */
     953      if (errno == EINTR)
     954          continue;
     955      perror("shm unlock");
     956      _CPU_Fatal_halt( 0xdead0006 );
     957    }
     958  }
     959
     960}
  • c/src/exec/score/cpu/unix/cpu.h

    rc701f197 r37f4c2d  
    3232#endif
    3333
     34#include <rtems/score/unixsize.h>
     35
    3436#if defined(solaris2)
    3537#undef  _POSIX_C_SOURCE
     
    4244#define MALLOC_0_RETURNS_NULL
    4345#endif
    44 
    45 #include <unistd.h>
    46 #include <setjmp.h>
    47 #include <signal.h>
    4846
    4947/* conditional compilation parameters */
     
    432430 */
    433431
     432/*
     433 *  This is really just the area for the following fields.
     434 *
     435 *    jmp_buf   regs;
     436 *    sigset_t  isr_level;
     437 *
     438 *  Doing it this way avoids conflicts between the native stuff and the
     439 *  RTEMS stuff.
     440 */
    434441typedef struct {
    435   jmp_buf   regs;
    436   sigset_t  isr_level;
     442  char      Area[ CPU_CONTEXT_SIZE_IN_BYTES ];
    437443} Context_Control;
    438444
     
    969975}
    970976
     977/*
     978 *  Special Purpose Routines to hide the use of UNIX system calls.
     979 */
     980
     981int _CPU_Get_clock_vector( void );
     982
     983void _CPU_Start_clock(
     984  int microseconds
     985);
     986
     987void _CPU_Stop_clock( void );
     988
     989void _CPU_SHM_Init(
     990  unsigned32   maximum_nodes,
     991  boolean      is_master_node,
     992  void       **shm_address,
     993  unsigned32  *shm_length
     994);
     995
     996int _CPU_Get_pid( void );
     997 
     998int _CPU_SHM_Get_vector( void );
     999 
     1000void _CPU_SHM_Send_interrupt(
     1001  int pid,
     1002  int vector
     1003);
     1004 
     1005void _CPU_SHM_Lock(
     1006  int semaphore
     1007);
     1008
     1009void _CPU_SHM_Unlock(
     1010  int semaphore
     1011);
     1012
    9711013#ifdef __cplusplus
    9721014}
  • c/src/lib/libbsp/shmdr/init.c

    rc701f197 r37f4c2d  
    237237
    238238  MPCI_Shm_extensions.fatal = MPCI_Fatal;
     239
    239240  (void) rtems_extension_create(
    240241    rtems_build_name( 'M', 'P', 'E', 'X' ),
  • c/src/lib/libbsp/unix/posix/clock/clock.c

    rc701f197 r37f4c2d  
    1515 */
    1616
    17 #include <rtems.h>
     17#include <bsp.h>
    1818#include <rtems/libio.h>
    19 #include <bsp.h>
    20 
    21 /*
    22  *  In order to get the types and prototypes used in this file under
    23  *  Solaris 2.3, it is necessary to pull the following magic.
    24  */
    25  
    26 #if defined(solaris)
    27 #warning "Ignore the undefining __STDC__ warning"
    28 #undef __STDC__
    29 #define __STDC__ 0
    30 #undef  _POSIX_C_SOURCE
    31 #endif
    32  
    3319#include <stdlib.h>
    34 #include <stdio.h>
    35 #include <signal.h>
    36 #include <time.h>
    37 
    38 extern rtems_configuration_table Configuration;
    3920
    4021void Clock_exit(void);
    4122
    4223volatile rtems_unsigned32 Clock_driver_ticks;
     24
     25rtems_unsigned32 Clock_driver_vector;
    4326
    4427/*
     
    5235Install_clock(rtems_isr_entry clock_isr)
    5336{
    54     struct itimerval  new;
    55 
    5637    Clock_driver_ticks = 0;
    5738
    58     new.it_value.tv_sec = 0;
    59     new.it_value.tv_usec = Configuration.microseconds_per_tick;
    60     new.it_interval.tv_sec = 0;
    61     new.it_interval.tv_usec = Configuration.microseconds_per_tick;
     39    (void)set_vector(clock_isr, Clock_driver_vector, 1);
    6240
    63     (void)set_vector(clock_isr, SIGALRM, 1);
    64 
    65     setitimer(ITIMER_REAL, &new, 0);
     41    _CPU_Start_clock( BSP_Configuration.microseconds_per_tick );
    6642
    6743    atexit(Clock_exit);
     
    7450
    7551    rtems_interrupt_disable(isrlevel);
    76     (void)set_vector(new_clock_isr, SIGALRM, 1);
     52    (void)set_vector(new_clock_isr, Clock_driver_vector, 1);
    7753    rtems_interrupt_enable(isrlevel);
    7854}
     
    9369Clock_exit(void)
    9470{
    95     struct itimerval  new;
    96      struct sigaction  act;
     71  _CPU_Stop_clock();
    9772
    98      /*
    99       * Set the SIGALRM signal to ignore any last
    100       * signals that might come in while we are
    101       * disarming the timer and removing the interrupt
    102       * vector.
    103       */
    104 
    105      act.sa_handler = SIG_IGN;
    106 
    107      sigaction(SIGALRM, &act, 0);
    108 
    109     new.it_value.tv_sec = 0;
    110     new.it_value.tv_usec = 0;
    111 
    112     setitimer(ITIMER_REAL, &new, 0);
    113 
    114     (void)set_vector(0, SIGALRM, 1);
     73  (void)set_vector(0, Clock_driver_vector, 1);
    11574}
    11675
     
    12281)
    12382{
     83    Clock_driver_vector = _CPU_Get_clock_vector();
     84
    12485    Install_clock((rtems_isr_entry) Clock_isr);
    12586
     
    151112    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
    152113    {
    153         Clock_isr(SIGALRM);
     114        Clock_isr(Clock_driver_vector);
    154115    }
    155116    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
  • c/src/lib/libbsp/unix/posix/console/console.c

    rc701f197 r37f4c2d  
    2222 */
    2323
    24 #include <rtems.h>
    2524#include <bsp.h>
    2625
  • c/src/lib/libbsp/unix/posix/include/bsp.h

    rc701f197 r37f4c2d  
    2626#include <iosupp.h>
    2727#include <libcsupport.h>
    28 #include <signal.h>
    2928
    3029/*
     
    6261
    6362extern rtems_configuration_table BSP_Configuration;
    64 
    65 /*
    66  * Define this to use signals for MPCI shared memory driver.
    67  * If undefined, the shared memory driver will poll from the
    68  * clock interrupt.
    69  * Ref: ../shmsupp/getcfg.c
    70  *
    71  * BEWARE:: many UN*X kernels and debuggers become severely confused when
    72  *          debugging programs which use signals.  The problem is *much*
    73  *          worse when using multiple signals, since ptrace(2) tends to
    74  *          drop all signals except 1 in the case of multiples.
    75  *          On hpux9, this problem was so bad, we couldn't use interrupts
    76  *          with the shared memory driver if we ever hoped to debug
    77  *          RTEMS programs.
    78  *          Maybe systems that use /proc don't have this problem...
    79  */
    80  
    81 /* #define INTERRUPT_EXTERNAL_MPCI        SIGUSR1 */
    8263
    8364/*
  • c/src/lib/libbsp/unix/posix/shmsupp/addrconv.c

    rc701f197 r37f4c2d  
    2020 */
    2121
    22 #include <rtems.h>
    23 
    2422#include <bsp.h>
    2523#include <shm.h>
  • c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c

    rc701f197 r37f4c2d  
    2626 */
    2727
    28 #include <rtems.h>
    29 
     28#include <bsp.h>
    3029#include <shm.h>
    31 #include <bsp.h>
    32 
    33 #include <sys/types.h>
    34 #include <stdio.h>
    35 #include <errno.h>
    36 #include <unistd.h>
    37 #include <stdlib.h>
    38 #include <sys/ipc.h>
    39 #include <sys/shm.h>
    40 #include <sys/sem.h>
    4130
    4231shm_config_table BSP_shm_cfgtbl;
     
    4837);
    4938
    50 void fix_semaphores( void )
    51 {
    52     rtems_unsigned32 maximum_nodes;
    53     int          i;
    54 
    55     int          shmid;
    56     char        *shm_addr;
    57     key_t        shm_key;
    58     key_t        sem_key;
    59     int          status;
    60     int          shm_size;
    61 
    62     if (getenv("RTEMS_SHM_KEY"))
    63         shm_key = strtol(getenv("RTEMS_SHM_KEY"), 0, 0);
    64     else
    65 #ifdef RTEMS_SHM_KEY
    66         shm_key = RTEMS_SHM_KEY;
    67 #else
    68         shm_key = 0xa000;
    69 #endif
    70  
    71     if (getenv("RTEMS_SHM_SIZE"))
    72         shm_size = strtol(getenv("RTEMS_SHM_SIZE"), 0, 0);
    73     else
    74 #ifdef RTEMS_SHM_SIZE
    75         shm_size = RTEMS_SHM_SIZE;
    76 #else
    77         shm_size = 64 * KILOBYTE;
    78 #endif
    79  
    80     if (getenv("RTEMS_SHM_SEMAPHORE_KEY"))
    81         sem_key = strtol(getenv("RTEMS_SHM_SEMAPHORE_KEY"), 0, 0);
    82     else
    83 #ifdef RTEMS_SHM_SEMAPHORE_KEY
    84         sem_key = RTEMS_SHM_SEMAPHORE_KEY;
    85 #else
    86         sem_key = 0xa001;
    87 #endif
    88 
    89     shmid = shmget(shm_key, shm_size, IPC_CREAT | 0660);
    90     if ( shmid == -1 ) {
    91        fix_syscall_errno(); /* in case of newlib */
    92        perror( "shmget" );
    93        rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
    94     }
    95 
    96     shm_addr = shmat(shmid, (char *)0, SHM_RND);
    97     if ( shm_addr == (void *)-1 ) {
    98        fix_syscall_errno(); /* in case of newlib */
    99        perror( "shmat" );
    100        rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
    101     }
    102 
    103     maximum_nodes = Shm_RTEMS_MP_Configuration->maximum_nodes;
    104     semid = semget(sem_key, maximum_nodes + 1, IPC_CREAT | 0660);
    105     if ( semid == -1 ) {
    106        fix_syscall_errno(); /* in case of newlib */
    107        perror( "semget" );
    108        rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
    109     }
    110 
    111     if ( Shm_Is_master_node() ) {
    112       for ( i=0 ; i <= maximum_nodes ; i++ ) {
    113 
    114 #if defined(solaris2)
    115         union semun {
    116           int val;
    117           struct semid_ds *buf;
    118           ushort *array;
    119         } help;
    120  
    121         help.val = 1;
    122         semctl( semid, i, SETVAL, help );
    123 #endif
    124 #if defined(hpux)
    125         semctl( semid, i, SETVAL, 1 );
    126 #endif
    127 
    128         fix_syscall_errno(); /* in case of newlib */
    129         if ( status == -1 ) {
    130           fprintf( stderr, "Sem init failed %d\n", errno ); fflush( stderr );
    131           rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
    132         }
    133       }
    134     }
    135 
    136     BSP_shm_cfgtbl.base         = (vol_u32 *)shm_addr;
    137     BSP_shm_cfgtbl.length       = shm_size;
    138 }
    139 
    14039void Shm_Get_configuration(
    14140  rtems_unsigned32   localnode,
     
    14342)
    14443{
    145     fix_semaphores();
     44  _CPU_SHM_Init(
     45    Shm_Maximum_nodes,
     46    Shm_Is_master_node(),
     47    (void **)&BSP_shm_cfgtbl.base,
     48    (unsigned32 *)&BSP_shm_cfgtbl.length
     49  );
    14650
    147     BSP_shm_cfgtbl.format       = SHM_BIG;
     51  BSP_shm_cfgtbl.format       = SHM_BIG;
    14852
    149     BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt_unix;
     53  BSP_shm_cfgtbl.cause_intr   = Shm_Cause_interrupt_unix;
    15054
    15155#ifdef NEUTRAL_BIG
    152     BSP_shm_cfgtbl.convert      = NULL_CONVERT;
     56  BSP_shm_cfgtbl.convert      = NULL_CONVERT;
    15357#else
    154     BSP_shm_cfgtbl.convert      = CPU_swap_u32;
     58  BSP_shm_cfgtbl.convert      = CPU_swap_u32;
    15559#endif
    15660
    157 #ifdef INTERRUPT_EXTERNAL_MPCI
     61  if ( _CPU_SHM_Get_vector() ) {
    15862    BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
    159     BSP_shm_cfgtbl.Intr.address = (vol_u32 *) getpid();    /* process id */
    160     BSP_shm_cfgtbl.Intr.value   = INTERRUPT_EXTERNAL_MPCI; /* signal to send */
     63    BSP_shm_cfgtbl.Intr.address = (vol_u32 *) _CPU_Get_pid(); /* process id */
     64    BSP_shm_cfgtbl.Intr.value   = _CPU_SHM_Get_vector(); /* signal to send */
    16165    BSP_shm_cfgtbl.Intr.length  = LONG;
    162 #else
     66  } else {
    16367    BSP_shm_cfgtbl.poll_intr    = POLLED_MODE;
    16468    BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
    16569    BSP_shm_cfgtbl.Intr.value   = NO_INTERRUPT;
    16670    BSP_shm_cfgtbl.Intr.length  = NO_INTERRUPT;
    167 #endif
     71  }
    16872
    169     *shmcfg = &BSP_shm_cfgtbl;
     73  *shmcfg = &BSP_shm_cfgtbl;
    17074}
  • c/src/lib/libbsp/unix/posix/shmsupp/intr.c

    rc701f197 r37f4c2d  
    2020 */
    2121
    22 #include <rtems.h>
     22#include <bsp.h>
    2323#include <shm.h>
    2424
    25 #include <stdio.h>
    26 #include <signal.h>
    27  
    2825void Shm_Cause_interrupt_unix(
    2926  rtems_unsigned32 node
    3027)
    3128{
    32     Shm_Interrupt_information *intr;
    33     intr = &Shm_Interrupt_table[node];
     29  Shm_Interrupt_information *intr;
     30  intr = &Shm_Interrupt_table[node];
    3431 
    35     kill((pid_t) intr->address, intr->value);
     32  _CPU_SHM_Send_interrupt( (int) intr->address, (int) intr->value );
    3633}
  • c/src/lib/libbsp/unix/posix/shmsupp/lock.c

    rc701f197 r37f4c2d  
    1818 */
    1919
    20 #include <rtems.h>
    21 
    2220#include <bsp.h>
    2321#include <shm.h>
    24 
    25 #include <errno.h>
    26 #include <stdio.h>
    27 #include <unistd.h>
    28 #include <sys/ipc.h>
    29 #include <sys/shm.h>
    30 #include <sys/sem.h>
    3122
    3223extern int      semid;
     
    5647)
    5748{
    58     rtems_unsigned32   isr_level;
    59     struct sembuf      sb;
    60     int                status;
     49  rtems_unsigned32   isr_level;
    6150
    62     sb.sem_num = lq_cb->lock;
    63     sb.sem_op  = -1;
    64     sb.sem_flg = 0;
     51  rtems_interrupt_disable( isr_level );
    6552
    66     rtems_interrupt_disable( isr_level );
     53  Shm_isrstat = isr_level;
    6754
    68     Shm_isrstat = isr_level;
    69 
    70     while (1) {
    71       status = semop(semid, &sb, 1);
    72       if ( status >= 0 )
    73         break;
    74       if ( status == -1 ) {
    75          fix_syscall_errno();    /* in case of newlib */
    76           if (errno == EINTR)
    77               continue;
    78           perror("shm lock");
    79           rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
    80       }
    81     }
     55  _CPU_SHM_Lock( lq_cb->lock );
    8256}
    8357
     
    9266)
    9367{
    94     rtems_unsigned32   isr_level;
    95     struct sembuf      sb;
    96     int                status;
     68  rtems_unsigned32   isr_level;
    9769
    98     sb.sem_num = lq_cb->lock;
    99     sb.sem_op  = 1;
    100     sb.sem_flg = 0;
     70  _CPU_SHM_Unlock( lq_cb->lock );
    10171
    102     while (1) {
    103       status = semop(semid, &sb, 1);
    104       if ( status >= 0 )
    105         break;
    106 
    107       if ( status == -1 ) {
    108           fix_syscall_errno();    /* in case of newlib */
    109           if (errno == EINTR)
    110               continue;
    111           perror("shm unlock");
    112           rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
    113       }
    114     }
    115 
    116     isr_level = Shm_isrstat;
    117     rtems_interrupt_enable( isr_level );
     72  isr_level = Shm_isrstat;
     73  rtems_interrupt_enable( isr_level );
    11874}
  • c/src/lib/libbsp/unix/posix/shmsupp/mpisr.c

    rc701f197 r37f4c2d  
    1919 */
    2020
    21 #include <rtems.h>
    22 
    2321#include <bsp.h>
    2422#include <shm.h>
     
    2624void Shm_setvec( void )
    2725{
    28 #ifdef INTERRUPT_EXTERNAL_MPCI
    29   set_vector( Shm_isr, INTERRUPT_EXTERNAL_MPCI, 1 );
    30 #endif
     26  int vector;
     27
     28  vector = _CPU_SHM_Get_vector();
     29
     30  if ( vector )
     31    set_vector( Shm_isr, vector, 1 );
    3132}
  • c/src/lib/libbsp/unix/posix/startup/bspclean.c

    rc701f197 r37f4c2d  
    2020 */
    2121
    22 #include <rtems.h>
    2322#include <bsp.h>
    2423
     
    3130void bsp_cleanup( void )
    3231{
    33     /*
    34      * Invoke any fatal error extension and "halt"
    35      * By definition, rtems_fatal_error_occurred does not return.
    36      */
     32  /*
     33   * Invoke any fatal error extension and "halt"
     34   * By definition, rtems_fatal_error_occurred does not return.
     35   */
    3736
    38 fflush(stdout);
    39 fflush(stderr);
     37  fflush(stdout);
     38  fflush(stderr);
    4039
    41     rtems_fatal_error_occurred(0);
     40  rtems_fatal_error_occurred(0);
    4241}
  • c/src/lib/libbsp/unix/posix/startup/bspstart.c

    rc701f197 r37f4c2d  
    2727 *  $Id$
    2828 */
    29 
    30 #include <rtems.h>
    3129
    3230#include <stdio.h>
  • c/src/lib/libbsp/unix/posix/startup/exit.c

    rc701f197 r37f4c2d  
    1515 */
    1616
    17 #include <rtems.h>
    1817#include <bsp.h>
    1918#include <clockdrv.h>
  • c/src/lib/libbsp/unix/posix/startup/setvec.c

    rc701f197 r37f4c2d  
    2525 */
    2626
    27 #include <rtems.h>
    2827#include <bsp.h>
    2928
  • c/src/lib/libbsp/unix/posix/timer/timer.c

    rc701f197 r37f4c2d  
    1717 */
    1818
    19 #include <rtems.h>
    2019
     20#include <bsp.h>
    2121#include <time.h>
    2222#include <sys/time.h>
  • c/src/libchip/shmdr/init.c

    rc701f197 r37f4c2d  
    237237
    238238  MPCI_Shm_extensions.fatal = MPCI_Fatal;
     239
    239240  (void) rtems_extension_create(
    240241    rtems_build_name( 'M', 'P', 'E', 'X' ),
  • c/src/tests/sptests/sp12/sp12.scn

    rc701f197 r37f4c2d  
    3636PRI5 - priority of PRI5 is 68
    3737<pause>
    38 TA1 - rtems_semaphore_ident - smid => 10010002
     38TA1 - rtems_semaphore_ident - smid => 14010002
    3939TA1 - rtems_semaphore_obtain - wait forever on SM2
    4040TA1 - got SM2
  • c/src/tests/sptests/sp13/sp13.scn

    rc701f197 r37f4c2d  
    11*** TEST 13 ***
    2 TA1 - rtems_message_queue_ident - qid => 14010001
     2TA1 - rtems_message_queue_ident - qid => 18010001
    33TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1
    44TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1
  • c/src/tests/sptests/sp15/sp15.scn

    rc701f197 r37f4c2d  
    22INIT - rtems_partition_create - partition 1
    33INIT - rtems_partition_create - partition 2
    4 TA1 - rtems_partition_ident - partition 1 id = 18010001
    5 TA1 - rtems_partition_ident - partition 2 id = 18010002
     4TA1 - rtems_partition_ident - partition 1 id = 1c010001
     5TA1 - rtems_partition_ident - partition 2 id = 1c010002
    66TA1 - rtems_partition_get_buffer - buffer 1 from partition 1  - 0x00000000
    77TA1 - rtems_partition_get_buffer - buffer 2 from partition 1  - 0x00000200
  • c/src/tests/sptests/sp16/sp16.scn

    rc701f197 r37f4c2d  
    11*** TEST 16 ***
    2 TA1 - rtems_region_ident - rnid => 1c010002
     2TA1 - rtems_region_ident - rnid => 20010002
    33TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2
    44TA1 - got segment from region 2 - 0x00000f78
  • c/src/tests/sptests/sp20/sp20.scn

    rc701f197 r37f4c2d  
    11*** TEST 20 ***
    2 TA1 - rtems_rate_monotonic_create id = 0x24010001
    3 TA1 - rtems_rate_monotonic_ident id = 0x24010001
    4 TA1 - (0x24010001) period 2
    5 TA2 - rtems_rate_monotonic_create id = 0x24010002
    6 TA2 - rtems_rate_monotonic_ident id = 0x24010002
    7 TA2 - (0x24010002) period 2
    8 TA3 - rtems_rate_monotonic_create id = 0x24010003
    9 TA3 - rtems_rate_monotonic_ident id = 0x24010003
    10 TA3 - (0x24010003) period 2
    11 TA4 - rtems_rate_monotonic_create id = 0x24010004
    12 TA4 - rtems_rate_monotonic_ident id = 0x24010004
    13 TA4 - (0x24010004) period 2
    14 TA5 - rtems_rate_monotonic_create id = 0x24010005
    15 TA5 - rtems_rate_monotonic_ident id = 0x24010005
    16 TA5 - (0x24010005) period 100
     2TA1 - rtems_rate_monotonic_create id = 0x28010001
     3TA1 - rtems_rate_monotonic_ident id = 0x28010001
     4TA1 - (0x28010001) period 2
     5TA2 - rtems_rate_monotonic_create id = 0x28010002
     6TA2 - rtems_rate_monotonic_ident id = 0x28010002
     7TA2 - (0x28010002) period 2
     8TA3 - rtems_rate_monotonic_create id = 0x28010003
     9TA3 - rtems_rate_monotonic_ident id = 0x28010003
     10TA3 - (0x28010003) period 2
     11TA4 - rtems_rate_monotonic_create id = 0x28010004
     12TA4 - rtems_rate_monotonic_ident id = 0x28010004
     13TA4 - (0x28010004) period 2
     14TA5 - rtems_rate_monotonic_create id = 0x28010005
     15TA5 - rtems_rate_monotonic_ident id = 0x28010005
     16TA5 - (0x28010005) period 100
    1717TA5 - PERIODS CHECK OK (1)
    1818TA5 - PERIODS CHECK OK (2)
  • c/src/tests/sptests/sp22/sp22.scn

    rc701f197 r37f4c2d  
    11*** TEST 22 ***
    22INIT - rtems_timer_create - creating timer 1
    3 INIT - timer 1 has id (0xc010001)
     3INIT - timer 1 has id (0x10010001)
    44TA1 - rtems_timer_ident - identing timer 1
    5 TA1 - timer 1 has id (0xc010001)
     5TA1 - timer 1 has id (0x10010001)
    66TA1 - rtems_clock_get - 09:00:00   12/31/1988
    77TA1 - rtems_timer_fire_after - timer 1 in 3 seconds
  • c/src/tests/sptests/sp23/sp23.scn

    rc701f197 r37f4c2d  
    11*** TEST 23 ***
    22INIT - rtems_port_create - DP1 - int = 0x00001000   ext = 0x00002000
    3 TA1 - rtems_port_ident - 0x20010001
     3TA1 - rtems_port_ident - 0x24010001
    44TA1 - rtems_port_external_to_internal - 0x0000200e  =>  0x0000100e
    55TA1 - rtems_port_internal_to_external - 0x0000100e  =>  0x0000200e
  • c/src/tests/sptests/sp25/sp25.scn

    rc701f197 r37f4c2d  
    11*** TEST 25 ***
    2 TA1 - rtems_region_ident - 0x1c010002
     2TA1 - rtems_region_ident - 0x20010002
    33TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1
    44TA1 - got segment from region 1 - 0x0000f9b8
Note: See TracChangeset for help on using the changeset viewer.