summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/erc32/gnatsupp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-11-13 22:29:14 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-11-13 22:29:14 +0000
commit270042352bb97ab71be15205deded8fe44199b1e (patch)
tree9cfb92bb21d0f38bc102206a06a593c804614c9a /c/src/lib/libbsp/sparc/erc32/gnatsupp
parent2000-11-13 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-270042352bb97ab71be15205deded8fe44199b1e.tar.bz2
2000-11-13 Jiri Gaisler <jgais@ws.estec.esa.nl>
* 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.
Diffstat (limited to 'c/src/lib/libbsp/sparc/erc32/gnatsupp')
-rw-r--r--c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.am6
-rw-r--r--c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c104
2 files changed, 4 insertions, 106 deletions
diff --git a/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.am b/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.am
index 8e85f92a95..bcd362746c 100644
--- a/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.am
+++ b/c/src/lib/libbsp/sparc/erc32/gnatsupp/Makefile.am
@@ -4,11 +4,11 @@
AUTOMAKE_OPTIONS = foreign 1.4
-VPATH = @srcdir@:@srcdir@/../../../shared
+VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared
PGM = $(ARCH)/gnatsupp.rel
-C_FILES = gnatsupp.c
+C_FILES = gnatsupp.c gnatcommon.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
@@ -28,6 +28,6 @@ all-local: $(ARCH) $(OBJS) $(PGM)
.PRECIOUS: $(PGM)
-EXTRA_DIST = gnatsupp.c
+EXTRA_DIST = gnatsupp.c gnatcommon.c
include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c b/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c
index 1280ed9b16..49dbef7af0 100644
--- a/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c
+++ b/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c
@@ -5,110 +5,8 @@
*
*/
-#include <bsp.h>
-#include <signal.h>
-
-/*
- * Synchronous trap handler. Map the trap number of SIGFPE, SIGSEGV
- * or SIGILL to generate the corresponding Ada exception.
- */
-
-rtems_isr __gnat_exception_handler
- (rtems_vector_number trap)
-{
- rtems_unsigned32 real_trap;
- rtems_unsigned32 signal;
-
- real_trap = SPARC_REAL_TRAP_NUMBER (trap);
- switch (real_trap)
- {
- case 0x08: /* FPU exception */
- case 0x0A: /* TAG overflow */
- case 0x82: /* divide by zero */
- signal = SIGFPE; /* Will cause Constraint_Error */
- break;
- case 0x01: /* Instruction access exception */
- case 0x09: /* Data access exception */
- signal = SIGSEGV; /* Will cause Storage_Error */
- break;
- default: /* Anything else ... */
- signal = SIGILL; /* Will cause Program_Error */
- break;
- }
- kill (getpid (), signal);
-}
-
-/*
- * Asynchronous trap handler. As it happens, the interrupt trap numbers for
- * SPARC is 17 - 31, so we just map then directly on the same signal number.
- */
-
-rtems_isr __gnat_interrupt_handler
- (rtems_vector_number trap)
-{
- rtems_unsigned32 real_trap;
-
- real_trap = SPARC_REAL_TRAP_NUMBER (trap);
-
- kill (getpid (), real_trap);
-
-}
-
-/*
- * Default signal handler with error reporting
- */
-
-void
-__gnat_signals_Abormal_termination_handler (int signo)
-{
- switch (signo)
- {
- case SIGFPE:
- DEBUG_puts ("\nConstraint_Error\n");
- break;
- case SIGSEGV:
- DEBUG_puts ("\nStorage_Error\n");
- break;
- default:
- DEBUG_puts ("\nProgram_Error\n");
- break;
- }
- exit (1);
-}
-
-const struct sigaction __gnat_error_vector =
-{0, -1,
- {__gnat_signals_Abormal_termination_handler}};
-
void
__gnat_install_handler ()
{
- rtems_unsigned32 trap;
- rtems_isr_entry previous_isr;
-
- sigaction (SIGSEGV, &__gnat_error_vector, NULL);
- sigaction (SIGFPE, &__gnat_error_vector, NULL);
- sigaction (SIGILL, &__gnat_error_vector, NULL);
-
- for (trap = 0; trap < 256; trap++)
- {
-
- /*
- * Skip window overflow, underflow, and flush as well as software
- * trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
- * which cannot happen and where some of the space is used to pass
- * paramaters to the program. Trap 0x1d is used by the clock tick,
- * 0x80 for system traps and 0x81 - 0x83 by the remote debugging stub.
- * Avoid 0x15 (UART B interrupt) which is also used by the stub
- * to generate a 'break-in' interrupt.
- */
-
- if ((trap >= 0x11) && (trap <= 0x1f))
- {
- if ((trap != 0x1d) && (trap != 0x15))
- rtems_interrupt_catch (__gnat_interrupt_handler, trap, &previous_isr);
- }
- else if ((trap != 5 && trap != 6) && ((trap < 0x70) || (trap > 0x83)))
- set_vector (__gnat_exception_handler, SPARC_SYNCHRONOUS_TRAP (trap), 1);
- }
+ __gnat_install_handler_common (0x1d, 0x15);
}