Index: c/src/lib/include/console.h
===================================================================
--- c/src/lib/include/console.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/include/console.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -23,12 +23,41 @@
 
 #define CONSOLE_DRIVER_TABLE_ENTRY \
-  { console_initialize, NULL, NULL, NULL, NULL, NULL }
+  { console_initialize, console_open, console_close, \
+    console_read, console_write, console_control }
 
 rtems_device_driver console_initialize(
   rtems_device_major_number,
   rtems_device_minor_number,
-  void *,
-  rtems_id,
-  rtems_unsigned32 *
+  void *
+);
+
+rtems_device_driver console_open(
+  rtems_device_major_number,
+  rtems_device_minor_number,
+  void *
+);
+
+rtems_device_driver console_close(
+  rtems_device_major_number,
+  rtems_device_minor_number,
+  void *
+);
+
+rtems_device_driver console_read(
+  rtems_device_major_number,
+  rtems_device_minor_number,
+  void *
+);
+
+rtems_device_driver console_write(
+  rtems_device_major_number,
+  rtems_device_minor_number,
+  void *
+);
+
+rtems_device_driver console_control(
+  rtems_device_major_number,
+  rtems_device_minor_number,
+  void *
 );
 
Index: c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h
===================================================================
--- c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -68,16 +68,4 @@
 
 /*
- * Todo: this should be put somewhere else
- */
-
-#undef CLOCK_DRIVER_TABLE_ENTRY
-#define CLOCK_DRIVER_TABLE_ENTRY { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
-rtems_device_driver Clock_control(
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp
-);
-
-/*
  * We printf() to a buffer if multiprocessing, *or* if this is set.
  * ref: src/lib/libbsp/hppa/simhppa/iosupp/consupp.c
@@ -85,4 +73,8 @@
 
 extern int use_print_buffer;
+
+/*
+ *  Device Driver Table Entries
+ */
 
 /*
@@ -93,4 +85,8 @@
 #define CONSOLE_DRIVER_TABLE_ENTRY \
   { tty_initialize, tty_open, tty_close, tty_read, tty_write, tty_control }
+
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
 
 /*
Index: c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -132,5 +132,5 @@
 
     /*
-     * Init the RTEMS libio facility to provide UNIX-like system
+     *  Init the RTEMS libio facility to provide UNIX-like system
      *  calls for use by newlib (ie: provide __open, __close, etc)
      *  Uses malloc() to get area for the iops, so must be after malloc init
Index: c/src/lib/libbsp/i386/force386/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/i386/force386/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/force386/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -20,31 +20,42 @@
 
 #include <bsp.h>
-#include <clockdrv.h>
+
+#include <rtems/libio.h>
+
 #include <stdlib.h>
 
+#define CLOCK_VECTOR  0x38
+
+rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
+
 volatile rtems_unsigned32 Clock_driver_ticks;
-rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
+
 rtems_isr_entry  Old_ticker;
 
-rtems_device_driver Clock_initialize(
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
+void Clock_exit( void );
+ 
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_major_number rtems_clock_minor = 0;
+
+/*
+ *  This is the ISR handler.
+ */
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
 )
 {
-  Install_clock( Clock_isr );
-}
-
-void ReInstall_clock(
-  rtems_isr_entry clock_isr
-)
-{
-  rtems_unsigned32 isrlevel = 0;
-
-  rtems_interrupt_disable( isrlevel );
-   (void) set_vector( clock_isr, 0x38, 1 );
-  rtems_interrupt_enable( isrlevel );
+  /* enable_tracing(); */
+  Clock_driver_ticks += 1;
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+  }
+  else
+    Clock_isrs -= 1;
 }
 
@@ -57,5 +68,5 @@
 
   if ( BSP_Configuration.ticks_per_timeslice ) {
-    Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, 0x38, 1 );
+    Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 );
     outport_byte( TBCR, 0x14 );  /* reset it, delay mode, 50X */
     outport_byte( TBDR, 0x50 );  /* 1 millisecond */
@@ -63,4 +74,15 @@
   }
   atexit( Clock_exit );
+}
+
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_unsigned32 isrlevel = 0;
+
+  rtems_interrupt_disable( isrlevel );
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
 }
 
@@ -74,2 +96,48 @@
 }
 
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/i386/force386/console/console.c
===================================================================
--- c/src/lib/libbsp/i386/force386/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/force386/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -15,9 +15,8 @@
 #define F386_INIT
 
+#include <bsp.h>
+#include <rtems/libio.h>
+
 #include <stdlib.h>
-
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
 
 /*  console_cleanup
@@ -62,16 +61,27 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
-   /*
-    *  flush the console now and at exit.  Just in case.
-    */
-
-   console_cleanup();
-
-   atexit( console_cleanup );
+  void                      *arg
+)
+{
+  rtems_status_code status;
+
+  /*
+   *  flush the console now and at exit.  Just in case.
+   */
+
+  console_cleanup();
+
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+
+  atexit( console_cleanup );
+
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -173,47 +183,102 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+ 
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+ 
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+ 
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+ 
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+ 
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+ 
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
-  }
-  return (nbytes);
-}
+    outbyte( buffer[ count ] );
+  }
+  return maximum;
+}
+ 
+/*
+ *  IO Control entry point
+ */
+ 
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/i386/force386/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i386/force386/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/force386/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -23,4 +23,6 @@
 #include <rtems.h>
 #include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
 
 /*
@@ -129,4 +131,22 @@
 #endif
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* miscellaneous stuff assumed to exist */
 
Index: c/src/lib/libbsp/i386/force386/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i386/force386/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/force386/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,9 +21,14 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+
 #include <libcsupport.h>
 
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
 #include <stackchk.h>
+#endif
 
 /*
@@ -36,4 +41,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -51,4 +58,12 @@
 
     RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+    /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
 
     /*
@@ -71,5 +86,31 @@
 }
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -77,4 +118,10 @@
 )
 {
+ 
+  if ((argc > 0) && argv && argv[0])
+    rtems_progname = argv[0];
+  else
+    rtems_progname = "RTEMS";
+ 
   /*
    *  FORCE documentation incorrectly states that the bus request
@@ -93,5 +140,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -138,4 +185,10 @@
 #endif
 
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
   rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
   /* does not return */
Index: c/src/lib/libbsp/i386/go32/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/i386/go32/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/go32/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -12,113 +12,185 @@
 
 #include <bsp.h>
-#include <clockdrv.h>
+#include <rtems/libio.h>
+
 #include <stdlib.h>
 
 volatile rtems_unsigned32 Clock_driver_ticks;
-rtems_unsigned32 Clock_isrs_per_tick;		/* ISRs per tick */
-rtems_unsigned32 Clock_isrs;			/* ISRs until next tick */
+rtems_unsigned32 Clock_isrs_per_tick;  /* ISRs per tick */
+rtems_unsigned32 Clock_isrs;   /* ISRs until next tick */
 rtems_isr_entry  Old_ticker;
+
+#define CLOCK_VECTOR 0x8
+
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
+)
+{
+    /* touch interrupt controller for irq0 (0x20+0) */
+    outport_byte( 0x20, 0x20 );
+
+    Clock_driver_ticks += 1;
+
+#if 0 && defined(pentium)
+    {
+      extern long long Last_RDTSC;
+      __asm __volatile( ".byte 0x0F, 0x31" : "=A" (Last_RDTSC) );
+    }
+#endif
+
+    if ( Clock_isrs == 1 ) {
+      rtems_clock_tick();
+      Clock_isrs = Clock_isrs_per_tick;
+    } else {
+      Clock_isrs -= 1;
+    }
+}
+
+void Install_clock(
+  rtems_isr_entry clock_isr
+)
+{
+    unsigned int microseconds_per_isr;
+
+#if 0
+    /* Initialize clock from on-board real time clock.  This breaks the */
+    /* test code which assumes which assumes the application will do it. */
+    {
+       rtems_time_of_day Now;
+       extern void init_rtc( void );
+       extern long rtc_read( rtems_time_of_day * tod );
+       init_rtc();
+       if ( rtc_read( &Now ) >= 0 )
+         clock_set( &Now );
+       }
+#endif
+
+    /* Start by assuming hardware counter is large enough, then */
+    /* scale it until it actually fits.    */
+    Clock_driver_ticks = 0;
+    Clock_isrs_per_tick = 1;
+
+    if ( BSP_Configuration.microseconds_per_tick == 0 )
+       microseconds_per_isr = 10000; /* default 10 ms */
+    else
+       microseconds_per_isr = BSP_Configuration.microseconds_per_tick;
+    while ( US_TO_TICK(microseconds_per_isr) > 65535 )  {
+      Clock_isrs_per_tick  *= 10;
+      microseconds_per_isr /= 10;
+    }
+
+    /* Initialize count in ckisr.c */
+    Clock_isrs = Clock_isrs_per_tick;
+
+#if 0
+    /* This was dropped in the last revision.  Its a nice thing to know. */
+    TICKS_PER_SECOND = 1000000 / (Clock_isrs_per_tick * microseconds_per_isr);
+#endif
+
+    if ( BSP_Configuration.ticks_per_timeslice )  {
+      /* 105/88 approximates TIMER_TICK*1e-6 */
+      unsigned int count = US_TO_TICK( microseconds_per_isr );
+
+      Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+      outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+      outport_byte( TIMER_CNTR0, count >> 0 & 0xff );
+      outport_byte( TIMER_CNTR0, count >> 8 & 0xff );
+    } 
+    atexit( Clock_exit );
+}
+
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_unsigned32 isrlevel = 0;
+
+  rtems_interrupt_disable( isrlevel );
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
+}
+
+void Clock_exit( void )
+{
+  if ( BSP_Configuration.ticks_per_timeslice ) {
+ extern void rtc_set_dos_date( void );
+
+ /* reset to DOS value: */
+ outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+ outport_byte( TIMER_CNTR0, 0 );
+ outport_byte( TIMER_CNTR0, 0 );
+
+ /* reset time-of-day */
+ rtc_set_dos_date();
+ 
+ /* re-enable old handler: assume it was one of ours */
+ set_vector( (rtems_isr_entry)Old_ticker, CLOCK_VECTOR, 1 );
+  }
+}
 
 rtems_device_driver Clock_initialize(
   rtems_device_major_number major,
   rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
+  void *pargp
 )
 {
   Install_clock( Clock_isr );
-}
-
-void ReInstall_clock(
-  rtems_isr_entry clock_isr
-)
-{
-  rtems_unsigned32 isrlevel = 0;
-
-  rtems_interrupt_disable( isrlevel );
-   (void) set_vector( clock_isr, 0x8, 1 );
-  rtems_interrupt_enable( isrlevel );
-}
-
-void Install_clock(
-  rtems_isr_entry clock_isr
-)
-{
-    unsigned int	microseconds_per_isr;
-
-#if 0
-    /* Initialize clock from on-board real time clock.  This breaks the	*/
-    /* test code which assumes which assumes the application will do it. */
-    {
-	rtems_time_of_day Now;
-	extern void init_rtc( void );
-	extern long rtc_read( rtems_time_of_day * tod );
-	init_rtc();
-	if ( rtc_read( &Now ) >= 0 )
-	    clock_set( &Now );
-    }
-#endif
-
-    /* Start by assuming hardware counter is large enough, then	*/
-    /* scale it until it actually fits.				*/
-    Clock_driver_ticks = 0;
-    Clock_isrs_per_tick = 1;
-
-    if ( BSP_Configuration.microseconds_per_tick == 0 )
-	microseconds_per_isr = 10000;	/* default 10 ms */
-    else
-	microseconds_per_isr = BSP_Configuration.microseconds_per_tick;
-    while ( US_TO_TICK(microseconds_per_isr) > 65535 )  {
-	Clock_isrs_per_tick  *= 10;
-	microseconds_per_isr /= 10;
-    }
-
-    /* Initialize count in ckisr.c */
-    Clock_isrs = Clock_isrs_per_tick;
-
-#if 0
-    /* This was dropped in the last revision.  Its a nice thing to know. */
-    TICKS_PER_SECOND = 1000000 / (Clock_isrs_per_tick * microseconds_per_isr);
-#endif
-
-    if ( BSP_Configuration.ticks_per_timeslice )  {
-	/* 105/88 approximates TIMER_TICK*1e-6 */
-	unsigned int count = US_TO_TICK( microseconds_per_isr );
-
-	Old_ticker = (rtems_isr_entry) set_vector( clock_isr, 0x8, 1 );
-	outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
-	outport_byte( TIMER_CNTR0, count >> 0 & 0xff );
-	outport_byte( TIMER_CNTR0, count >> 8 & 0xff );
-    } 
-    atexit( Clock_exit );
-}
-
-void Clock_exit( void )
-{
-  if ( BSP_Configuration.ticks_per_timeslice ) {
-	extern void rtc_set_dos_date( void );
-
-	/* reset to DOS value: */
-	outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
-	outport_byte( TIMER_CNTR0, 0 );
-	outport_byte( TIMER_CNTR0, 0 );
-
-	/* reset time-of-day */
-	rtc_set_dos_date();
-	
-	/* re-enable old handler: assume it was one of ours */
-	set_vector( (rtems_isr_entry)Old_ticker, 0x8, 1 );
-  }
-}
-
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
 
 #if 0 && defined(pentium)
