Changeset ba2adf5 in rtems


Ignore:
Timestamp:
Jan 19, 1999, 8:09:33 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
1924610
Parents:
b33d8a2
Message:

Patch from Jiri Gaisler <jgais@…>:

getting the spurious trap handling to work required a couple more
fixes - I have attached a patch against rtems-4.0.0 with the
necessary changes. I also added functionality so that the
address of the trapped instruction is reported and in case of
a data access error, the data address is also reported.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/cpu/sparc/cpu.h

    rb33d8a2 rba2adf5  
    473473  unsigned32               i7;
    474474  unsigned32               y;
    475   unsigned32               pad0_offset;
     475  unsigned32               tpc;
    476476} CPU_Interrupt_frame;
    477477
     
    502502#define ISF_I7_OFFSET          CPU_MINIMUM_STACK_FRAME_SIZE + 0x44
    503503#define ISF_Y_OFFSET           CPU_MINIMUM_STACK_FRAME_SIZE + 0x48
    504 #define ISF_PAD0_OFFSET        CPU_MINIMUM_STACK_FRAME_SIZE + 0x4c
     504#define ISF_TPC_OFFSET         CPU_MINIMUM_STACK_FRAME_SIZE + 0x4c
    505505
    506506#define CONTEXT_CONTROL_INTERRUPT_FRAME_SIZE CPU_MINIMUM_STACK_FRAME_SIZE + 0x50
  • c/src/exec/score/cpu/sparc/cpu_asm.S

    rb33d8a2 rba2adf5  
    337337        be,a    win_ovflow            ! No, then skip the adjustment
    338338        nop                           ! DELAY
     339        mov     %l1, %l6              ! save trapped pc for debug info
    339340        mov     %l2, %l1              ! do not return to the instruction
    340341        add     %l2, 4, %l2           ! indicated
     
    442443        rd      %y, %g1
    443444        st      %g1, [%sp + ISF_Y_OFFSET]      ! save y
     445        st      %l6, [%sp + ISF_TPC_OFFSET]    ! save real trapped pc
    444446
    445447        mov     %sp, %o1                       ! 2nd arg to ISR Handler
  • c/src/lib/libbsp/sparc/erc32/start/start.S

    rb33d8a2 rba2adf5  
    137137
    138138_CLOCK_SPEED:
    139   BAD_TRAP; BAD_TRAP; ! BAD_TRAP; BAD_TRAP;       ! 7E - 7F undefined
     139
     140  .word 0x0a, 0, 0, 0                           ! 7E (10 MHz default)
     141 
     142  BAD_TRAP;                                     ! 7F undefined
    140143
    141144  /*
  • c/src/lib/libbsp/sparc/erc32/startsis/startsis.S

    rb33d8a2 rba2adf5  
    137137
    138138_CLOCK_SPEED:
    139   BAD_TRAP; BAD_TRAP; ! BAD_TRAP; BAD_TRAP;       ! 7E - 7F undefined
     139
     140  .word 0x0a, 0, 0, 0                           ! 7E (10 MHz default)
     141 
     142  BAD_TRAP;                                     ! 7F undefined
    140143
    141144  /*
  • c/src/lib/libbsp/sparc/erc32/startup/bspstart.c

    rb33d8a2 rba2adf5  
    104104void bsp_postdriver_hook(void);
    105105void bsp_libc_init( void *, unsigned32, int );
     106extern void bsp_spurious_initialize();
    106107
    107108/*
     
    162163#endif
    163164
     165  bsp_spurious_initialize();
    164166}
    165167
  • c/src/lib/libbsp/sparc/erc32/startup/spurious.c

    rb33d8a2 rba2adf5  
    2222static const char digits[16] = "0123456789abcdef";
    2323
     24/* Simple integer-to-string conversion */
     25
     26void itos(unsigned32 u, char *s)
     27{
     28  int i;
     29
     30  for (i=0; i<8; i++) {
     31    s[i] =  digits[(u >> (28 - (i*4))) & 0x0f];
     32  }
     33}
     34
    2435/*
    2536 *  bsp_spurious_handler
     
    2940
    3041rtems_isr bsp_spurious_handler(
    31    rtems_vector_number trap
     42   rtems_vector_number trap,
     43   CPU_Interrupt_frame *isf
    3244)
    3345{
    3446  char line[ 80 ];
    35   int length;
    3647  rtems_unsigned32 real_trap;
    3748
    38   DEBUG_puts( "Spurious Trap" );
     49  real_trap = SPARC_REAL_TRAP_NUMBER(trap);
    3950
    40   real_trap = SPARC_REAL_TRAP_NUMBER(trap);
     51  strcpy(line, "Unexpected trap (0x  ) at address 0x        ");
     52  line[ 19 ] = digits[ real_trap >> 4 ];
     53  line[ 20 ] = digits[ real_trap & 0xf ];
     54  itos(isf->tpc, &line[36]);
     55  DEBUG_puts( line );
    4156
    4257  switch (real_trap) {
     
    6883      break;
    6984    case 0x09:
    70       DEBUG_puts( "data access exception" );
     85      strcpy(line, "data access exception at 0x        " );
     86      itos(ERC32_MEC.First_Failing_Address, &line[27]);
     87      DEBUG_puts( line );
    7188      break;
    7289    case 0x0A:
     
    125142
    126143    default:
    127       strcpy( line, "Number 0x  " );
    128       length = strlen ( line );
    129       line[ length - 2 ] = digits[ real_trap >> 4 ];
    130       line[ length - 1 ] = digits[ real_trap & 0xf ];
    131       DEBUG_puts( line );
    132144      break;
    133145  }
     
    143155 *  bsp_spurious_initialize
    144156 *
    145  *  Install the spurious handler for most traps.
     157 *  Install the spurious handler for most traps. Note that set_vector()
     158 *  will unmask the corresponding asynchronous interrupt, so the initial
     159 *  interrupt mask is restored after the handlers are installed.
    146160 */
    147161
     
    149163{
    150164  rtems_unsigned32 trap;
     165  unsigned32 level = 15;
     166  unsigned32 mask;
     167
     168  sparc_disable_interrupts(level);
     169  mask = ERC32_MEC.Interrupt_Mask;
    151170
    152171  for ( trap=0 ; trap<256 ; trap++ ) {
     
    154173    /*
    155174     *  Skip window overflow, underflow, and flush as well as software
    156      *  trap 0 which we will use as a shutdown.
     175     *  trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
     176     *  which cannot happen and where some of the space is used to pass
     177     *  paramaters to the program.
    157178     */
    158179
    159     if ( trap == 5 || trap == 6 || trap == 0x83 || trap == 0x80)
     180    if (( trap == 5 || trap == 6 || trap == 0x83 ) ||
     181        (( trap >= 0x70 ) && ( trap <= 0x80 )))
    160182      continue;
    161183
    162184    set_vector( bsp_spurious_handler, SPARC_SYNCHRONOUS_TRAP( trap ), 1 );
    163185  }
     186
     187  ERC32_MEC.Interrupt_Mask = mask;
     188  sparc_enable_interrupts(level);
     189
    164190}
  • cpukit/score/cpu/sparc/cpu_asm.S

    rb33d8a2 rba2adf5  
    337337        be,a    win_ovflow            ! No, then skip the adjustment
    338338        nop                           ! DELAY
     339        mov     %l1, %l6              ! save trapped pc for debug info
    339340        mov     %l2, %l1              ! do not return to the instruction
    340341        add     %l2, 4, %l2           ! indicated
     
    442443        rd      %y, %g1
    443444        st      %g1, [%sp + ISF_Y_OFFSET]      ! save y
     445        st      %l6, [%sp + ISF_TPC_OFFSET]    ! save real trapped pc
    444446
    445447        mov     %sp, %o1                       ! 2nd arg to ISR Handler
Note: See TracChangeset for help on using the changeset viewer.