Index: c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h
===================================================================
--- c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -110,6 +110,4 @@
 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
 
-extern rtems_unsigned32          bsp_isr_level;
-
 extern int cpu_number;         /* from 0; cpu number in a multi cpu system */
 
Index: c/src/lib/libbsp/hppa1.1/simhppa/start/start.s
===================================================================
--- c/src/lib/libbsp/hppa1.1/simhppa/start/start.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/hppa1.1/simhppa/start/start.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -21,5 +21,5 @@
  * stuff we need that is defined elsewhere.
  */
-	.IMPORT main, CODE
+	.IMPORT boot_card, CODE
 	.IMPORT _bss_start, DATA
 	.IMPORT _bss_end, DATA
@@ -76,6 +76,6 @@
 
 /*
- * Call the "main" routine from the application to get it going.
- * We call it as main(1, argv, 0)
+ * Call the "boot_card" routine from the application to get it going.
+ * We call it as boot_card(1, argv, 0)
  */
 
@@ -85,5 +85,5 @@
         ldo 	R%_crt0_argv(%r25),%r25
 
-	bl	main,%r2
+	bl	boot_card,%r2
         ldo     1(%r0), %r26
 
Index: c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,11 +12,7 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
-
-CC_PIECES=rtems-ctor
-CC_FILES=$(CC_PIECES:%=%.cc)
-CC_O_FILES=$(CC_PIECES:%=${ARCH}/%.o)
 
 H_FILES=
@@ -24,8 +20,4 @@
 SRCS=$(C_FILES) $(H_FILES)
 OBJS=$(C_O_FILES)
-
-# We install the RTEMS constructor as a separate .o
-# so it can be easily place correctly by the compiler config file.
-INSTALLED_O_FILES=$(ARCH)/rtems-ctor.o
 
 include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
@@ -57,6 +49,5 @@
 	$(make-rel)
 
-all:	${ARCH} $(SRCS) $(INSTALLED_O_FILES) $(PGM)
-	$(INSTALL_VARIANT) $(INSTALLED_O_FILES) ${PROJECT_RELEASE}/lib
+all:	${ARCH} $(SRCS) $(PGM)
 
 # the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
Index: c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -40,5 +40,4 @@
 rtems_configuration_table BSP_Configuration;
 rtems_cpu_table           Cpu_table;
-rtems_unsigned32          bsp_isr_level;
 
 int cpu_number;
@@ -285,7 +284,5 @@
  */
 
-
-void
-bsp_start(void)
+void bsp_start(void)
 {
     /*
@@ -427,13 +424,3 @@
     if (CPU_HPPA_CLICKS_PER_TICK == 0)
         CPU_HPPA_CLICKS_PER_TICK = 0x4000;
-
-    /*
-     *  Start most of RTEMS
-     *  main() will start the rest
-     */
-
-    bsp_isr_level = rtems_initialize_executive_early(
-      &BSP_Configuration,
-      &Cpu_table
-    );
 }
Index: c/src/lib/libbsp/i386/force386/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/i386/force386/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/force386/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/i386/force386/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i386/force386/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/force386/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -140,15 +140,6 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
-{
- 
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
+void bsp_start( void )
+{
  
   /*
@@ -218,8 +209,3 @@
 
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-  /* no cleanup necessary for Force CPU-386 */
-  return 0;
-}
+}
Index: c/src/lib/libbsp/i386/i386ex/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/i386/i386ex/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/i386ex/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,6 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-# C_PIECES=bspstart sbrk setvec except i386-stub
-C_PIECES=bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/i386/i386ex/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i386/i386ex/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/i386ex/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -142,9 +142,5 @@
 
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
 
@@ -155,9 +151,4 @@
   outbyte ('S');
 #endif
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   /*
@@ -223,7 +214,3 @@
 #endif
 
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-  /* no cleanup necessary for i386ex */
-  for (;;);  /* was return 0 to go to the debug monitor */
-}
+}
Index: c/src/lib/libbsp/i386/pc386/start/start.s
===================================================================
--- c/src/lib/libbsp/i386/pc386/start/start.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/pc386/start/start.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -67,5 +67,5 @@
 	PUBLIC (start)		# GNU default entry point
 
-	EXTERN (main)
+	EXTERN (boot_card)
 	EXTERN (load_segments)
 	EXTERN (exit)
@@ -281,5 +281,5 @@
 	pushl	$0			# argv
         pushl	$0			# argc