-/* This can be used to get extremely accurate timing on a pentium.	*/
-/* It isn't supported. [bryce]						*/
+/* This can be used to get extremely accurate timing on a pentium. */
+/* It isn't supported. [bryce]      */
 #define HZ 90.0
 volatile long long Last_RDTSC;
 #define RDTSC()\
   ({ long long _now; __asm __volatile (".byte 0x0F,0x31":"=A"(_now)); _now; })
+
 long long Kernel_Time_ns( void )
 {
@@ -129,5 +201,5 @@
     disable_intr( flags );
     now = 1e9 * Clock_driver_ticks / isrs_per_second 
-	      + (RDTSC() - Last_RDTSC) * (1000.0/HZ);
+       + (RDTSC() - Last_RDTSC) * (1000.0/HZ);
     enable_intr( flags );
     return now;
Index: c/src/lib/libbsp/i386/go32/console/console.c
===================================================================
--- c/src/lib/libbsp/i386/go32/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/go32/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
+#include <bsp.h>
+#include <rtems/libio.h>
 
 #include <dpmi.h>
@@ -43,38 +42,53 @@
  */
 
-/* Set this if console I/O should use go32 (DOS) read/write calls.	*/
-/* Otherwise, direct hardware accesses will be used.			*/
-int			_IBMPC_Use_Go32_IO	= 0;
-
-static rtems_isr_entry	old_keyboard_isr	= NULL;
-extern void		_IBMPC_keyboard_isr( rtems_unsigned32 interrupt );
-
+/* Set this if console I/O should use go32 (DOS) read/write calls.   */
+/* Otherwise, direct hardware accesses will be used.                 */
+
+int      _IBMPC_Use_Go32_IO  = 0;
+
+static rtems_isr_entry  old_keyboard_isr  = NULL;
+
+extern void    _IBMPC_keyboard_isr( rtems_unsigned32 interrupt );
 
 rtems_device_driver console_initialize(
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
-    if ( _IBMPC_Use_Go32_IO )  {
-	/* Nothing.  We let DOS and go32 do all the work. */
-    } else {
-	/* Grap the keyboard interrupt so DOS doesn't steal our */
-	/* keystrokes.						*/
-	rtems_status_code	status;
-	status = rtems_interrupt_catch( _IBMPC_keyboard_isr, 9,
-				        &old_keyboard_isr );
-	if ( status )  {
-	    int write( int, void *, int );
-	    void exit( int );
-	    char msg[] = "error initializing keyboard\n";
-	    write( 2, msg, sizeof msg - 1 );
-	    exit( 1 );
-	}
+  void                      *arg
+)
+{
+  rtems_status_code status;
+
+  if ( _IBMPC_Use_Go32_IO )  {
+    /* Nothing.  We let DOS and go32 do all the work. */
+  } else {
+    /* Grap the keyboard interrupt so DOS doesn't steal our */
+    /* keystrokes.                                    */
+    rtems_status_code  status;
+
+    status = 
+      rtems_interrupt_catch( _IBMPC_keyboard_isr, 9, &old_keyboard_isr );
+
+    if ( status )  {
+      int write( int, void *, int );
+      void exit( int );
+
+      char msg[] = "error initializing keyboard\n";
+      write( 2, msg, sizeof msg - 1 );
+      exit( 1 );
     }
-
-    atexit( console_cleanup );
+  }
+
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  atexit( console_cleanup );
+
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -118,5 +132,5 @@
     outbyte( ch );
     if ( ch == '\r' )
-	outbyte( '\n' );
+      outbyte( '\n' );
 #endif
     return ch;
@@ -139,48 +153,103 @@
 
 /*
- * __read  -- read bytes from the console. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for ( i = 0; i < nbytes; i++ ) {
-    buf[i] = inbyte();
-    if ( buf[i] == '\r' ) {
-	/* What if this goes past the end of the buffer?  We're hosed. [bhc] */
-	buf[i++] = '\n';
-	buf[i] = '\0';
-	break;
+ *  Open entry point
+ */
+ 
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ *  Close entry point
+ */
+ 
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+ 
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      /* What if this goes past the end of the buffer?  We're hosed. [bhc] */
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
+      break;
     }
   }
-  return i;
-}
-
-/*
- * __write -- write bytes to the console. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+ 
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+ 
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+ 
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
+    outbyte( buffer[ count ] );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+ 
+/*
+ *  IO Control entry point
+ */
+ 
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/i386/go32/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i386/go32/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/go32/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -23,4 +23,6 @@
 #include <rtems.h>
 #include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
 
 /*
@@ -125,4 +127,22 @@
 #endif
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* functions */
 
@@ -134,13 +154,4 @@
 
 extern rtems_configuration_table BSP_Configuration;
-
-#if 0
-extern i386_IDT_slot Interrupt_descriptor_table[ 256 ];
-extern i386_GDT_slot Global_descriptor_table[ 8192 ];
-BSP_EXTERN unsigned short Idt[3];  /* Interrupt Descriptor Table Address */
-BSP_EXTERN unsigned short Gdt[3];  /* Global Descriptor Table Address */
-BSP_EXTERN unsigned int   Idt_base;
-BSP_EXTERN unsigned int   Gdt_base;
-#endif
 
 /* routines */
Index: c/src/lib/libbsp/i386/go32/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i386/go32/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i386/go32/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,9 +21,16 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
-
+#include <z8036.h>
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
 #include <stackchk.h>
+#endif
 
 /*
@@ -36,4 +43,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -58,4 +67,12 @@
 
     /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
+    /*
      * Set up for the libc handling.
      */
@@ -75,59 +92,115 @@
 
 }
