Changeset f42fb02 in rtems


Ignore:
Timestamp:
Aug 6, 1999, 4:00:32 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
22544db9
Parents:
a92280e0
Message:

Patch from Jiri Gaisler <jgais@…> to fix remote gdb use:

I just released erc32ccs-2.0.6 which includes some fixes and the
Ada-self optimisation. Remote debugging of Ada programs did not
work due to a conflict between monior and rtems trap handlers.
I have attached a modified gnatsupp.c that makes remote debugging
possible again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c

    ra92280e0 rf42fb02  
    11/*
    22 *
    3  * Support for gnat/rtems machine error exception handling.
     3 * Support for gnat/rtems interrupts and exception handling.
    44 * Jiri Gaisler, ESA/ESTEC, 17-02-1999.
    55 *
     
    1515
    1616rtems_isr __gnat_exception_handler
    17     ( rtems_vector_number trap)
     17  (rtems_vector_number trap)
    1818{
    19     rtems_unsigned32 real_trap;
    20     rtems_unsigned32 signal;
     19  rtems_unsigned32 real_trap;
     20  rtems_unsigned32 signal;
    2121
    22     real_trap = SPARC_REAL_TRAP_NUMBER(trap);
    23     switch (real_trap) {
    24         case 0x08:              /* FPU exception */
    25         case 0x0A:              /* TAG overflow */
    26         case 0x82:              /* divide by zero */
    27             signal = SIGFPE;    /* Will cause Constraint_Error */
    28             break;
    29         case 0x01:              /* Instruction access exception */
    30         case 0x09:              /* Data access exception */
    31             signal = SIGSEGV;   /* Will cause Storage_Error */
    32             break;
    33         default:                /* Anything else ... */
    34             signal = SIGILL;    /* Will cause Program_Error */
    35             break;
     22  real_trap = SPARC_REAL_TRAP_NUMBER (trap);
     23  switch (real_trap)
     24    {
     25    case 0x08:                  /* FPU exception */
     26    case 0x0A:                  /* TAG overflow */
     27    case 0x82:                  /* divide by zero */
     28      signal = SIGFPE;          /* Will cause Constraint_Error */
     29      break;
     30    case 0x01:                  /* Instruction access exception */
     31    case 0x09:                  /* Data access exception */
     32      signal = SIGSEGV;         /* Will cause Storage_Error */
     33      break;
     34    default:                    /* Anything else ... */
     35      signal = SIGILL;          /* Will cause Program_Error */
     36      break;
    3637    }
    37     kill(getpid(),signal);
     38  kill (getpid (), signal);
    3839}
    3940
    4041/*
    4142 * Asynchronous trap handler. As it happens, the interrupt trap numbers for
    42  * SPARC is 17 - 31, so we just map then directly on the same signal.
     43 * SPARC is 17 - 31, so we just map then directly on the same signal number.
    4344 */
    4445
    4546rtems_isr __gnat_interrupt_handler
    46     ( rtems_vector_number trap)
     47  (rtems_vector_number trap)
    4748{
    48     rtems_unsigned32 real_trap;
     49  rtems_unsigned32 real_trap;
    4950
    50     real_trap = SPARC_REAL_TRAP_NUMBER(trap);
     51  real_trap = SPARC_REAL_TRAP_NUMBER (trap);
    5152
    52     kill(getpid(),real_trap);
     53  kill (getpid (), real_trap);
    5354
    5455}
     
    5859 */
    5960
    60 void __gnat_signals_Abormal_termination_handler( int signo )
     61void
     62__gnat_signals_Abormal_termination_handler (int signo)
    6163{
    62   switch ( signo ) {
    63   case SIGFPE:
    64     DEBUG_puts("\nConstraint_Error\n");
    65     break;
    66   case SIGSEGV:
    67     DEBUG_puts("\nStorage_Error\n");
    68     break;
    69   default:
    70     DEBUG_puts("\nProgram_Error\n");
    71     break;
    72   }
    73   exit( 1 );
     64  switch (signo)
     65    {
     66    case SIGFPE:
     67      DEBUG_puts ("\nConstraint_Error\n");
     68      break;
     69    case SIGSEGV:
     70      DEBUG_puts ("\nStorage_Error\n");
     71      break;
     72    default:
     73      DEBUG_puts ("\nProgram_Error\n");
     74      break;
     75    }
     76  exit (1);
    7477}
    7578
    76 const struct sigaction __gnat_error_vector = {
    77   0, -1, {__gnat_signals_Abormal_termination_handler}};
     79const struct sigaction __gnat_error_vector =
     80{0, -1,
     81 {__gnat_signals_Abormal_termination_handler}};
    7882
    79 void __gnat_install_handler()
     83void
     84__gnat_install_handler ()
    8085{
    81     rtems_unsigned32 trap;
    82     rtems_isr_entry previous_isr;
     86  rtems_unsigned32 trap;
     87  rtems_isr_entry previous_isr;
    8388
    84     sigaction(SIGSEGV, &__gnat_error_vector, NULL);
    85     sigaction(SIGFPE , &__gnat_error_vector, NULL);
    86     sigaction(SIGILL , &__gnat_error_vector, NULL);
     89  sigaction (SIGSEGV, &__gnat_error_vector, NULL);
     90  sigaction (SIGFPE, &__gnat_error_vector, NULL);
     91  sigaction (SIGILL, &__gnat_error_vector, NULL);
    8792
    88     for ( trap=0 ; trap<256 ; trap++ ) {
     93  for (trap = 0; trap < 256; trap++)
     94    {
    8995
    90         /*
    91         *  Skip window overflow, underflow, and flush as well as software
    92         *  trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
    93         *  which cannot happen and where some of the space is used to pass
    94         *  paramaters to the program. Trap 0x1d is used by the clock tick
    95         *  and 0x83 by the remote debugging stub. Traps 0x14, 0x15, and 0x17
    96         *  are used by the console device driver.
    97         */
     96      /*
     97         *  Skip window overflow, underflow, and flush as well as software
     98         *  trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
     99         *  which cannot happen and where some of the space is used to pass
     100         *  paramaters to the program. Trap 0x1d is used by the clock tick,
     101         *  0x80 for system traps and 0x81 - 0x83 by the remote debugging stub.
     102         *  Avoid 0x15 (UART B interrupt) which is also used by the stub
     103         *  to generate a 'break-in' interrupt.
     104       */
    98105
    99         if (( trap >= 0x11 ) && ( trap <= 0x1f )) {
    100            if ( trap != 0x1d && trap != 0x14 && trap != 0x15 && trap != 0x17 )
    101                 rtems_interrupt_catch( __gnat_interrupt_handler,
    102                     trap, &previous_isr );
    103         } else if (( trap != 5 && trap != 6 && trap != 0x83 ) &&
    104                   (( trap < 0x70 ) || ( trap > 0x80 )))
    105             set_vector( __gnat_exception_handler,
    106                         SPARC_SYNCHRONOUS_TRAP( trap ), 1 );
     106      if ((trap >= 0x11) && (trap <= 0x1f))
     107        {
     108          if ((trap != 0x1d) && (trap != 0x15))
     109            rtems_interrupt_catch (__gnat_interrupt_handler, trap, &previous_isr);
     110        }
     111      else if ((trap != 5 && trap != 6) && ((trap < 0x70) || (trap > 0x83)))
     112        set_vector (__gnat_exception_handler, SPARC_SYNCHRONOUS_TRAP (trap), 1);
    107113    }
    108114}
Note: See TracChangeset for help on using the changeset viewer.