-	call	SYM (main)
+	call	SYM (boot_card)
 	addl	$12, esp
 
Index: c/src/lib/libbsp/i386/pc386/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/i386/pc386/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/pc386/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart exit irq sbrk 
+C_PIECES=bspclean bspstart exit irq main sbrk 
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/i386/pc386/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i386/pc386/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i386/pc386/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -172,18 +172,13 @@
 
 /*-------------------------------------------------------------------------+
-|         Function: main
-|      Description: Called from bsp's startup code ('start.s').
+|         Function: bsp_start
+|      Description: Called before main is invoked.
 | Global Variables: None.
 |        Arguments: None.
 |          Returns: Nothing. 
 +--------------------------------------------------------------------------*/
-int main(int argc, char **argv, char **environp)
+void bsp_start( void )
 {
   /* If we don't have command line arguments set default program name. */
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   Cpu_table.pretasking_hook         = bsp_pretasking_hook; /* init libc, etc. */
@@ -227,4 +222,5 @@
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
 
+#if 0
   rtems_initialize_executive(&BSP_Configuration, &Cpu_table);
   /* does not return */
@@ -241,3 +237,4 @@
 
   return 0;
-} /* main */
+#endif
+} /* bsp_start */
Index: c/src/lib/libbsp/i960/cvme961/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i960/cvme961/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i960/cvme961/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -115,6 +115,6 @@
 extern rtems_configuration_table BSP_Configuration;
 
-BSP_EXTERN i960ca_PRCB          *Prcb;
-BSP_EXTERN i960ca_control_table *Ctl_tbl;
+BSP_EXTERN i960ca_PRCB           *Prcb;
+BSP_EXTERN i960ca_control_table  *Ctl_tbl;
 
 /*
Index: c/src/lib/libbsp/i960/cvme961/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/i960/cvme961/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i960/cvme961/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i960/cvme961/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/i960/cvme961/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -142,15 +142,6 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
-{
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
+void bsp_start( void )
+{
   /* set node number in SQSIO4 CTL REG */
 
@@ -235,11 +226,3 @@
   BSP_Configuration.work_space_start = (void *)
      (RAM_END - BSP_Configuration.work_space_size);
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
-  bsp_cleanup();
-
-  return 0;
-
-}
+}
Index: c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart sbrk setvec vmeintr
+C_PIECES=bspclean bspstart main sbrk setvec vmeintr
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/dmv152/startup/bspclean.c
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/startup/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
+++ c/src/lib/libbsp/m68k/dmv152/startup/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -0,0 +1,21 @@
+/*
+ *  This routine performs final cleanup at exit time.
+ *
+ *  COPYRIGHT (c) 1989-1998.
+ *  On-Line Applications Research Corporation (OAR).
+ *  Copyright assigned to U.S. Government, 1994.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include <bsp.h>
+
+void bsp_cleanup( void )
+{
+
+   VME_interrupt_Disable( 0xff ); 
+}
Index: c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -140,9 +140,5 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   m68k_isr_entry *monitors_vector_table;
@@ -150,9 +146,4 @@
   void           *vbr;
 
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
   monitors_vector_table = (m68k_isr_entry *)0;   /* Monitor Vectors are at 0 */
   m68k_set_vbr( monitors_vector_table );
@@ -247,12 +238,4 @@
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
 
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
   /* Clock_exit is done as an atexit() function */
-
-  VME_interrupt_Disable( 0xff );
-
-  /* return like a "normal" subroutine to the monitor */
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/efi332/start/start.c
===================================================================
--- c/src/lib/libbsp/m68k/efi332/start/start.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi332/start/start.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,6 +12,4 @@
 char * const __argv[]= {"main", ""};
 char * const __env[]= {""};
-
-int main(const int argc, char * const argv[], char * const env[]);
 
 /*
@@ -183,5 +181,7 @@
    * Execute main with arguments argv and environment env
    */
-  main(1, __argv, __env);
+  /* main(1, __argv, __env); */
+
+  boot_card();
 
   reboot();
Index: c/src/lib/libbsp/m68k/efi332/start332/start332.c
===================================================================
--- c/src/lib/libbsp/m68k/efi332/start332/start332.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi332/start332/start332.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,6 +12,4 @@
 char * const __argv[]= {"main", ""};
 char * const __env[]= {""};