-
-void bsp_start()
+ 
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
 {
-    extern void * sbrk( int );
-
-    Cpu_table.pretasking_hook		= NULL;
-    Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
-    Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
-    Cpu_table.idle_task	= NULL;  /* do not override system IDLE task */
-    Cpu_table.do_zero_of_workspace	= TRUE;
-    Cpu_table.interrupt_table_segment	= 0;/* get_ds(); */
-    Cpu_table.interrupt_table_offset	= (void *)0;
-    Cpu_table.interrupt_stack_size	= 4096;
-    Cpu_table.extra_system_initialization_stack = 0;
-
-    /*
-     *  Copy the table
-     */
-    BSP_Configuration = Configuration;
-
-    BSP_Configuration.work_space_start = sbrk( Configuration.work_space_size );
-    if ( BSP_Configuration.work_space_start == 0 )  {
-	/* Big trouble */
-	int	write( int, void *, int );
-	void	_exit( int );
-	char	msg[] = "bsp_start() couldn't sbrk() RTEMS work space\n";
-	write( 2, msg, sizeof msg - 1 );
-	_exit( 1 );
-    }
-
-    /*
-     * Add 1 region for Malloc in libc_low
-     */
-
-    BSP_Configuration.maximum_regions++;
-
-    /*
-     * Add 1 extension for newlib libc
-     */
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+/* This is the original command line passed from DOS */
+char **	Go32_Argv;
+
+int main(
+  int argc,
+  char **argv,
+  char **environp
+)
+{
+  extern void * sbrk( int );
+  extern volatile void _exit( int );
+
+  /* Set up arguments that we can access later */
+  Go32_Argv = argv;
+
+  if ((argc > 0) && argv && argv[0])
+    rtems_progname = argv[0];
+  else
+    rtems_progname = "RTEMS";
+
+  Cpu_table.pretasking_hook	= NULL;
+  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
+  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
+  Cpu_table.do_zero_of_workspace = TRUE;
+  Cpu_table.interrupt_table_segment = 0;/* get_ds(); */
+  Cpu_table.interrupt_table_offset = (void *)0;
+  Cpu_table.interrupt_stack_size = 4096;
+  Cpu_table.extra_system_initialization_stack = 0;
+
+  /*
+   *  Copy the table
+   */
+  BSP_Configuration = Configuration;
+
+  BSP_Configuration.work_space_start = sbrk( Configuration.work_space_size );
+  if ( BSP_Configuration.work_space_start == 0 )  {
+    /* Big trouble */
+    int write( int, void *, int );
+    char msg[] = "bsp_start() couldn't sbrk() RTEMS work space\n";
+    write( 2, msg, sizeof msg - 1 );
+    _exit( 1 );
+  }
+
+  /*
+   * Add 1 region for Malloc in libc_low
+   */
+
+  BSP_Configuration.maximum_regions++;
+
+  /*
+   * Add 1 extension for newlib libc
+   */
 
 #ifdef RTEMS_NEWLIB
-    BSP_Configuration.maximum_extensions++;
-#endif
-
-    /*
-     * Add another extension if using the stack checker
-     */
+  BSP_Configuration.maximum_extensions++;
+#endif
+
+  /*
+   * Add another extension if using the stack checker
+   */
 
 #ifdef STACK_CHECKER_ON
-    BSP_Configuration.maximum_extensions++;
-#endif
-
-    rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
-    /* does not return */
-
-    /* no cleanup necessary for GO32 */
+  BSP_Configuration.maximum_extensions++;
+#endif
+
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
+  /* does not return */
+
+  /* We only return here if the executive has finished.  This happens	*/
+  /* when the task has called exit().					*/
+  /* At this point we call _exit() which resides in djgcc.		*/
+    
+  for (;;)
+	  _exit( 0 );
+
+  /* no cleanup necessary for GO32 */
+
+  return 0;
 }
Index: c/src/lib/libbsp/i960/cvme961/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/i960/cvme961/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i960/cvme961/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,7 +21,8 @@
 #include <stdlib.h>
 
-#include <rtems.h>
 #include <bsp.h>
-#include <clockdrv.h>
+#include <rtems/libio.h>
+
+#define CLOCK_VECTOR 5
 
 rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
@@ -30,21 +31,16 @@
                                           /* ticks since initialization */
 
-rtems_device_driver Clock_initialize(
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id id,
-  rtems_unsigned32 *rval )
-{
-  Install_clock( Clock_isr );
-  atexit( Clock_exit );
-}
+void Clock_exit( void );
+ 
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
 
-void ReInstall_clock(
-  rtems_isr_entry clock_isr
-)
-{
-   (void) set_vector( clock_isr, 5, 1 );
-}
+
+/* this is later in the file to avoid it being inlined */
+rtems_isr Clock_isr( rtems_vector_number vector );
 
 void Install_clock(
@@ -58,9 +54,16 @@
 
   if ( BSP_Configuration.ticks_per_timeslice ) {
-    Old_ticker = set_vector( clock_isr, 5, 1 );
+    Old_ticker = set_vector( clock_isr, CLOCK_VECTOR, 1 );
     victimer = (volatile unsigned char *) 0xa00000c3;
     *victimer = 0x12;
     *victimer = 0x92;      /* 1000 HZ */
   }
+}
+
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
 }
 
@@ -76,2 +79,67 @@
   }
 }
+
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  atexit( Clock_exit );
+
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
+)
+{
+  /* enable_tracing(); */
+  Clock_driver_ticks += 1;
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+  }
+  else
+    Clock_isrs -= 1;
+  i960_clear_intr( 5 );
+}
+
Index: c/src/lib/libbsp/i960/cvme961/console/console.c
===================================================================
--- c/src/lib/libbsp/i960/cvme961/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i960/cvme961/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -1,4 +1,4 @@
 /*
- *  This file contains the MVME136 console IO package.
+ *  This file contains the CVME961 console IO package.
  *
  *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
@@ -15,7 +15,6 @@
 #define C961_INIT
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
+#include <bsp.h>
+#include <rtems/libio.h>
 
 /*  console_initialize
@@ -33,10 +32,19 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
-  *status = RTEMS_SUCCESSFUL;
+  void                      *arg
+)
+{
+ rtems_status_code status;
+ 
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -101,47 +109,102 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+ 
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+ 
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+ 
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+ 
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+ 
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+ 
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
+    outbyte( buffer[ count ] );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+ 
+/*
+ *  IO Control entry point
+ */
+ 
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/i960/cvme961/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i960/cvme961/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i960/cvme961/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -25,4 +25,6 @@
 #include <rtems.h>
 #include <iosupp.h>
+#include <console.h>
+#include <clockdrv.h>
 
 /*
@@ -116,4 +118,22 @@
 BSP_EXTERN i960ca_control_table *Ctl_tbl;
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* functions */
 
Index: c/src/lib/libbsp/i960/cvme961/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/i960/cvme961/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/i960/cvme961/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,10 +21,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
-#include "libcsupport.h"
-
-
-#include "stackchk.h"
+#include <rtems/libio.h>
+ 
+#include <libcsupport.h>
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 /*
@@ -38,4 +43,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -53,4 +60,12 @@
 
     RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+    /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
 
     /*
@@ -71,5 +86,31 @@
 }
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -77,4 +118,9 @@
 )
 {
+  if ((argc > 0) && argv && argv[0])
+    rtems_progname = argv[0];
+  else
+    rtems_progname = "RTEMS";
+
   /* set node number in SQSIO4 CTL REG */
 
@@ -111,5 +157,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -151,4 +197,10 @@
 #endif
 
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
   BSP_Configuration.work_space_start = (void *)
      (RAM_END - BSP_Configuration.work_space_size);
Index: c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/dmv152/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -20,8 +20,7 @@
 
 #include <stdlib.h>
-
-#include <rtems.h>
+ 
 #include <bsp.h>
-#include <clockdrv.h>
+#include <rtems/libio.h>
 
 rtems_unsigned32 Clock_isrs;        /* ISRs until next tick */
@@ -30,24 +29,35 @@
 rtems_isr_entry  Old_ticker;
 
-rtems_device_driver Clock_initialize(
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
+void Clock_exit( void );
+
+#define CLOCK_VECTOR  TIMER_VECTOR
+ 
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+
+/*
+ *  ISR Handler
+ */
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
 )
 {
-  Install_clock( Clock_isr );
-}
+  Clock_driver_ticks += 1;
 
-void ReInstall_clock(
-  rtems_isr_entry clock_isr
-)
-{
-  rtems_unsigned32 isrlevel = 0 ;
+  Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xE2 );
+  Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x22 );
+  Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0xC6 );
 
-  rtems_interrupt_disable( isrlevel );
-   (void) set_vector( clock_isr, TIMER_VECTOR, 1 );
-  rtems_interrupt_enable( isrlevel );
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+  }
+  else
+    Clock_isrs -= 1;
 }
 
@@ -62,5 +72,5 @@
 
   if ( BSP_Configuration.ticks_per_timeslice ) {
-    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, TIMER_VECTOR, 1 );
+    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
 
     Z8x36_WRITE( TIMER, MASTER_CFG, 0xd4 );
@@ -70,5 +80,5 @@
     Z8x36_WRITE( TIMER, CT1_TIME_CONST_LSB, 0xCE );
     Z8x36_WRITE( TIMER, CT1_MODE_SPEC, 0x83 );
-    Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, TIMER_VECTOR );
+    Z8x36_WRITE( TIMER, CNT_TMR_VECTOR, CLOCK_VECTOR );
     Z8x36_WRITE( TIMER, CT1_CMD_STATUS, 0x20 );
     Z8x36_READ ( TIMER, MASTER_INTR, data );
@@ -88,4 +98,15 @@
 }
 
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_unsigned32 isrlevel = 0 ;
+
+  rtems_interrupt_disable( isrlevel );
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
+}
+
 void Clock_exit( void )
 {
@@ -100,2 +121,50 @@
   }
 }
+
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/m68k/dmv152/console/console.c
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/dmv152/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -15,8 +15,7 @@
 #define D152_INIT
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
-
+#include <bsp.h>
+#include <rtems/libio.h>
+ 
 /*  console_initialize
  *
@@ -29,16 +28,24 @@
  *  Return values:
  */
-
+ 
 rtems_device_driver console_initialize(
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
-  *status = RTEMS_SUCCESSFUL;
-}
-
+  void                      *arg
+)
+{
+  rtems_status_code status;
+ 
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
+}
 
 /*  is_character_ready
@@ -140,47 +147,101 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
-  }
-  return (nbytes);
-}
+    outbyte( buffer[ count ] );
+  }
+  return maximum;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/m68k/dmv152/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/dmv152/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -22,5 +22,8 @@
 
 #include <rtems.h>
+#include <console.h>
+#include <clockdrv.h>
 #include <iosupp.h>
+#include <vmeintr.h>
 #include <z8530.h>
 #include <z8536.h>
@@ -152,4 +155,22 @@
 extern m68k_isr_entry M68Kvec[];   /* vector table address */
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* functions */
 
Index: c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -22,9 +22,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
-#include <vmeintr.h>
-
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 /*
  *  The original table from the application and our copy of it with
@@ -36,4 +42,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -53,4 +61,12 @@
 
     /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
+    /*
      * Set up for the libc handling.
      */
@@ -70,5 +86,31 @@
 }
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -80,4 +122,9 @@
   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 );
@@ -116,5 +163,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -159,4 +206,10 @@
     BSP_Configuration.maximum_extensions++;
 #endif
+
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
 
   rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
Index: c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/gen68302/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,9 +21,10 @@
 #include <stdlib.h>			/* for atexit() */
 
-#include <rtems.h>
 #include <bsp.h>
-#include <clockdrv.h>
+#include <rtems/libio.h>
+
 #include "m68302.h"
 
+#define CLOCK_VECTOR 137
 
 #define TMR1_VAL (  RBIT_TMR_RST	/* software reset the timer */\
@@ -50,16 +51,33 @@
 rtems_unsigned32 Clock_isrs;
 
+void Clock_exit( void );
+ 
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
 
-rtems_device_driver Clock_initialize( 
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
+/*
+ *  ISR Handler
+ */
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
 )
 {
-  Install_clock( Clock_isr );
+  Clock_driver_ticks += 1;
+
+  m302.reg.isr  = RBIT_ISR_TIMER1;	/* clear in-service bit */
+  m302.reg.ter1 = (RBIT_TER_REF | RBIT_TER_CAP); /* clear timer intr request */
+
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+  }
+  else
+    Clock_isrs -= 1;
 }
