summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-03-30 14:01:19 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-03-30 14:01:19 +0000
commit8f95b5f67b59eef4aa392b6be72f59af720d9ea2 (patch)
treeaf9b523e50efac2535bb4adc90d162f84ec78284 /c
parentRenamed crt0.o to crt0_go32.o to avoid build problems. (diff)
downloadrtems-8f95b5f67b59eef4aa392b6be72f59af720d9ea2.tar.bz2
Moved bsp_postdriver_hook() to a shared file and made it a common
component.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/a29k/portsw/startup/bspstart.c33
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/i386/force386/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/i386/go32/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/i386/go32/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/bspstart.c37
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/i960/cvme961/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/m68k/efi332/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/efi332/startup/bspstart.c30
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/m68k/idp/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/idp/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/mips/p4000/startup/bspstart.c30
-rw-r--r--c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c30
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c28
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c29
-rw-r--r--c/src/lib/libbsp/sh/gensh1/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/sh/gensh1/startup/bspstart.c30
-rw-r--r--c/src/lib/libbsp/shared/bsppost.c37
-rw-r--r--c/src/lib/libbsp/sparc/erc32/startup/Makefile.in2
-rw-r--r--c/src/lib/libbsp/sparc/erc32/startup/bspstart.c31
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/bspstart.c26
47 files changed, 118 insertions, 666 deletions
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in b/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in
index 386585747c..2635132eee 100644
--- a/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in
+++ b/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec iface
+C_PIECES=bspclean bsppost bspstart main sbrk setvec iface
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c b/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c
index 04db3b2545..1952a79ac7 100644
--- a/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c
+++ b/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -137,38 +136,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-
- printf("allocated %d heap size, %d work space size\n",
- heap_size, BSP_Configuration.work_space_size);
- printf(" work space start 0x%x\n",(unsigned int)BSP_Configuration.work_space_start);
-}
-
+void bsp_postdriver_hook(void);
int bsp_start(
int argc,
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in b/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in
index 894abe0d42..05f8abd940 100644
--- a/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
index ecb7a69d48..dbcbecd1d2 100644
--- a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
+++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
@@ -29,7 +29,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -229,33 +228,10 @@ bsp_pretasking_hook(void)
}
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
/*
* Function: bsp_start
diff --git a/c/src/lib/libbsp/i386/force386/startup/Makefile.in b/c/src/lib/libbsp/i386/force386/startup/Makefile.in
index 4bf71c8ce3..3da58a3ab9 100644
--- a/c/src/lib/libbsp/i386/force386/startup/Makefile.in
+++ b/c/src/lib/libbsp/i386/force386/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/i386/force386/startup/bspstart.c b/c/src/lib/libbsp/i386/force386/startup/bspstart.c
index 18e4fc88aa..9e6b151593 100644
--- a/c/src/lib/libbsp/i386/force386/startup/bspstart.c
+++ b/c/src/lib/libbsp/i386/force386/startup/bspstart.c
@@ -25,8 +25,6 @@
#include <libcsupport.h>
-#include <fcntl.h>
-
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
#endif
@@ -111,33 +109,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/i386/go32/startup/Makefile.in b/c/src/lib/libbsp/i386/go32/startup/Makefile.in
index a974a158f5..86a047cec5 100644
--- a/c/src/lib/libbsp/i386/go32/startup/Makefile.in
+++ b/c/src/lib/libbsp/i386/go32/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspstart sbrk setvec
+C_PIECES=bsppost bspstart sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/i386/go32/startup/bspstart.c b/c/src/lib/libbsp/i386/go32/startup/bspstart.c
index 6f9521a807..3e1498b426 100644
--- a/c/src/lib/libbsp/i386/go32/startup/bspstart.c
+++ b/c/src/lib/libbsp/i386/go32/startup/bspstart.c
@@ -27,7 +27,6 @@
#include <zilog/z8036.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -118,33 +117,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
/* This is the original command line passed from DOS */
char ** Go32_Argv;
diff --git a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in
index 957411a4fb..cf3371536c 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in
+++ b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart exit irq main sbrk
+C_PIECES=bspclean bsppost bspstart exit irq main sbrk
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
index 8b670357c1..b6035400db 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
+++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c
@@ -34,8 +34,6 @@
+--------------------------------------------------------------------------*/
-#include <fcntl.h>
-
#include <bsp.h>
#include <libcsupport.h>
#include <rtems/libio.h>
@@ -136,38 +134,11 @@ bsp_pretasking_hook(void)
} /* bsp_pretasking_hook */
-/*-------------------------------------------------------------------------+
-| Function: bsp_postdriver_hook
-| Description: After drivers are setup, register some "filenames" and open
-| stdin, stdout, stderr files. Newlib will automatically
-| associate the files with these (it hardcodes the numbers).
-| Global Variables: None.
-| Arguments: None.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
-
- rtems_status_code error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- /* open standard devices: stdout, stderr and stdin */
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) < 0)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) < 0)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) < 1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+/*
+ * Use the shared bsp_postdriver_hook() implementation
+ */
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-} /* bsp_postdriver_hook */
+void bsp_postdriver_hook(void);
/*-------------------------------------------------------------------------+
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in b/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in
index 301eb2f6c6..d4552cdf00 100644
--- a/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in
+++ b/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
index f38f9e5b68..6393321d23 100644
--- a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
+++ b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -113,33 +112,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in b/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in
index 4e05da9431..c8cbc6c78d 100644
--- a/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec vmeintr
+C_PIECES=bspclean bsppost bspstart main sbrk setvec vmeintr
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
index be1edde6fe..a63187cf78 100644
--- a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -111,33 +110,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in b/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in
index 6dd881b30c..d28b19db1f 100644
--- a/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspstart bspclean main sbrk setvec
+C_PIECES=bsppost bspstart bspclean main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c
index b20bdd5ff1..6a2e6604eb 100644
--- a/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c
@@ -25,7 +25,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -119,34 +118,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
-
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
void *vbr;
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in b/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in
index 0316a43525..13e0a5ae50 100644
--- a/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspstart bspclean efi68k_tcp efi68k_wd main sbrk setvec
+C_PIECES=bsppost bspstart bspclean efi68k_tcp efi68k_wd main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
index 339c809e4f..4c7431efb6 100644
--- a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
@@ -25,7 +25,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -124,33 +123,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in b/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in
index d131f4a2ab..bc3a786ed5 100644
--- a/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
index 6f42beb938..f301a99297 100644
--- a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -119,33 +118,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in b/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in
index 4500ca87f4..dafab347c9 100644
--- a/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=alloc360 bspclean bspstart init68360 main sbrk setvec
+C_PIECES=alloc360 bspclean bsppost bspstart init68360 main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c
index 6593087194..7c58cd9254 100644
--- a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -115,33 +114,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/idp/startup/Makefile.in b/c/src/lib/libbsp/m68k/idp/startup/Makefile.in
index ee58600cd3..709d28ab27 100644
--- a/c/src/lib/libbsp/m68k/idp/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/idp/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c
index 2e226eb2b1..bf66f8f6ba 100644
--- a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -120,33 +119,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in
index 60cbb0ecc6..12fca968bc 100644
--- a/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
index 6c923e6073..f551c78c2e 100644
--- a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
@@ -27,7 +27,6 @@
#include <zilog/z8036.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -111,35 +110,11 @@ bsp_pretasking_hook(void)
#endif
}
-
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in
index 60cbb0ecc6..12fca968bc 100644
--- a/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c
index 842bf0bbac..d86155db99 100644
--- a/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c
@@ -30,7 +30,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -116,33 +115,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in
index 0ccf177a4c..f5cc3ccace 100644
--- a/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c
index 67ef0c9c94..d50a63910a 100644
--- a/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c
@@ -30,7 +30,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -116,33 +115,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in
index b1d452bf89..181b4e11b7 100644
--- a/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main page_table sbrk setvec
+C_PIECES=bspclean bsppost bspstart main page_table sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
index b9430c9f30..5ed4265c44 100644
--- a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
@@ -34,7 +34,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -120,33 +119,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in b/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in
index 4e4b8bcc32..b93dbf526d 100644
--- a/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in
+++ b/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in
@@ -12,7 +12,7 @@ PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
C_PIECES=crc debugport gdb-hooks main m68302scc m68k-stub memcheck trace \
- bspstart bspclean sbrk setvec
+ bsppost bspstart bspclean sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c b/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c
index 09b8494e05..2448109128 100644
--- a/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -120,33 +119,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/mips/p4000/startup/bspstart.c b/c/src/lib/libbsp/mips/p4000/startup/bspstart.c
index 506bfcbc28..7184d9f931 100644
--- a/c/src/lib/libbsp/mips/p4000/startup/bspstart.c
+++ b/c/src/lib/libbsp/mips/p4000/startup/bspstart.c
@@ -34,7 +34,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -128,36 +127,11 @@ bsp_pretasking_hook(void)
#endif
}
-
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
-
+void bsp_postdriver_hook(void);
extern int end; /* defined by linker */
diff --git a/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in b/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in
index f7bcfe9d6e..31dd61d319 100644
--- a/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in
+++ b/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec inittlb
+C_PIECES=bspclean bsppost bspstart main sbrk setvec inittlb
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c b/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c
index 506bfcbc28..7184d9f931 100644
--- a/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c
+++ b/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c
@@ -34,7 +34,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -128,36 +127,11 @@ bsp_pretasking_hook(void)
#endif
}
-
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
-
+void bsp_postdriver_hook(void);
extern int end; /* defined by linker */
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in b/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in
index ff3daab211..446b287d3a 100644
--- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
index 381c8ab5f9..c03382bed2 100644
--- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
@@ -26,7 +26,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -120,33 +119,10 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
int bsp_start(
int argc,
diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in b/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in
index 301eb2f6c6..d4552cdf00 100644
--- a/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in
+++ b/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec
+C_PIECES=bspclean bsppost bspstart main sbrk setvec
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
index 98e6d9e470..5d0c4a64f2 100644
--- a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
@@ -43,7 +43,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -138,33 +137,11 @@ bsp_pretasking_hook(void)
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start( void )
{
diff --git a/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in b/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in
index d162cbdc92..bf265a742e 100644
--- a/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in
+++ b/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspstart bspclean sbrk setvec main
+C_PIECES=bsppost bspstart bspclean sbrk setvec main
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c b/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c
index 93bb88855e..585e572aa3 100644
--- a/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c
+++ b/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c
@@ -36,7 +36,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -120,36 +119,13 @@ bsp_pretasking_hook(void)
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
#endif
}
-
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
void bsp_start(void)
{
diff --git a/c/src/lib/libbsp/shared/bsppost.c b/c/src/lib/libbsp/shared/bsppost.c
new file mode 100644
index 0000000000..d3d14786ce
--- /dev/null
+++ b/c/src/lib/libbsp/shared/bsppost.c
@@ -0,0 +1,37 @@
+/*
+ * This is a basic BSP post driver hook.
+ *
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <rtems/libio.h>
+#include <fcntl.h>
+
+void
+bsp_postdriver_hook(void)
+{
+ int stdin_fd, stdout_fd, stderr_fd;
+ int error_code;
+
+ error_code = 'S' << 24 | 'T' << 16;
+
+ if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
+
+ if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
+
+ if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
+}
+
diff --git a/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in b/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in
index 5ca451dc25..bf4fcf17f4 100644
--- a/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in
+++ b/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in
@@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@
PGM=${ARCH}/startup.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=bspclean bspstart main sbrk setvec spurious
+C_PIECES=bspclean bsppost bspstart main sbrk setvec spurious
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c b/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
index 5ad902ced2..e05b6037f8 100644
--- a/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c
@@ -31,7 +31,6 @@
#include <libcsupport.h>
#include <string.h>
-#include <fcntl.h>
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
@@ -204,35 +203,11 @@ void bsp_pretasking_hook(void)
}
/*
- * bsp_postdriver_hook
- *
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * Use the shared bsp_postdriver_hook() implementation
*/
-void
-bsp_postdriver_hook(void)
-{
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-}
+void bsp_postdriver_hook(void);
+
/*
* bsp_start
diff --git a/c/src/lib/libbsp/unix/posix/startup/bspstart.c b/c/src/lib/libbsp/unix/posix/startup/bspstart.c
index c4d3a7937b..be3f9373fb 100644
--- a/c/src/lib/libbsp/unix/posix/startup/bspstart.c
+++ b/c/src/lib/libbsp/unix/posix/startup/bspstart.c
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <fcntl.h>
/* for sbrk prototype in linux */
#if defined(__linux__)
@@ -176,34 +175,13 @@ bsp_pretasking_hook(void)
}
/*
- * After drivers are setup, register some "filenames"
- * and open stdin, stdout, stderr files
- *
- * Newlib will automatically associate the files with these
- * (it hardcodes the numbers)
+ * DO NOT Use the shared bsp_postdriver_hook() implementation
*/
void
bsp_postdriver_hook(void)
{
-#if 0
- int stdin_fd, stdout_fd, stderr_fd;
- int error_code;
-
- error_code = 'S' << 24 | 'T' << 16;
-
- if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
-
- if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
-
- if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
- rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
-
- if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
- rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
-#endif
+ return;
}
/*