-
-int main(const int argc, char * const argv[], char * const env[]);
 
 /*
@@ -183,5 +181,7 @@
    * Execute main with arguments argv and environment env
    */
-  main(1, __argv, __env);
+  /* main(1, __argv, __env); */
+
+  boot_card();
 
   reboot();
Index: c/src/lib/libbsp/m68k/efi332/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/efi332/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi332/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart bspclean sbrk setvec
+C_PIECES=bspstart bspclean main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/efi332/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/efi332/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi332/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -148,9 +148,5 @@
 }
  
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   void           *vbr;
@@ -214,14 +210,5 @@
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
 
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
   /* Clock_exit is done as an atexit() function */
-
-  /* configure peripherals for safe exit */
-  bsp_cleanup();
-
-  /* return like a "normal" subroutine to the monitor */
-  return 0;
-}
-
+}
+
Index: c/src/lib/libbsp/m68k/efi68k/start/start.c
===================================================================
--- c/src/lib/libbsp/m68k/efi68k/start/start.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi68k/start/start.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -11,6 +11,4 @@
 char * const __argv[]= {"main", ""};
 char * const __env[]= {""};
-
-int main(const int argc, char * const argv[], char * const env[]);
 
 /*
@@ -66,5 +64,6 @@
    * Execute main with arguments argv and environment env
    */
-  main(1, __argv, __env);
+  /* main(1, __argv, __env); */
+  boot_card();
 
   reboot();
Index: c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c
===================================================================
--- c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -11,6 +11,4 @@
 char * const __argv[]= {"main", ""};
 char * const __env[]= {""};
-
-int main(const int argc, char * const argv[], char * const env[]);
 
 /*
@@ -66,5 +64,6 @@
    * Execute main with arguments argv and environment env
    */
-  main(1, __argv, __env);
+  /* main(1, __argv, __env); */
+  boot_card();
 
   reboot();
Index: c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart bspclean efi68k_tcp efi68k_wd sbrk setvec
+C_PIECES=bspstart bspclean efi68k_tcp efi68k_wd main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -153,9 +153,5 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   void           *vbr;
@@ -222,15 +218,5 @@
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
 
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
   /* Clock_exit is done as an atexit() function */
-
-/* exit: */
-  /* configure peripherals for safe exit */
-  bsp_cleanup();
-
-  /* return like a "normal" subroutine to the monitor */
-  return 0;
-}
-
+}
+
Index: c/src/lib/libbsp/m68k/gen68302/start/start302.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/start/start302.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68302/start/start302.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -217,5 +217,5 @@
 
       /*
-       *  RTEMS should maintiain a separate interrupt stack on CPUs
+       *  RTEMS should maintain a separate interrupt stack on CPUs
        *  without one in hardware.  This is currently not supported
        *  on versions of the m68k without a HW intr stack.
@@ -230,5 +230,5 @@
         move.l  #0,a7@-               | argv
         move.l  #0,a7@-               | argc
-        jsr     SYM (main)
+        jsr     SYM (boot_card)
 
 	nop
Index: c/src/lib/libbsp/m68k/gen68302/start302/start302.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/start302/start302.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68302/start302/start302.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -217,5 +217,5 @@
 
       /*
-       *  RTEMS should maintiain a separate interrupt stack on CPUs
+       *  RTEMS should maintain a separate interrupt stack on CPUs
        *  without one in hardware.  This is currently not supported
        *  on versions of the m68k without a HW intr stack.
@@ -230,5 +230,5 @@
         move.l  #0,a7@-               | argv
         move.l  #0,a7@-               | argc
-        jsr     SYM (main)
+        jsr     SYM (boot_card)
 
 	nop
Index: c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart bspclean sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -148,14 +148,6 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
-{
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
+void bsp_start( void )
+{
 
   /*
@@ -240,12 +232,3 @@
    */
 
-  /*
-   *  Start RTEMS
-   */
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/gen68360/start/start360.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/start/start360.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68360/start/start360.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -402,5 +402,5 @@
 	movel	d0,a7@-			| argv
 	movel	d0,a7@-			| argc
-	jsr	SYM(main)		| Call C main
+	jsr	SYM(boot_card)		| Call C main
 
 	PUBLIC (_mainDone)
Index: c/src/lib/libbsp/m68k/gen68360/start360/start360.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/start360/start360.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68360/start360/start360.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -402,5 +402,5 @@
 	movel	d0,a7@-			| argv
 	movel	d0,a7@-			| argc