-
 
 void Install_clock(
@@ -72,5 +90,5 @@
 
   if ( BSP_Configuration.ticks_per_timeslice ) {
-/*  set_vector( clock_isr, 137, 1 );*/
+/*  set_vector( clock_isr, CLOCK_VECTOR, 1 );*/
 
     m302.reg.trr1 = TRR1_VAL;		/* set timer reference register */
@@ -85,4 +103,14 @@
 }
 
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_unsigned32 isrlevel;
+ 
+  rtems_interrupt_disable( isrlevel );
+   /* (void) set_vector( clock_isr, CLOCK_VECTOR, 1 ); */
+  rtems_interrupt_enable( isrlevel );
+}
 
 void Clock_exit( void )
@@ -93,2 +121,50 @@
   }
 }
+
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr( CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/m68k/gen68302/console/console.c
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/gen68302/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -15,7 +15,6 @@
 #define GEN68302_INIT
 
-#include <rtems.h>
-#include "console.h"
 #include <bsp.h>
+#include <rtems/libio.h>
 
 #include "m68302.h"
@@ -35,9 +34,8 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
+  void                      *arg
+)
+{
+  rtems_status_code status;
   volatile m302_dualPortRAM_t *p = &m302;
 
@@ -82,7 +80,16 @@
   p->reg.scc[1].scm  = 0x01BD;
 
-  *status = RTEMS_SUCCESSFUL;
-}
-
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
+
+}
 
 /*  is_character_ready
@@ -195,47 +202,101 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
+    outbyte( buffer[ count ] );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/m68k/gen68302/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/gen68302/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -24,5 +24,7 @@
 
 #include <rtems.h>
+#include <console.h>
 #include <iosupp.h>
+#include <clockdrv.h>
 
 /*
@@ -82,4 +84,22 @@
 #endif
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* miscellaneous stuff assumed to exist */
 
Index: c/src/lib/libbsp/m68k/gen68302/start/start302.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/start/start302.s	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/gen68302/start/start302.s	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -228,5 +228,8 @@
 #endif
 
-        jsr     SYM (bsp_start)
+        move.l  #0,a7@-               | environp
+        move.l  #0,a7@-               | argv
+        move.l  #0,a7@-               | argc
+        jsr     SYM (main)
 
 	nop
Index: c/src/lib/libbsp/m68k/gen68302/start302/start302.s
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/start302/start302.s	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/gen68302/start302/start302.s	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -228,5 +228,8 @@
 #endif
 
-        jsr     SYM (bsp_start)
+        move.l  #0,a7@-               | environp
+        move.l  #0,a7@-               | argv
+        move.l  #0,a7@-               | argc
+        jsr     SYM (main)
 
 	nop
Index: c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,8 +21,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
-
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 /*
@@ -35,4 +42,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -59,4 +68,12 @@
 
     /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
+    /*
      * Set up for the libc handling.
      */
@@ -76,6 +93,31 @@
 }
 
-
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -83,4 +125,9 @@
 )
 {
+  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
@@ -91,5 +138,5 @@
    */
 #if 0
-a  Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/;
+  Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/;
 #endif
 
@@ -122,4 +169,10 @@
     BSP_Configuration.maximum_extensions++;
 #endif
+
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
 
   /*
@@ -144,5 +197,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;    /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
Index: c/src/lib/libbsp/m68k/idp/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/m68k/idp/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/idp/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 
-#include <rtems.h>
-#include <clockdrv.h>
 #include <bsp.h>
+#include <rtems/libio.h>
 
 rtems_unsigned32 Clock_isrs;        /* ISRs until next tick */
@@ -40,28 +39,51 @@
 void Disable_clock();
 
-#define TIMER_VECTOR 0x4D
-
-rtems_device_driver Clock_initialize( 
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
+#define CLOCK_VECTOR 0x4D
+
+void Clock_exit( void );
+ 
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+ 
+
+/*
+ *  ISR Handler
+ *
+ *
+ * ((1ms * 6.5 MHz) / 2^5) = 203.125) where 6.5 MHz is the clock rate of the
+ * MC68230, 2^5 is the prescaler factor, and 1ms is the common interrupt
+ * interval for the Clock_isr routine.
+ * Therefore, 203 (decimal) is the number to program into the CPRH-L registers
+ * of the MC68230 for countdown.  However, I have found that 193 instead of
+ * 203 provides greater accuracy -- why?  The crystal should be more accurate
+ * than that
+ */
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
 )
 {
-  Install_clock( Clock_isr );
-}
-
-void ReInstall_clock( clock_isr )
-rtems_isr_entry clock_isr;
-{
-  rtems_unsigned32 isrlevel = 0 ;
-
-  rtems_interrupt_disable( isrlevel );
-   (void) set_vector( clock_isr, TIMER_VECTOR, 1 );
-  rtems_interrupt_enable( isrlevel );
-}
-
-/* The following was added for debugging purposes */
+  Clock_driver_ticks += 1;
+  /* acknowledge interrupt
+  	TSR = 1; */
+  MC68230_WRITE (TSR, 1);
+
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+	/* Cast to an integer so that 68EC040 IDP which doesn't have an FPU doesn't
+	   have a heart attack -- if you use newlib1.6 or greater and get
+	   libgcc.a for gcc with software floating point support, this is not
+	   a problem */
+    Clock_isrs = 
+      (int)(BSP_Configuration.microseconds_per_tick / 1000);
+  }
+  else 
+    Clock_isrs -= 1;
+}
+
 void Disable_clock()
 {
@@ -78,5 +100,5 @@
   if ( Configuration.ticks_per_timeslice ) {
 /*    led_putnum('c'); * for debugging purposes */
-    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, TIMER_VECTOR, 1 );
+    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
 
 	/* Disable timer for initialization */
@@ -86,6 +108,6 @@
 	   file in this directory to understand why I use the values that I do */
 	/* Set up the interrupt vector on the MC68230 chip:
-		TIVR = TIMER_VECTOR; */
-	MC68230_WRITE (TIVR, TIMER_VECTOR);
+		TIVR = CLOCK_VECTOR; */
+	MC68230_WRITE (TIVR, CLOCK_VECTOR);
 
 	/* Set CPRH through CPRL to 193 (not 203) decimal for countdown--see ckisr.c
@@ -109,4 +131,15 @@
 }
 
+void ReInstall_clock( clock_isr )
+rtems_isr_entry clock_isr;
+{
+  rtems_unsigned32 isrlevel = 0 ;
+
+  rtems_interrupt_disable( isrlevel );
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
+}
+
+/* The following was added for debugging purposes */
 void Clock_exit( void )
 {
@@ -124,2 +157,50 @@
   }
 }
+
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/m68k/idp/console/console.c
===================================================================
--- c/src/lib/libbsp/m68k/idp/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/idp/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -12,14 +12,12 @@
 #define MIDP_INIT
 
-#include "rtems.h"
-#include "console.h"
-#include "bsp.h"
-
-#include "ringbuf.h"
+#include <bsp.h>
+#include <rtems/libio.h>
+
+#include <ringbuf.h>
 
 Ring_buffer_t  Buffer[ 2 ];
 
 rtems_isr C_Receive_ISR(rtems_vector_number vector);
-
 
 /*  console_initialize
@@ -37,9 +35,8 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
+  void                      *arg
+)
+{
+  rtems_status_code status;
 
   Ring_buffer_Initialize( &Buffer[ 0 ] );
@@ -48,5 +45,32 @@
   init_pit();
 
-  *status = RTEMS_SUCCESSFUL;
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  status = rtems_io_register_name(
+    "/dev/tty00",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  status = rtems_io_register_name(
+    "/dev/tty01",
+    major,
+    (rtems_device_minor_number) 1
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -152,65 +176,107 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-  int port;
-
-  /*
-   *  Map port A to stdin, stdout, and stderr.
-   *  Map everything else to port B.
-   */
-
-  if ( fd <= 2 ) port = 0;
-  else           port = 1;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte( port );
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  if ( minor > 1 )
+    return RTEMS_INVALID_NUMBER;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte( minor );
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-  int port;
- 
-  /*
-   *  Map port A to stdin, stdout, and stderr.
-   *  Map everything else to port B.
-   */
- 
-  if ( fd <= 2 ) port = 0;
-  else           port = 1;
- 
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r', port );
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  if ( minor > 1 )
+    return RTEMS_INVALID_NUMBER;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r', minor );
     }
-    outbyte (*(buf + i), port );
+    outbyte( buffer[ count ], minor  );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/m68k/idp/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/idp/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/idp/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -11,4 +11,5 @@
 #include <rtems.h>
 #include <console.h>
+#include <clockdrv.h>
 #include <mc68230.h>
 #include <mc68681.h>
@@ -53,4 +54,22 @@
 #endif
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* miscellaneous stuff assumed to exist */
 
Index: c/src/lib/libbsp/m68k/idp/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/idp/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/idp/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,7 +21,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 unsigned char *duart_base;
@@ -42,4 +50,6 @@
 rtems_cpu_table Cpu_table;
  
+char *rtems_progname;
+
 /*      Initialize whatever libc we are using
  *      called from postdriver hook
@@ -57,4 +67,12 @@
 	/* Create 64 KByte memory region for RTEMS executive */
     RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+    /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
  
     /*
@@ -77,5 +95,31 @@
  
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -86,4 +130,9 @@
   int             index;
 
+  if ((argc > 0) && argv && argv[0])
+    rtems_progname = argv[0];
+  else
+    rtems_progname = "RTEMS";
+
   duart_base = (unsigned char *)DUART_ADDR;
 
@@ -122,5 +171,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
  
-  Cpu_table.postdriver_hook = NULL;
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
  
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -165,4 +214,10 @@
 #endif
  
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
 /*  led_putnum('e'); * for debugging purposes only */
   rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */
Index: c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme136/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 
-#include <rtems.h>
 #include <bsp.h>
-#include <clockdrv.h>
+#include <rtems/libio.h>
 #include <z8036.h>
 
@@ -36,29 +35,41 @@
                                     /*   and trigger countdown */
 
+#define TIMER        0xfffb0000
+#define RELOAD       0x24            /* clr IP & IUS,allow countdown */
+ 
+#define CLOCK_VECTOR 66
+
 rtems_unsigned32 Clock_isrs;        /* ISRs until next tick */
-volatile rtems_unsigned32 Clock_driver_ticks;
-                                    /* ticks since initialization */
+
+volatile rtems_unsigned32 Clock_driver_ticks; /* ticks since initialization */
+
 rtems_isr_entry  Old_ticker;
 
