Ignore:
Timestamp:
Nov 13, 2000, 10:29:14 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
3eec211
Parents:
7f5213d
Message:

2000-11-13 Jiri Gaisler <jgais@…>

  • Makefile.am, configure.in, gnatsupp/Makefile.am, gnatsupp/gnatsupp.c, include/Makefile.am, include/bsp.h, start/Makefile.am, startup/Makefile.am, startup/setvec.c, wrapup/Makefile.am:
  • erc32sonic: New directory.
  • erc32sonic/Makefile.am, erc32sonic/erc32sonic.c, erc32sonic/.cvsignore: New files.
  • include/erc32.h: New file.
  • startup/boardinit.S: New file. Big update of SPARC support for ERC32 and LEON. Added support for ERC32 without floating point. Added SONIC support as configured on Tharsys ERC32 board. The bsp's share various code in the shared directory:

gnat-support, start-up code, etc.

To decrease the foot-print, I removed the 16 kbyte start-up
stack that was put in .bss and never reused once the system
was up. The stack is now put between the heap and the
workspace. To reclaim it, the user can do a rtems_region_extend
to merge the stack to the heap region once the system is up.

File:
1 edited

Legend:

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

    r7f5213d r2700423  
    66 */
    77
    8 #include <bsp.h>
    9 #include <signal.h>
    10 
    11 /*
    12  * Synchronous trap handler. Map the trap number of SIGFPE, SIGSEGV
    13  * or SIGILL to generate the corresponding Ada exception.
    14  */
    15 
    16 rtems_isr __gnat_exception_handler
    17   (rtems_vector_number trap)
    18 {
    19   rtems_unsigned32 real_trap;
    20   rtems_unsigned32 signal;
    21 
    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;
    37     }
    38   kill (getpid (), signal);
    39 }
    40 
    41 /*
    42  * Asynchronous trap handler. As it happens, the interrupt trap numbers for
    43  * SPARC is 17 - 31, so we just map then directly on the same signal number.
    44  */
    45 
    46 rtems_isr __gnat_interrupt_handler
    47   (rtems_vector_number trap)
    48 {
    49   rtems_unsigned32 real_trap;
    50 
    51   real_trap = SPARC_REAL_TRAP_NUMBER (trap);
    52 
    53   kill (getpid (), real_trap);
    54 
    55 }
    56 
    57 /*
    58  * Default signal handler with error reporting
    59  */
    60 
    61 void
    62 __gnat_signals_Abormal_termination_handler (int signo)
    63 {
    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);
    77 }
    78 
    79 const struct sigaction __gnat_error_vector =
    80 {0, -1,
    81  {__gnat_signals_Abormal_termination_handler}};
    82 
    838void
    849__gnat_install_handler ()
    8510{
    86   rtems_unsigned32 trap;
    87   rtems_isr_entry previous_isr;
    88 
    89   sigaction (SIGSEGV, &__gnat_error_vector, NULL);
    90   sigaction (SIGFPE, &__gnat_error_vector, NULL);
    91   sigaction (SIGILL, &__gnat_error_vector, NULL);
    92 
    93   for (trap = 0; trap < 256; trap++)
    94     {
    95 
    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        */
    105 
    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);
    113     }
     11  __gnat_install_handler_common (0x1d, 0x15);
    11412}
Note: See TracChangeset for help on using the changeset viewer.