-	jsr	SYM(main)		| Call C main
+	jsr	SYM(boot_card)		| Call C main
 
 	PUBLIC (_mainDone)
Index: c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=alloc360 bspstart bspclean init68360 memcpy sbrk setvec
+C_PIECES=alloc360 bspclean bspstart init68360 main memcpy sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -144,15 +144,7 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   extern void *_WorkspaceBase;
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   /*
@@ -235,13 +227,3 @@
    *  Don't forget the other CPU Table entries.
    */
-
-  /*
-   *  Start RTEMS
-   */
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/idp/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/idp/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/idp/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/idp/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/idp/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/idp/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -149,17 +149,8 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   m68k_isr_entry *monitors_vector_table;
   int             index;
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   duart_base = (unsigned char *)DUART_ADDR;
@@ -249,8 +240,5 @@
 
 /*  led_putnum('e'); * for debugging purposes only */
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */
- 
+
   /* Clock_exit is done as an atexit() function */
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -142,18 +142,8 @@
 }
 
-
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   m68k_isr_entry *monitors_vector_table;
   int             index;
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   monitors_vector_table = (m68k_isr_entry *)0;   /* 135Bug Vectors are at 0 */
@@ -230,10 +220,3 @@
 
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -145,18 +145,8 @@
 }
 
-
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   m68k_isr_entry *monitors_vector_table;
   int             index;
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   monitors_vector_table = (m68k_isr_entry *)0;   /* 135Bug Vectors are at 0 */
@@ -236,10 +226,3 @@
 
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart sbrk setvec
+C_PIECES=bspclean bspstart main sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -145,19 +145,9 @@
 }
 
-
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   m68k_isr_entry *monitors_vector_table;
   int             index;
   rtems_unsigned8 node_number;
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   monitors_vector_table = (m68k_isr_entry *)0;   /* 147Bug Vectors are at 0 */
@@ -296,10 +286,3 @@
 
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart page_table sbrk setvec
+C_PIECES=bspclean bspstart main page_table sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
Index: c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -149,17 +149,8 @@
 }
 
-int main(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start( void )
 {
   m68k_isr_entry *monitors_vector_table;
   int             index;
-
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
 
   /*
@@ -253,10 +244,3 @@
   BSP_Configuration.work_space_start = (void *)
      (RAM_END - BSP_Configuration.work_space_size);
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-  /* does not return */
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/m68k/ods68302/start/cpuboot.c
===================================================================
--- c/src/lib/libbsp/m68k/ods68302/start/cpuboot.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/ods68302/start/cpuboot.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -111,5 +111,5 @@
   */
 
-void boot_bsp();
+void boot_card();
 void set_debug_traps();
 void breakpoint();
@@ -128,5 +128,5 @@
   
   /* boot the bsp, what ever this means */
-  boot_bsp();
+  boot_card();
 
   WATCHDOG_TRIGGER();
Index: c/src/lib/libbsp/m68k/ods68302/start302/cpuboot.c
===================================================================
--- c/src/lib/libbsp/m68k/ods68302/start302/cpuboot.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/ods68302/start302/cpuboot.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -111,5 +111,5 @@
   */
 
-void boot_bsp();
+void boot_card();
 void set_debug_traps();
 void breakpoint();
@@ -128,5 +128,5 @@
   
   /* boot the bsp, what ever this means */
-  boot_bsp();
+  boot_card();
 
   WATCHDOG_TRIGGER();
Index: c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,5 +12,5 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=crc debugport gdb-hooks m68302scc m68k-stub memcheck trace \
+C_PIECES=crc debugport gdb-hooks main m68302scc m68k-stub memcheck trace \
 		bspstart bspclean sbrk setvec
 C_FILES=$(C_PIECES:%=%.c)
Index: c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -149,5 +149,5 @@
 }
 
-void bsp_start()
+void bsp_start( void )
 {
   /*
@@ -231,33 +231,3 @@
    *  Don't forget the other CPU Table entries.
    */
-
-  /*
-   *  Start RTEMS
-   */
-
-  bsp_isr_level = rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table );
-}
-
-int main(int argc, char **argv, char **environ)
-{
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
-  rtems_initialize_executive_late( bsp_isr_level );
-
-  bsp_cleanup();
-
-  return 0;
-}
-
-void boot_bsp()
-{
-  /* the atexit hook will be before the static destructor list's entry
-     point */
-  bsp_start();
-
-  exit(main(0, 0, 0));
-}
-
+}
Index: c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c
===================================================================
--- c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -111,5 +111,5 @@
   */
 