-rtems_device_driver Clock_initialize(
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
+void Clock_exit( void );
+
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+ 
+/*
+ *  ISR Handler
+ */
+ 
+rtems_isr Clock_isr(
+  rtems_vector_number vector
 )
 {
-  Install_clock( Clock_isr );
-}
+  Clock_driver_ticks += 1;
+  ((volatile struct z8036_map *) TIMER)->CT1_CMD_STATUS = RELOAD;
 
-void ReInstall_clock(
-  rtems_isr_entry clock_isr
-)
-{
-  rtems_unsigned32 isrlevel;
-
-  rtems_interrupt_disable( isrlevel );
-   (void) set_vector( clock_isr, 66, 1 );
-  rtems_interrupt_enable( isrlevel );
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+  }
+  else
+    Clock_isrs -= 1;
 }
 
@@ -73,26 +84,38 @@
 
   if ( BSP_Configuration.ticks_per_timeslice ) {
-    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, 66, 1 );
+    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
     timer = (struct z8036_map *) 0xfffb0000;
     timer->MASTER_INTR        = MICRVAL;
     timer->CT1_MODE_SPEC      = T1MSRVAL;
 
-  *((rtems_unsigned16 *)0xfffb0016) = MS_COUNT;  /* write countdown value */
-/*
-    timer->CT1_TIME_CONST_MSB = (MS_COUNT >> 8);
-    timer->CT1_TIME_CONST_LSB = (MS_COUNT &  0xff);
-*/
+    *((rtems_unsigned16 *)0xfffb0016) = MS_COUNT;  /* write countdown value */
+
+    /*
+     *  timer->CT1_TIME_CONST_MSB = (MS_COUNT >> 8);
+     *  timer->CT1_TIME_CONST_LSB = (MS_COUNT &  0xff);
+     */
+
     timer->MASTER_CFG         = MCCRVAL;
     timer->CT1_CMD_STATUS     = T1CSRVAL;
 
-/*
- * Enable interrupt via VME interrupt mask register
- */
+    /*
+     * Enable interrupt via VME interrupt mask register
+     */
     (*(rtems_unsigned8 *)0xfffb0038) &= 0xfd;
-
 
     atexit( Clock_exit );
   }
 
+}
+
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_unsigned32 isrlevel;
+
+  rtems_interrupt_disable( isrlevel );
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
 }
 
@@ -110,2 +133,50 @@
   }
 }
+
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/m68k/mvme136/console/console.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme136/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme136/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -15,7 +15,6 @@
 #define M136_INIT
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
+#include <bsp.h>
+#include <rtems/libio.h>
 
 /*  console_initialize
@@ -33,12 +32,22 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
+  void                      *arg
+)
+{
+  rtems_status_code status;
+
   _Write_m681 = ( struct w_m681_info * ) M681ADDR;
   _Read_m681 = ( struct r_m681_info * ) M681ADDR;
-  *status = RTEMS_SUCCESSFUL;
+
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -113,47 +122,101 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
+    outbyte( buffer[ count ] );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/m68k/mvme136/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/mvme136/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme136/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -22,4 +22,6 @@
 
 #include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
 #include <iosupp.h>
 
@@ -125,4 +127,22 @@
 extern m68k_isr_entry M68Kvec[];   /* vector table address */
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* functions */
 
Index: c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,10 +21,16 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+
 #include <libcsupport.h>
 #include <z8036.h>
 
-#include "stackchk.h"
+#include <string.h>
+#include <fcntl.h>
+
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 /*
@@ -37,4 +43,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -47,4 +55,8 @@
     rtems_unsigned32        heap_start;
 
+#ifdef RTEMS_DEBUG
+    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
+#endif
+
     heap_start = (rtems_unsigned32) &end;
     if (heap_start & (CPU_ALIGNMENT-1))
@@ -52,4 +64,12 @@
 
     RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
+
+    /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
 
     /*
@@ -71,5 +91,32 @@
 }
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+
+int main(
   int argc,
   char **argv,
@@ -80,4 +127,9 @@
   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 */
   m68k_set_vbr( monitors_vector_table );
@@ -105,5 +157,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -148,4 +200,10 @@
 #endif
 
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
   rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
   /* does not return */
Index: c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -28,7 +28,6 @@
 #include <stdlib.h>
 
-#include <rtems.h>
 #include <bsp.h>
-#include <clockdrv.h>
+#include <rtems/libio.h>
 
 #define MS_COUNT          1000            /* T2's countdown constant (1 ms) */
@@ -39,22 +38,31 @@
 rtems_isr_entry  Old_ticker;
 
-rtems_device_driver Clock_initialize( 
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
-)
+void Clock_exit( void );
+ 
+#define CLOCK_VECTOR (VBR0 * 0x10 + 0x9)
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+ 
+
+/*
+ *  ISR Handler
+ */
+
+rtems_isr Clock_isr(rtems_vector_number vector)
 {
-  Install_clock( Clock_isr );
-}
+  Clock_driver_ticks += 1;
+  lcsr->timer_cnt_2 = 0;            /* clear counter */
+  lcsr->intr_clear |= 0x02000000;
 
-void ReInstall_clock(rtems_isr_entry clock_isr)
-{
-  rtems_unsigned32 isrlevel;
-
-  rtems_interrupt_disable( isrlevel );
-  (void) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 );
-  rtems_interrupt_enable( isrlevel );
+  if ( Clock_isrs == 1 ) {
+    rtems_clock_tick();
+    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
+  }
+  else 
+    Clock_isrs -= 1;
 }
 
@@ -67,5 +75,5 @@
   if ( BSP_Configuration.ticks_per_timeslice ) {
     Old_ticker = 
-      (rtems_isr_entry) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 );
+      (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
     lcsr->vector_base |= MASK_INT;   /* unmask VMEchip2 interrupts */
     lcsr->to_ctl = 0xE7;             /* prescaler to 1 MHz (see Appendix A1) */
@@ -80,5 +88,13 @@
     atexit( Clock_exit );
   } 
+}
 
+void ReInstall_clock(rtems_isr_entry clock_isr)
+{
+  rtems_unsigned32 isrlevel;
+
+  rtems_interrupt_disable( isrlevel );
+  (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
 }
 
@@ -87,2 +103,50 @@
 /* Dummy for now. See other m68k BSP's for code examples */
 }
+
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(CLOCK_VECTOR);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libbsp/m68k/mvme162/console/console.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme162/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme162/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -22,8 +22,7 @@
 #define M162_INIT
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
-#include "ringbuf.h"
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <ringbuf.h>
 
 Ring_buffer_t  Buffer[2];
@@ -55,10 +54,9 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
+  void                      *arg
 )
 {
   int     i;
+  rtems_status_code status;
   
   /*
@@ -80,5 +78,32 @@
   mcchip->SCC_int_ctl = 0x13;     /* SCC IEN, IPL3 */
 
-  *status = RTEMS_SUCCESSFUL;
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  status = rtems_io_register_name(
+    "/dev/tty00",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  status = rtems_io_register_name(
+    "/dev/tty01",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -101,5 +126,5 @@
  */
 
-char char_wait(int port)
+char inbyte(int port)
 {
   unsigned char tmp_char;
@@ -114,5 +139,5 @@
  */
 
-void char_put(int port, char ch)
+void outbyte(int port, char ch)
 {
   while (1) {
@@ -123,44 +148,107 @@
 
 /*
- *    Map port A (1) to stdin, stdout, and stderr.
- *    Map everything else to port B (0).
- */
-
-int __read(int fd, char *buf, int nbytes)
-{
-  int i, port;
-
-  if ( fd <= 2 ) port = 1;
-  else           port = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = char_wait(port);
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  if ( minor > 1 )
+    return RTEMS_INVALID_NUMBER;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte( minor );
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- *  Map port A (1) to stdin, stdout, and stderr.
- *  Map everything else to port B (0).
- */
-
-int __write(int fd, char *buf, int nbytes)
-{
-  int i, port;
- 
-  if ( fd <= 2 ) port = 1;
-  else           port = 0;
- 
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      char_put (port, '\r');
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  if ( minor > 1 )
+    return RTEMS_INVALID_NUMBER;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r', minor );
     }
-    char_put (port, *(buf + i));
-  }
-  return (nbytes);
-}
+    outbyte( buffer[ count ], minor  );
+  }
+  return maximum;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/m68k/mvme162/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/mvme162/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme162/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -29,4 +29,6 @@
 
 #include <rtems.h>
+#include <clockdrv.h>
+#include <console.h>
 #include <iosupp.h>
 
@@ -249,4 +251,22 @@
 #endif
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* miscellaneous stuff assumed to exist */
 
Index: c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -28,8 +28,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
-#include <z8036.h>
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 /*
@@ -42,4 +49,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -59,4 +68,12 @@
 
     /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
+    /*
      * Set up for the libc handling.
      */
@@ -76,5 +93,31 @@
 }
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -85,4 +128,9 @@
   int             index;
 
+  if ((argc > 0) && argv && argv[0])
+    rtems_progname = argv[0];
+  else
+    rtems_progname = "RTEMS";
+
   /*
    *  162Bug Vectors are at 0xFFE00000
@@ -122,5 +170,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -162,4 +210,10 @@
 #endif
 
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
   BSP_Configuration.work_space_start = (void *)
      (RAM_END - BSP_Configuration.work_space_size);
Index: c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c
===================================================================
--- c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -61,26 +61,23 @@
 rtems_isr_entry  Old_ticker;
 
-/*
- *  Reinstall_clock
- *
- *  Install a clock tick handler without reprogramming the chip.  This
- *  is used by the polling shared memory device driver.
- */
-
-void ReInstall_clock(
-  rtems_isr_entry clock_isr
-)
-{
-  rtems_unsigned32 isrlevel = 0;
-
-  /*
-   *  Disable interrupts and install the clock ISR vector using the
-   *  BSP dependent set_vector routine.  In the below example, the clock
-   *  ISR is on vector 4 and is an RTEMS interrupt.
-   */
-
-  rtems_interrupt_disable( isrlevel );
-   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
-  rtems_interrupt_enable( isrlevel );
+void Clock_exit( void );
+
+
+/*
+ *  Isr Handler
+ */
+
+rtems_isr Clock_isr(
+  rtems_vector_number vector
+)
+{
+/*
+ * bump the number of clock driver ticks since initialization
+ *
+ * determine if it is time to announce the passing of tick as configured
+ * to RTEMS through the rtems_clock_tick directive
+ *
+ * perform any timer dependent tasks
+ */
 }
 
@@ -125,4 +122,28 @@
 
 /*
+ *  Reinstall_clock
+ *
+ *  Install a clock tick handler without reprogramming the chip.  This
+ *  is used by the polling shared memory device driver.
+ */
+
+void ReInstall_clock(
+  rtems_isr_entry clock_isr
+)
+{
+  rtems_unsigned32 isrlevel = 0;
+
+  /*
+   *  Disable interrupts and install the clock ISR vector using the
+   *  BSP dependent set_vector routine.  In the below example, the clock
+   *  ISR is on vector 4 and is an RTEMS interrupt.
+   */
+
+  rtems_interrupt_disable( isrlevel );
+   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
+  rtems_interrupt_enable( isrlevel );
+}
+
+/*
  *  Clean up before the application exits
  */
@@ -150,12 +171,13 @@
 )
 {
-  Install_clock((rtems_isr_entry) Clock_isr);
-
+  Install_clock( Clock_isr );
+ 
   /*
    * make major/minor avail to others such as shared memory driver
    */
+ 
   rtems_clock_major = major;
-    rtems_clock_minor = minor;
-
+  rtems_clock_minor = minor;
+ 
   return RTEMS_SUCCESSFUL;
 }
Index: c/src/lib/libbsp/no_cpu/no_bsp/console/console.c
===================================================================
--- c/src/lib/libbsp/no_cpu/no_bsp/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/no_cpu/no_bsp/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -15,7 +15,6 @@
 #define NO_BSP_INIT
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
+#include <bsp.h>
+#include <rtems/libio.h>
 
 /*  console_initialize
@@ -33,10 +32,19 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
-  *status = RTEMS_SUCCESSFUL;
+  void                      *arg
+)
+{
+  rtems_status_code status;
+ 
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -111,48 +119,103 @@
 }
 
-/*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+
+/*
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
     }
-    outbyte (*(buf + i));
+    outbyte( buffer[ count ] );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h
===================================================================
--- c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -24,4 +24,5 @@
 
 #include <rtems.h>
+#include <console.h>
 #include <clockdrv.h>
 
@@ -70,16 +71,20 @@
 
 /*
- * Console driver init
+ *  Device Driver Table Entries
  */
- 
-rtems_device_driver console_initialize(
-  rtems_device_major_number, rtems_device_minor_number minor, void *);
- 
-#define CONSOLE_DRIVER_TABLE_ENTRY \
-  { console_initialize, NULL, NULL, NULL, NULL, NULL }
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
  
 /*
  * NOTE: Use the standard Clock driver entry
  */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
 
 /* functions */
Index: c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -21,8 +21,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
-#include <shm.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 /*
@@ -36,4 +43,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -60,4 +69,12 @@
 
     /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
+    /*
      * Set up for the libc handling.
      */
@@ -77,5 +94,31 @@
 }
 
-int bsp_start(
+/*
+ * 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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
   int argc,
   char **argv,
@@ -83,4 +126,9 @@
 )
 {
+  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
@@ -119,4 +167,18 @@
 #endif
 
+#ifdef STACK_CHECKER_ON
+    /*
+     * Add 1 extension for stack checker
+     */
+ 
+    BSP_Configuration.maximum_extensions++;
+#endif
+
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
   /*
    *  Need to "allocate" the memory for the RTEMS Workspace and
@@ -139,5 +201,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;    /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
Index: c/src/lib/libbsp/powerpc/papyrus/include/bsp.h
===================================================================
--- c/src/lib/libbsp/powerpc/papyrus/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/powerpc/papyrus/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -44,4 +44,5 @@
 #else
 #include <rtems.h>
+#include <console.h>
 
 /*
@@ -95,4 +96,22 @@
 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
 
+/*
+ *  Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
+ 
+/*
+ * NOTE: Use the standard Clock driver entry
+ */
+
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* functions */
 
Index: c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -38,8 +38,15 @@
  */
 
-#include <rtems.h>
 #include <bsp.h>
-#include <shm.h>
+#include <rtems/libio.h>
+ 
 #include <libcsupport.h>
+ 
+#include <string.h>
+#include <fcntl.h>
+ 
+#ifdef STACK_CHECKER_ON
+#include <stackchk.h>
+#endif
 
 /*
@@ -53,4 +60,6 @@
 
 rtems_cpu_table Cpu_table;
+
+char *rtems_progname;
 
 /*      Initialize whatever libc we are using
@@ -77,4 +86,12 @@
 
     /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
+    /*
      * Set up for the libc handling.
      */
@@ -94,6 +111,41 @@
 }
 
-void bsp_start(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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
 {
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
+}
+
+int main(
+  int argc,
+  char **argv,
+  char **environp
+)
+{
+  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
@@ -133,4 +185,10 @@
 
   /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+  /*
    *  Need to "allocate" the memory for the RTEMS Workspace and
    *  tell the RTEMS configuration where it is.  This memory is
@@ -155,5 +213,5 @@
   Cpu_table.predriver_hook = bsp_libc_init;    /* RTEMS resources available */
 
-  Cpu_table.postdriver_hook = NULL;
+  Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
   Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
Index: c/src/lib/libbsp/shmdr/init.c
===================================================================
--- c/src/lib/libbsp/shmdr/init.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/shmdr/init.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -4,6 +4,5 @@
  *  driver initialization routine.
  *
- *  Input parameters:
- *    configuration - address of configuration table
+ *  Input parameters:  NONE
  *
  *  Output parameters: NONE
@@ -34,10 +33,6 @@
 rtems_extensions_table MPCI_Shm_extensions;
 
-rtems_mpci_entry Shm_Initialization(
-  rtems_configuration_table   *configuration,
-  rtems_cpu_table             *cpu_configuration,
-  rtems_multiprocessing_table *mp_configuration
-
-)
+rtems_mpci_entry Shm_Initialization( void )
+
 {
   rtems_unsigned32         i, all_initialized;
@@ -47,4 +42,7 @@
   rtems_unsigned32         extension_id;    /* for installation of MPCI_Fatal */
   rtems_unsigned32         remaining_memory;
+/* XXX these should use "public" methods to set their values.... */
+  rtems_configuration_table   *configuration = _Configuration_Table;
+  rtems_multiprocessing_table *mp_configuration = _Configuration_MP_table;
 
   Shm_RTEMS_Configuration    = configuration;
Index: c/src/lib/libbsp/shmdr/mpci.h
===================================================================
--- c/src/lib/libbsp/shmdr/mpci.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/shmdr/mpci.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -16,6 +16,6 @@
  */
 
-#ifndef __MPCI_h
-#define __MPCI_h
+#ifndef __SHM_MPCI_h
+#define __SHM_MPCI_h
 
 #ifdef __cplusplus
Index: c/src/lib/libbsp/shmdr/shm.h
===================================================================
--- c/src/lib/libbsp/shmdr/shm.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/shmdr/shm.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -494,9 +494,5 @@
 );
 
-rtems_mpci_entry Shm_Initialization(
-  rtems_configuration_table   *configuration,
-  rtems_cpu_table             *cpu_configuration,
-  rtems_multiprocessing_table *mp_configuration
-);
+rtems_mpci_entry Shm_Initialization( void );
 
 rtems_mpci_entry Shm_Receive_packet(
Index: c/src/lib/libbsp/shmdr/shm_driver.h
===================================================================
--- c/src/lib/libbsp/shmdr/shm_driver.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/shmdr/shm_driver.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -494,9 +494,5 @@
 );
 
-rtems_mpci_entry Shm_Initialization(
-  rtems_configuration_table   *configuration,
-  rtems_cpu_table             *cpu_configuration,
-  rtems_multiprocessing_table *mp_configuration
-);
+rtems_mpci_entry Shm_Initialization( void );
 
 rtems_mpci_entry Shm_Receive_packet(
Index: c/src/lib/libbsp/unix/posix/console/console.c
===================================================================
--- c/src/lib/libbsp/unix/posix/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/unix/posix/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -3,4 +3,6 @@
  *
  *  These provide UNIX-like read and write calls for the C library.
+ *
+ *  NOTE:  For the most part, this is just a space holder.
  *
  *  COPYRIGHT (c) 1994 by Division Incorporated
@@ -32,5 +34,70 @@
 )
 {
-    return RTEMS_SUCCESSFUL;
+  return 0;
 }
 
+
+/*
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same. 
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return -1;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
Index: c/src/lib/libbsp/unix/posix/include/bsp.h
===================================================================
--- c/src/lib/libbsp/unix/posix/include/bsp.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/unix/posix/include/bsp.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -23,4 +23,5 @@
 #include <rtems.h>
 #include <clockdrv.h>
+#include <console.h>
 #include <iosupp.h>
 #include <libcsupport.h>
@@ -81,12 +82,10 @@
 
 /*
- * Console driver init
+ *  Device Driver Table Entries
  */
- 
-rtems_device_driver console_initialize(
-  rtems_device_major_number, rtems_device_minor_number minor, void *);
- 
-#define CONSOLE_DRIVER_TABLE_ENTRY \
-  { console_initialize, NULL, NULL, NULL, NULL, NULL }
+
+/*
+ * NOTE: Use the standard Console driver entry
+ */
  
 /*
@@ -94,4 +93,10 @@
  */
  
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS       20
+
 /* functions */
 
Index: c/src/lib/libbsp/unix/posix/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/unix/posix/startup/bspstart.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libbsp/unix/posix/startup/bspstart.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -37,4 +37,6 @@
 #include <bsp.h>
 #include <libcsupport.h>
+
+#include <rtems/libio.h>
 
 #ifdef STACK_CHECKER_ON
@@ -113,4 +115,12 @@
     RTEMS_Malloc_Initialize((void *)heap_start, Heap_size, 1024 * 1024);
 
+    /*
+     *  Init the RTEMS libio facility to provide UNIX-like system
+     *  calls for use by newlib (ie: provide __open, __close, etc)
+     *  Uses malloc() to get area for the iops, so must be after malloc init
+     */
+
+    rtems_libio_init();
+
     libc_init(1);
 }
@@ -159,4 +169,32 @@
 #ifdef RTEMS_DEBUG
     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)
+ */
+ 
+void
+bsp_postdriver_hook(void)
+{
+#if 0
+  int stdin_fd, stdout_fd, stderr_fd;
+ 
+  if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD0');
+ 
+  if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD1');
+ 
+  if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+    rtems_fatal_error_occurred('STD2');
+ 
+  if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+    rtems_fatal_error_occurred('STIO');
 #endif
 }
@@ -262,5 +300,5 @@
     Cpu_table.predriver_hook = NULL;
 
-    Cpu_table.postdriver_hook = NULL;
+    Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
     Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
@@ -302,21 +340,27 @@
 #endif
 
-    /*
-     * Add 1 extension for MPCI_fatal
-     */
-
-    if (BSP_Configuration.User_multiprocessing_table)
-        BSP_Configuration.maximum_extensions++;
-
-    CPU_CLICKS_PER_TICK = 1;
-
-    /*
-     *  Start most of RTEMS
-     *  main() will start the rest
-     */
-
-    bsp_isr_level = rtems_initialize_executive_early(
-      &BSP_Configuration,
-      &Cpu_table
-    );
+  /*
+   * Tell libio how many fd's we want and allow it to tweak config
+   */
+
+  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
+
+  /*
+   * Add 1 extension for MPCI_fatal
+   */
+
+  if (BSP_Configuration.User_multiprocessing_table)
+      BSP_Configuration.maximum_extensions++;
+
+  CPU_CLICKS_PER_TICK = 1;
+
+  /*
+   *  Start most of RTEMS
+   *  main() will start the rest
+   */
+
+  bsp_isr_level = rtems_initialize_executive_early(
+    &BSP_Configuration,
+    &Cpu_table
+  );
 }
Index: c/src/lib/libc/error.c
===================================================================
--- c/src/lib/libc/error.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libc/error.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -92,6 +92,6 @@
     { "directive not implemented",          RTEMS_NOT_IMPLEMENTED, },
     { "RTEMS inconsistency detected",       RTEMS_INTERNAL_ERROR, },
-    { "internal multiprocessing only",      RTEMS_PROXY_BLOCKING, },
     { "could not get enough memory",        RTEMS_NO_MEMORY, },
+    { "internal multiprocessing only",      THREAD_STATUS_PROXY_BLOCKING, },
     { 0, 0, 0 },
 };