-void boot_bsp();
+void boot_card();
 void set_debug_traps();
 void breakpoint();
@@ -128,5 +128,5 @@
   
   /* boot the bsp, what ever this means */
-  boot_bsp();
+  boot_card();
 
   WATCHDOG_TRIGGER();
Index: c/src/lib/libbsp/mips/p4000/include/bsp.h
===================================================================
--- c/src/lib/libbsp/mips/p4000/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/mips/p4000/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -111,12 +111,4 @@
 /* miscellaneous stuff assumed to exist */
 
-int bsp_start(
-  int   argc,
-  char **argv,
-  char **environp
-);
-
-void bsp_cleanup( void );
-
 mips_isr_entry set_vector(                      /* returns old vector */
   rtems_isr_entry     handler,                  /* isr routine        */
Index: c/src/lib/libbsp/mips/p4000/startup/bspclean.c
===================================================================
--- c/src/lib/libbsp/mips/p4000/startup/bspclean.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/mips/p4000/startup/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -33,3 +33,4 @@
 void bsp_cleanup( void )
 {
+  idtsim__exit();
 }
Index: c/src/lib/libbsp/mips/p4000/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/mips/p4000/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/mips/p4000/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -162,15 +162,6 @@
 extern int end; /* defined by linker */
 
-int bsp_start(
-  int argc,
-  char **argv,
-  char **environp
-)
-{
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
+void bsp_start( void )
+{
   /*
    *  Allocate the memory for the RTEMS Work Space.  This can come from
@@ -257,12 +248,3 @@
    */
 
-  /*
-   *  Start RTEMS
-   */
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/mips64orion/p4000/include/bsp.h
===================================================================
--- c/src/lib/libbsp/mips64orion/p4000/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/mips64orion/p4000/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -111,12 +111,4 @@
 /* miscellaneous stuff assumed to exist */
 
-int bsp_start(
-  int   argc,
-  char **argv,
-  char **environp
-);
-
-void bsp_cleanup( void );
-
 mips_isr_entry set_vector(                      /* returns old vector */
   rtems_isr_entry     handler,                  /* isr routine        */
Index: c/src/lib/libbsp/mips64orion/p4000/startup/bspclean.c
===================================================================
--- c/src/lib/libbsp/mips64orion/p4000/startup/bspclean.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/mips64orion/p4000/startup/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -33,3 +33,4 @@
 void bsp_cleanup( void )
 {
+  idtsim__exit();
 }
Index: c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -162,15 +162,6 @@
 extern int end; /* defined by linker */
 
-int bsp_start(
-  int argc,
-  char **argv,
-  char **environp
-)
-{
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
+void bsp_start( void )
+{
   /*
    *  Allocate the memory for the RTEMS Work Space.  This can come from
@@ -257,12 +248,3 @@
    */
 
-  /*
-   *  Start RTEMS
-   */
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s
===================================================================
--- c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -224,6 +224,6 @@
 	stw	r3, 8(r1)
 	stw	r3, 12(r1)
-        .extern SYM (main)
-        b       SYM (main)          		 /* call the first C routine */
+        .extern SYM (boot_card)
+        b       SYM (boot_card) 	 /* call the first C routine */
 
 /*-------------------------------------------------------------------------------
Index: c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s
===================================================================
--- c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/powerpc/papyrus/flashentry/flashentry.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -246,6 +246,6 @@
 	stw	r3, 8(r1)
 	stw	r3, 12(r1)
-        .extern SYM (main)
-        b       SYM (main)            /* call the first C routine */
+        .extern SYM (boot_card)
+        b       SYM (boot_card) 	 /* call the first C routine */
 
 /*-------------------------------------------------------------------------------
Index: c/src/lib/libbsp/powerpc/papyrus/include/bsp.h
===================================================================
--- c/src/lib/libbsp/powerpc/papyrus/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/powerpc/papyrus/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -132,12 +132,4 @@
 /* functions */
 
-int bsp_start(
-  int   argc,
-  char **argv,
-  char **environp
-);
-
-void bsp_cleanup( void );
-
 rtems_isr_entry set_vector(                    /* returns old vector */
   rtems_isr_entry     handler,                  /* isr routine        */
Index: c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -167,15 +167,6 @@
 }
 
-int bsp_start(
-  int argc,
-  char **argv,
-  char **environp
-)
-{
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
+void bsp_start( void )
+{
   /*
    *  Allocate the memory for the RTEMS Work Space.  This can come from
@@ -266,11 +257,3 @@
 
   Cpu_table.timer_least_valid = 3;
-
-  /*
-   *  Start RTEMS
-   */
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-
-  bsp_cleanup();
-}
+}
Index: c/src/lib/libbsp/sh/gensh1/include/bsp.h
===================================================================
--- c/src/lib/libbsp/sh/gensh1/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sh/gensh1/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -85,6 +85,4 @@
 extern rtems_configuration_table BSP_Configuration;
 
-extern int bsp_start( int argc, char **argv, char **env );
-
 extern void bsp_cleanup( void );
 
Index: c/src/lib/libbsp/sh/gensh1/startup/bspclean.c
===================================================================
--- c/src/lib/libbsp/sh/gensh1/startup/bspclean.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sh/gensh1/startup/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -38,3 +38,4 @@
 void bsp_cleanup( void )
 {
+  rtems_fatal_error_occurred(0);
 }
Index: c/src/lib/libbsp/sh/gensh1/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/sh/gensh1/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sh/gensh1/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -152,9 +152,5 @@
 }
 
-int bsp_start(
-  int argc,
-  char **argv,
-  char **environp
-)
+void bsp_start(void)
 {
   /*
@@ -166,9 +162,4 @@
    */
    
-  if ((argc > 0) && argv && argv[0])
-    rtems_progname = argv[0];
-  else
-    rtems_progname = "RTEMS";
-
   /*
    *  Allocate the memory for the RTEMS Work Space.  This can come from
@@ -266,13 +257,3 @@
 
   rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
-
-  /*
-   *  Start RTEMS
-   */
-
-  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-
-  bsp_cleanup();
-
-  return 0;
-}
+}
Index: c/src/lib/libbsp/shared/bspclean.c
===================================================================
--- c/src/lib/libbsp/shared/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
+++ c/src/lib/libbsp/shared/bspclean.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -0,0 +1,17 @@
+/*
+ *  This is a dummy bsp_cleanup routine.
+ *
+ *  COPYRIGHT (c) 1989-1998.
+ *  On-Line Applications Research Corporation (OAR).
+ *  Copyright assigned to U.S. Government, 1994.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+void bsp_cleanup( void )
+{
+}
Index: c/src/lib/libbsp/shared/main.c
===================================================================
--- c/src/lib/libbsp/shared/main.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
+++ c/src/lib/libbsp/shared/main.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -0,0 +1,62 @@
+/*
+ *  A simple main which can be used on any embedded target.
+ *
+ *  This style of initialization insures that the C++ global 
+ *  constructors are executed after RTEMS is initialized.
+ *
+ *  Thanks to Chris Johns <cjohns@plessey.com.au> for this idea.
+ *
+ *  COPYRIGHT (c) 1989-1998.
+ *  On-Line Applications Research Corporation (OAR).
+ *  Copyright assigned to U.S. Government, 1994.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.OARcorp.com/rtems/license.html.
+ *
+ *  $Id$
+ */
+
+#include <bsp.h>
+
+char *rtems_progname;
+
+extern void bsp_start( void );
+extern void bsp_cleanup( void );
+
+extern rtems_configuration_table  BSP_Configuration;
+extern rtems_cpu_table            Cpu_table;
+
+rtems_interrupt_level bsp_isr_level;
+
+int main(int argc, char **argv, char **environ)
+{
+
+  if ((argc > 0) && argv && argv[0])
+    rtems_progname = argv[0];
+  else
+    rtems_progname = "RTEMS";
+
+  rtems_initialize_executive_late( bsp_isr_level );
+
+  return 0;
+}
+
+void boot_card(void)
+{
+  int status;
+
+  /* the atexit hook will be before the static destructor list's entry
+     point */
+  bsp_start();
+
+  bsp_isr_level =
+    rtems_initialize_executive_early( &BSP_Configuration, &Cpu_table );
+
+  status = main(0, 0, 0);
+
+  bsp_cleanup();  
+
+  exit( status );
+}
+
Index: c/src/lib/libbsp/sparc/erc32/include/bsp.h
===================================================================
--- c/src/lib/libbsp/sparc/erc32/include/bsp.h	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sparc/erc32/include/bsp.h	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -172,6 +172,4 @@
 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
 
-extern rtems_unsigned32          bsp_isr_level;
-
 #ifdef __cplusplus
 }
Index: c/src/lib/libbsp/sparc/erc32/start/startsis.s
===================================================================
--- c/src/lib/libbsp/sparc/erc32/start/startsis.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sparc/erc32/start/startsis.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -290,6 +290,6 @@
         mov     %0, %o1                 ! argv
         mov     %0, %o0                 ! argc
-        call    SYM(main)
-        sub     %sp, 0x60, %sp          ! room for main to save args
+        call    SYM(boot_card)
+        sub     %sp, 0x60, %sp          ! room for boot_card to save args
         nop
 
Index: c/src/lib/libbsp/sparc/erc32/startsis/startsis.s
===================================================================
--- c/src/lib/libbsp/sparc/erc32/startsis/startsis.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sparc/erc32/startsis/startsis.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -290,6 +290,6 @@
         mov     %0, %o1                 ! argv
         mov     %0, %o0                 ! argc
-        call    SYM(main)
-        sub     %sp, 0x60, %sp          ! room for main to save args
+        call    SYM(boot_card)
+        sub     %sp, 0x60, %sp          ! room for boot_card to save args
         nop
 
Index: c/src/lib/libbsp/sparc/erc32/startup/Makefile.in
===================================================================
--- c/src/lib/libbsp/sparc/erc32/startup/Makefile.in	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sparc/erc32/startup/Makefile.in	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -12,11 +12,7 @@
 
 # C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart sbrk setvec spurious
+C_PIECES=bspclean bspstart main sbrk setvec spurious
 C_FILES=$(C_PIECES:%=%.c)
 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
-
-CC_PIECES=rtems-ctor
-CC_FILES=$(CC_PIECES:%=%.cc)
-CC_O_FILES=$(CC_PIECES:%=${ARCH}/%.o)
 
 H_FILES=
@@ -29,8 +25,4 @@
 SRCS=linkcmds $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
 OBJS=$(C_O_FILES)
-
-# We install the RTEMS constructor as a separate .o
-# so it can be easily place correctly by the compiler config file.
-INSTALLED_O_FILES=$(ARCH)/rtems-ctor.o
 
 include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
@@ -62,5 +54,4 @@
 	$(make-rel)
 
-all:	${ARCH} $(SRCS) $(INSTALLED_O_FILES) $(PGM)
+all:	${ARCH} $(SRCS) $(PGM)
 	$(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
-	$(INSTALL_VARIANT) $(INSTALLED_O_FILES) ${PROJECT_RELEASE}/lib
Index: c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/sparc/erc32/startup/bspstart.c	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/libbsp/sparc/erc32/startup/bspstart.c	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -373,8 +373,3 @@
 
   rtems_libio_config( &BSP_Configuration, BSP_LIBIO_MAX_FDS );
- 
-  bsp_isr_level = rtems_initialize_executive_early(
-     &BSP_Configuration,
-     &Cpu_table
-  );
-}
+}
Index: c/src/lib/start/i960/start.s
===================================================================
--- c/src/lib/start/i960/start.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/start/i960/start.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -75,5 +75,5 @@
 
         /*
-         * Call application mainline.
+         * Call application boot_card.
          *      Someday, real values of argc and argv will be set up.
          *      For now, they are set to 0.
@@ -82,5 +82,5 @@
         ldconst 0,g1
         ldconst 0,g2
-        call    _main
+        call    _boot_card
         ret
 
Index: c/src/lib/start/m68k/start.s
===================================================================
--- c/src/lib/start/m68k/start.s	(revision 2b4aec86fceb8d61a2b30a82a2a2464e8c600d98)
+++ c/src/lib/start/m68k/start.s	(revision e2a2ec6016c9bb3f3146c701bbe950af212c097c)
@@ -88,5 +88,5 @@
 
       /*
-       *  RTEMS should maintiain a separate interrupt stack on CPUs
+       *  RTEMS should maintain a separate interrupt stack on CPUs
        *  without one in hardware.  This is currently not supported
        *  on versions of the m68k without a HW intr stack.
@@ -103,5 +103,5 @@
         movel   #0,a7@-               | push argc
 
-        jsr     SYM (main)
+        jsr     SYM (boot_card)
         addl    #12,a7
 