@@ -135,5 +135,5 @@
         local_errno = errno;
 
-    if (_Configuration_Is_multiprocessing())
+    if (_System_state_Is_multiprocessing)
         fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
     
Index: c/src/lib/libc/libio.c
===================================================================
--- c/src/lib/libc/libio.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libc/libio.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -15,6 +15,9 @@
 
 #include <fcntl.h>                      /* O_RDONLY, et.al. */
+#include <sys/fcntl.h>                      /* O_RDONLY, et.al. */
 #if defined(solaris2)
 #define O_NDELAY O_NONBLOCK
+#elif  defined(RTEMS_NEWLIB)
+#define O_NDELAY _FNBIO
 #endif
 #include <errno.h>
Index: c/src/lib/libc/newlibc.c
===================================================================
--- c/src/lib/libc/newlibc.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libc/newlibc.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -81,9 +81,10 @@
 
 
-rtems_extension
+rtems_boolean
 libc_create_hook(rtems_tcb *current_task,
                  rtems_tcb *creating_task)
 {
     MY_task_set_note(creating_task, LIBC_NOTEPAD, 0);
+    return TRUE;
 }
 
@@ -232,8 +233,8 @@
         memset(&libc_extension, 0, sizeof(libc_extension));
 
-        libc_extension.rtems_task_create  = libc_create_hook;
-        libc_extension.rtems_task_start   = libc_start_hook;
-        libc_extension.task_switch  = libc_switch_hook;
-        libc_extension.rtems_task_delete  = libc_delete_hook;
+        libc_extension.thread_create  = libc_create_hook;
+        libc_extension.thread_start   = libc_start_hook;
+        libc_extension.thread_switch  = libc_switch_hook;
+        libc_extension.thread_delete  = libc_delete_hook;
 
         rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'),
Index: c/src/lib/libc/support.c
===================================================================
--- c/src/lib/libc/support.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libc/support.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -14,6 +14,5 @@
  */
 
-#include <rtems/system.h>
-#include <rtems/thread.h>
+#include <rtems.h>
 
 void MY_task_set_note(
@@ -23,5 +22,9 @@
 )
 {
-  the_thread->RTEMS_API->Notepads[ notepad ] = note;
+  RTEMS_API_Control    *api;
+ 
+  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+  api->Notepads[ notepad ] = note;
 }
 
@@ -32,5 +35,9 @@
 )
 {
-  return the_thread->RTEMS_API->Notepads[ notepad ];
+  RTEMS_API_Control    *api;
+ 
+  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
+
+  return api->Notepads[ notepad ];
 }
 
Index: c/src/lib/libcpu/powerpc/ppc403/clock/clock.c
===================================================================
--- c/src/lib/libcpu/powerpc/ppc403/clock/clock.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libcpu/powerpc/ppc403/clock/clock.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -34,4 +34,5 @@
 #include <bsp.h>
 #include <clockdrv.h>
+#include <rtems/libio.h>
 
 #include <stdlib.h>                     /* for atexit() */
@@ -43,30 +44,13 @@
 static rtems_boolean auto_restart;
 
-rtems_device_driver Clock_initialize(
-  rtems_device_major_number major,
-  rtems_device_minor_number minor,
-  void *pargp,
-  rtems_id tid,
-  rtems_unsigned32 *rval
-)
-{
-    Install_clock(Clock_isr);
-}
-
-
-void
-ReInstall_clock(rtems_isr_entry new_clock_isr)
-{
-    rtems_isr_entry previous_isr;
-    rtems_unsigned32 isrlevel = 0;
-
-    rtems_interrupt_disable(isrlevel);
-    
-    rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT,
-			  &previous_isr);
-
-    rtems_interrupt_enable(isrlevel);
-}
-
+void Clock_exit( void );
+ 
+/*
+ * These are set by clock driver during its init
+ */
+ 
+rtems_device_major_number rtems_clock_major = ~0;
+rtems_device_minor_number rtems_clock_minor;
+ 
 static INLINE rtems_unsigned32 get_itimer(void)
 {
@@ -76,4 +60,67 @@
 
     return rc;
+}
+
+/*
+ *  ISR Handler
+ */
+ 
+rtems_isr
+Clock_isr(rtems_vector_number vector)
+{
+    if (!auto_restart)
+	{
+	    rtems_unsigned32 clicks_til_next_interrupt;
+	    rtems_unsigned32 itimer_value;
+
+	    /*
+	     * setup for next interrupt; making sure the new value is reasonably
+	     * in the future.... in case we lost out on an interrupt somehow
+	     */
+
+	    itimer_value = get_itimer();
+	    tick_time += pit_value;
+
+	    /*
+	     * how far away is next interrupt *really*
+	     * It may be a long time; this subtraction works even if
+	     * Clock_clicks_interrupt < Clock_clicks_low_order via
+	     * the miracle of unsigned math.
+	     */
+	    clicks_til_next_interrupt = tick_time - itimer_value;
+
+	    /*
+	     * If it is too soon then bump it up.
+	     * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small.
+	     * But setting it low is useful for debug, so...
+	     */
+
+	    if (clicks_til_next_interrupt < 400)
+		{
+		    tick_time = itimer_value + 1000;
+		    clicks_til_next_interrupt = 1000;
+		    /* XXX: count these! this should be rare */
+		}
+
+	    /*
+	     * If it is too late, that means we missed the interrupt somehow.
+	     * Rather than wait 35-50s for a wrap, we just fudge it here.
+	     */
+	    
+	    if (clicks_til_next_interrupt > pit_value)
+		{
+		    tick_time = itimer_value + 1000;
+		    clicks_til_next_interrupt = 1000;
+		    /* XXX: count these! this should never happen :-) */
+		}
+
+	    asm volatile ("mtpit %0" :: "r" (clicks_til_next_interrupt));
+	}
+
+    asm volatile ( "mttsr %0" :: "r" (0x08000000));
+
+    Clock_driver_ticks++;
+
+    rtems_clock_tick();
 }
 
@@ -132,63 +179,18 @@
 }
 
-
-rtems_isr
-Clock_isr(rtems_vector_number vector)
-{
-    if (!auto_restart)
-	{
-	    rtems_unsigned32 clicks_til_next_interrupt;
-	    rtems_unsigned32 itimer_value;
-
-	    /*
-	     * setup for next interrupt; making sure the new value is reasonably
-	     * in the future.... in case we lost out on an interrupt somehow
-	     */
-
-	    itimer_value = get_itimer();
-	    tick_time += pit_value;
-
-	    /*
-	     * how far away is next interrupt *really*
-	     * It may be a long time; this subtraction works even if
-	     * Clock_clicks_interrupt < Clock_clicks_low_order via
-	     * the miracle of unsigned math.
-	     */
-	    clicks_til_next_interrupt = tick_time - itimer_value;
-
-	    /*
-	     * If it is too soon then bump it up.
-	     * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small.
-	     * But setting it low is useful for debug, so...
-	     */
-
-	    if (clicks_til_next_interrupt < 400)
-		{
-		    tick_time = itimer_value + 1000;
-		    clicks_til_next_interrupt = 1000;
-		    /* XXX: count these! this should be rare */
-		}
-
-	    /*
-	     * If it is too late, that means we missed the interrupt somehow.
-	     * Rather than wait 35-50s for a wrap, we just fudge it here.
-	     */
-	    
-	    if (clicks_til_next_interrupt > pit_value)
-		{
-		    tick_time = itimer_value + 1000;
-		    clicks_til_next_interrupt = 1000;
-		    /* XXX: count these! this should never happen :-) */
-		}
-
-	    asm volatile ("mtpit %0" :: "r" (clicks_til_next_interrupt));
-	}
-
-    asm volatile ( "mttsr %0" :: "r" (0x08000000));
-
-    Clock_driver_ticks++;
-
-    rtems_clock_tick();
-}
+void
+ReInstall_clock(rtems_isr_entry new_clock_isr)
+{
+    rtems_isr_entry previous_isr;
+    rtems_unsigned32 isrlevel = 0;
+
+    rtems_interrupt_disable(isrlevel);
+    
+    rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT,
+			  &previous_isr);
+
+    rtems_interrupt_enable(isrlevel);
+}
+
 
 /*
@@ -214,2 +216,49 @@
 }
 
+rtems_device_driver Clock_initialize(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+  Install_clock( Clock_isr );
+ 
+  /*
+   * make major/minor avail to others such as shared memory driver
+   */
+ 
+  rtems_clock_major = major;
+  rtems_clock_minor = minor;
+ 
+  return RTEMS_SUCCESSFUL;
+}
+ 
+rtems_device_driver Clock_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void *pargp
+)
+{
+    rtems_libio_ioctl_args_t *args = pargp;
+ 
+    if (args == 0)
+        goto done;
+ 
+    /*
+     * This is hokey, but until we get a defined interface
+     * to do this, it will just be this simple...
+     */
+ 
+    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
+    {
+        Clock_isr(PPC_IRQ_PIT);
+    }
+    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
+    {
+        ReInstall_clock(args->buffer);
+    }
+ 
+done:
+    return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libcpu/powerpc/ppc403/console/console.c
===================================================================
--- c/src/lib/libcpu/powerpc/ppc403/console/console.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libcpu/powerpc/ppc403/console/console.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -32,7 +32,6 @@
 #define NO_BSP_INIT
 
-#include <rtems.h>
-#include "console.h"
-#include "bsp.h"
+#include <bsp.h>
+#include <rtems/libio.h>
 
 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
@@ -140,9 +139,8 @@
   rtems_device_major_number  major,
   rtems_device_minor_number  minor,
-  void                      *arg,
-  rtems_id                   self,
-  rtems_unsigned32          *status
-)
-{
+  void                      *arg
+)
+{
+  rtems_status_code status;
   register unsigned tmp;
 
@@ -165,5 +163,14 @@
   port->SPHS = (HSRDsr | HSRCts);
 
-  *status = RTEMS_SUCCESSFUL;
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+ 
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+ 
+  return RTEMS_SUCCESSFUL;
 }
 
@@ -281,47 +288,102 @@
 
 /*
- * __read  -- read bytes from the serial port. Ignore fd, since
- *            we only have stdin.
- */
-
-int __read(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i = 0;
-
-  for (i = 0; i < nbytes; i++) {
-    *(buf + i) = inbyte();
-    if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
-      (*(buf + i++)) = '\n';
-      (*(buf + i)) = 0;
+ *  Open entry point
+ */
+ 
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ *  Close entry point
+ */
+ 
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+ 
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+ 
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      buffer[ count ]  = 0;
       break;
     }
   }
-  return (i);
-}
-
-/*
- * __write -- write bytes to the serial port. Ignore fd, since
- *            stdout and stderr are the same. Since we have no filesystem,
- *            open will only return an error.
- */
-
-int __write(
-  int fd,
-  char *buf,
-  int nbytes
-)
-{
-  int i;
-
-  for (i = 0; i < nbytes; i++) {
-    if (*(buf + i) == '\n') {
-      outbyte ('\r');
-    }
-    outbyte (*(buf + i));
+ 
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+ 
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+ 
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+ 
+  rw_args = (rtems_libio_rw_args_t *) arg;
+ 
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+ 
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
+    }
+    outbyte( buffer[ count ] );
   }
-  return (nbytes);
-}
+  return maximum;
+}
+ 
+/*
+ *  IO Control entry point
+ */
+ 
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
Index: c/src/lib/libmisc/error/error.c
===================================================================
--- c/src/lib/libmisc/error/error.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/error/error.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -92,6 +92,6 @@
     { "directive not implemented",          RTEMS_NOT_IMPLEMENTED, },
     { "RTEMS inconsistency detected",       RTEMS_INTERNAL_ERROR, },
-    { "internal multiprocessing only",      RTEMS_PROXY_BLOCKING, },
     { "could not get enough memory",        RTEMS_NO_MEMORY, },
+    { "internal multiprocessing only",      THREAD_STATUS_PROXY_BLOCKING, },
     { 0, 0, 0 },
 };
@@ -135,5 +135,5 @@
         local_errno = errno;
 
-    if (_Configuration_Is_multiprocessing())
+    if (_System_state_Is_multiprocessing)
         fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
     
Index: c/src/lib/libmisc/monitor/mon-dname.c
===================================================================
--- c/src/lib/libmisc/monitor/mon-dname.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/monitor/mon-dname.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -58,5 +58,6 @@
     rtems_driver_name_t    *np = 0;
 
-    for (np = table + n ; n<RTEMS_MAX_DRIVER_NAMES; n++, np++)
+/* XXX should we be using _IO_Number_of_devices */
+    for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
         if (np->device_name)
             goto done;
Index: c/src/lib/libmisc/monitor/mon-extension.c
===================================================================
--- c/src/lib/libmisc/monitor/mon-extension.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/monitor/mon-extension.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -23,18 +23,18 @@
 
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->create,
-                                            e->rtems_task_create);
+                                            e->thread_create);
 
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->start,
-                                            e->rtems_task_start);
+                                            e->thread_start);
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->restart,
-                                            e->rtems_task_restart);
+                                            e->thread_restart);
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->delete,
-                                            e->rtems_task_delete);
+                                            e->thread_delete);
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->tswitch,
-                                            e->task_switch);
+                                            e->thread_switch);
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->begin,
-                                            e->task_begin);
+                                            e->thread_begin);
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->exitted,
-                                            e->task_exitted);
+                                            e->thread_exitted);
     rtems_monitor_symbol_canonical_by_value(&canonical_extension->fatal,
                                             e->fatal);
Index: c/src/lib/libmisc/monitor/mon-object.c
===================================================================
--- c/src/lib/libmisc/monitor/mon-object.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/monitor/mon-object.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -93,5 +93,8 @@
     },
     { RTEMS_OBJECT_DNAME,
-      (void *) &rtems_driver_name_table[0],
+      /* XXX now that the driver name table is allocated from the */
+      /* XXX Workspace, this does not work */
+      (void *) 0,
+      /* (void *) _IO_Driver_name_table, */
       sizeof(rtems_monitor_dname_t),
       (rtems_monitor_object_next_fn)        rtems_monitor_dname_next,
Index: c/src/lib/libmisc/monitor/mon-server.c
===================================================================
--- c/src/lib/libmisc/monitor/mon-server.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/monitor/mon-server.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -220,5 +220,5 @@
     rtems_status_code status;
     
-    if (_Configuration_Is_multiprocessing()    &&
+    if (_System_state_Is_multiprocessing    &&
         (_Configuration_MP_table->maximum_nodes > 1))
     {
Index: c/src/lib/libmisc/monitor/mon-task.c
===================================================================
--- c/src/lib/libmisc/monitor/mon-task.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/monitor/mon-task.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -20,4 +20,7 @@
 {
     Thread_Control       *rtems_thread = (Thread_Control *) thread_void;
+    RTEMS_API_Control    *api;
+
+    api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
     
     canonical_task->entry = rtems_thread->Start.entry_point;
@@ -28,9 +31,16 @@
     canonical_task->state = rtems_thread->current_state;
     canonical_task->wait_id = rtems_thread->Wait.id;
-    canonical_task->events = rtems_thread->RTEMS_API->pending_events;
-    canonical_task->modes = rtems_thread->current_modes;
-    canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */;
-    (void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad));
+    canonical_task->events = api->pending_events;
+
+/* XXX modes and attributes only exist in the RTEMS API .. */
+/* XXX not directly in the core thread.. they will have to be derived */
+/* XXX if they are important enough to include anymore.   */
+    canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */
+    canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */;
+    (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad));
+/* XXX more to fix */
+/*
     (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
+*/
 }
 
Index: c/src/lib/libmisc/stackchk/check.c
===================================================================
--- c/src/lib/libmisc/stackchk/check.c	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/stackchk/check.c	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -19,16 +19,7 @@
  */
 
-#include <rtems/system.h>
-#include <rtems/extension.h>
-#include <rtems/fatal.h>
-#include <rtems/heap.h>
-#include <rtems/stack.h>
-#include <rtems/thread.h>
-#ifdef XXX_RTEMS_H_FIXED
-#include <bsp.h>
-#else
-#include <rtems/config.h>
+#include <rtems.h>
+
 extern rtems_configuration_table BSP_Configuration;
-#endif
 
 #include <assert.h>
@@ -57,4 +48,5 @@
   0,                                /* rtems_task_delete  */
   Stack_check_Switch_extension,     /* task_switch  */
+  0,                                /* task_post_switch  */
   Stack_check_Begin_extension,      /* task_begin   */
   0,                                /* task_exitted */
@@ -134,7 +126,11 @@
 void Stack_check_Initialize( void )
 {
-  rtems_status_code status;
-  Objects_Id   id_ignored;
-  unsigned32  *p;
+  rtems_status_code    status;
+  Objects_Id           id_ignored;
+  unsigned32          *p;
+  unsigned32           i;
+  unsigned32           class_index;
+  Thread_Control      *the_thread;
+  Objects_Information *information;
 
   if (stack_check_initialized)
@@ -172,8 +168,29 @@
    */
 
+  /* XXX
+   *
+   *  Technically this has not been done for any task created before this
+   *  happened.  So just run through them and fix the situation.
+   */
+#if 0
   if (_Thread_Executing)
   {
       Stack_check_Create_extension(_Thread_Executing, _Thread_Executing);
   }
+#endif
+
+#if 0
+  for ( class_index = OBJECTS_CLASSES_FIRST ;
+        class_index <= OBJECTS_CLASSES_LAST ;
+        class_index++ ) {
+    information = _Objects_Information_table[ class_index ];
+    if ( information && information->is_thread ) {
+      for ( i=1 ; i <= information->maximum ; i++ ) {
+        the_thread = (Thread_Control *)information->local_table[ i ];
+        Stack_check_Create_extension( the_thread, the_thread );
+      }
+    }
+  }
+#endif
 
   /*
@@ -198,11 +215,13 @@
  */
 
-void Stack_check_Create_extension(
+boolean Stack_check_Create_extension(
   Thread_Control *running,
   Thread_Control *the_thread
 )
 {
-    if (the_thread && (the_thread != _Thread_Executing))
+    if (the_thread /* XXX && (the_thread != _Thread_Executing) */ )
         stack_check_dope_stack(&the_thread->Start.Initial_stack);
+
+    return TRUE;
 }
 
Index: c/src/lib/libmisc/stackchk/internal.h
===================================================================
--- c/src/lib/libmisc/stackchk/internal.h	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/libmisc/stackchk/internal.h	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -51,5 +51,5 @@
  */
 
-void Stack_check_Create_extension(
+boolean Stack_check_Create_extension(
   Thread_Control *running,
   Thread_Control *the_thread
Index: c/src/lib/start/i960/start.s
===================================================================
--- c/src/lib/start/i960/start.s	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/start/i960/start.s	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -81,5 +81,6 @@
         ldconst 0,g0
         ldconst 0,g1
-        call    _bsp_start
+        ldconst 0,g2
+        call    _main
         ret
 
Index: c/src/lib/start/m68k/start.s
===================================================================
--- c/src/lib/start/m68k/start.s	(revision 7f6a24abdd1793e394e4d5d49de1f4ca0e00297a)
+++ c/src/lib/start/m68k/start.s	(revision 3a4ae6c210bcc37754767966f1128ae23c77b6af)
@@ -98,5 +98,12 @@
 #endif
 
-        jsr     SYM (bsp_start)
+
+        movel   #0,a7@-               | push environp
+        movel   #0,a7@-               | push argv
+        movel   #0,a7@-               | push argc
+
+        jsr     SYM (main)
+        addl    #12,a7
+
 #if ( M68K_HAS_SEPARATE_STACKS == 1 )
         move.l  SYM (initial_isp),a0
