about summary refs log tree commit diff
path: root/sysdeps/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/standalone')
-rw-r--r--sysdeps/standalone/Dist2
-rw-r--r--sysdeps/standalone/Subdirs4
-rw-r--r--sysdeps/standalone/brk.c65
-rw-r--r--sysdeps/standalone/close.c44
-rw-r--r--sysdeps/standalone/dirstream.h43
-rw-r--r--sysdeps/standalone/filedesc.h48
-rw-r--r--sysdeps/standalone/i386/Dist1
-rw-r--r--sysdeps/standalone/i386/force_cpu386/Dist1
-rw-r--r--sysdeps/standalone/i386/force_cpu386/Makefile24
-rw-r--r--sysdeps/standalone/i386/force_cpu386/_exit.c47
-rw-r--r--sysdeps/standalone/i386/force_cpu386/brdinit.c44
-rw-r--r--sysdeps/standalone/i386/force_cpu386/console.c163
-rw-r--r--sysdeps/standalone/i386/force_cpu386/strtsupp.S89
-rw-r--r--sysdeps/standalone/i386/force_cpu386/target.ld59
-rw-r--r--sysdeps/standalone/i386/i386.h327
-rw-r--r--sysdeps/standalone/i386/start.S323
-rw-r--r--sysdeps/standalone/i960/Dist1
-rw-r--r--sysdeps/standalone/i960/i960ca.h207
-rw-r--r--sysdeps/standalone/i960/nindy960/Makefile23
-rw-r--r--sysdeps/standalone/i960/nindy960/_exit.c55
-rw-r--r--sysdeps/standalone/i960/nindy960/brdinit.c66
-rw-r--r--sysdeps/standalone/i960/nindy960/console.c76
-rw-r--r--sysdeps/standalone/i960/start.S137
-rw-r--r--sysdeps/standalone/m68k/m68020/Dist1
-rw-r--r--sysdeps/standalone/m68k/m68020/m68020.h88
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme135/Implies2
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme136/Dist1
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme136/Makefile22
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme136/_exit.c49
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme136/brdinit.c53
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme136/console.c101
-rw-r--r--sysdeps/standalone/m68k/m68020/mvme136/mvme136.ld62
-rw-r--r--sysdeps/standalone/m68k/m68020/start.S155
-rw-r--r--sysdeps/standalone/open.c122
-rw-r--r--sysdeps/standalone/read.c87
-rw-r--r--sysdeps/standalone/standalone.h32
-rw-r--r--sysdeps/standalone/stdio_lim.h27
-rw-r--r--sysdeps/standalone/write.c74
38 files changed, 2725 insertions, 0 deletions
diff --git a/sysdeps/standalone/Dist b/sysdeps/standalone/Dist
new file mode 100644
index 0000000000..b6b12b709a
--- /dev/null
+++ b/sysdeps/standalone/Dist
@@ -0,0 +1,2 @@
+filedesc.h
+standalone.h
diff --git a/sysdeps/standalone/Subdirs b/sysdeps/standalone/Subdirs
new file mode 100644
index 0000000000..4125ae86db
--- /dev/null
+++ b/sysdeps/standalone/Subdirs
@@ -0,0 +1,4 @@
+# The `bare' subdirectory defines some structure for a target-specific
+# library of functions which are actually implemented in
+# sysdeps/standalone/CPU/TARGET.
+bare
diff --git a/sysdeps/standalone/brk.c b/sysdeps/standalone/brk.c
new file mode 100644
index 0000000000..67fbf771a0
--- /dev/null
+++ b/sysdeps/standalone/brk.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <stdlib.h>
+
+PTR __curbrk;
+PTR __rorig;
+PTR __rlimit;
+
+int
+DEFUN(__brk, (inaddr), PTR inaddr)
+{
+
+  if ( ( (void *)inaddr > (void *)__rlimit ) || 
+                        ( (void *)inaddr < (void *)__rorig ) ) 
+    return -1;
+
+  __curbrk = inaddr;
+  return 0;
+}
+
+/* Initialization Code for Memory Allocation */
+
+PTR __C_heap_start;
+int __C_heap_size;
+ 
+#ifdef HAVE_GNU_LD
+static
+#endif
+void
+DEFUN(__NONE_set_memvals, (argc, argv, envp),
+      int argc AND char **argv AND char **envp)
+{
+ 
+  __rorig  = 
+  __curbrk = __C_heap_start;
+  __rlimit = __curbrk + __C_heap_size;
+
+  (void) &__NONE_set_memvals;    /* Avoid "defined but not used" warning.  */
+}
+ 
+#ifdef  HAVE_GNU_LD
+text_set_element (__libc_subinit, __NONE_set_memvals);
+#endif
+
+weak_alias (__brk, brk)
diff --git a/sysdeps/standalone/close.c b/sysdeps/standalone/close.c
new file mode 100644
index 0000000000..59b607305f
--- /dev/null
+++ b/sysdeps/standalone/close.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <stdio_lim.h>
+#include "filedesc.h"
+
+/* Close the file descriptor FD.  */
+int
+DEFUN(__close, (fd), int fd)
+{
+  if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use )
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  __FD_Table[ fd ].in_use = 0;
+  return 0;
+}
+
+
+weak_alias (__close, close)
diff --git a/sysdeps/standalone/dirstream.h b/sysdeps/standalone/dirstream.h
new file mode 100644
index 0000000000..20c4922fb9
--- /dev/null
+++ b/sysdeps/standalone/dirstream.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef	_DIRSTREAM_H
+
+#define	_DIRSTREAM_H	1
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Directory stream type.
+
+   The miscellaneous Unix `readdir' implementations read directory data
+   into a buffer and fill in a `struct dirent' copy in the `DIR' object. */
+
+typedef struct
+  {
+    int __fd;			/* File descriptor.  */
+
+    char *__data;		/* Directory block.  */
+    size_t __allocation;	/* Space allocated for the block.  */
+    size_t __offset;		/* Current offset into the block.  */
+    size_t __size;		/* Total valid data in the block.  */
+
+    struct dirent __entry;	/* Returned by `readdir'.  */
+  } DIR;
+
+#endif	/* dirstream.h */
diff --git a/sysdeps/standalone/filedesc.h b/sysdeps/standalone/filedesc.h
new file mode 100644
index 0000000000..bf3b6a9f0c
--- /dev/null
+++ b/sysdeps/standalone/filedesc.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*
+ *  This is the file descriptor used by the no OS implementation
+ *  of __open, __read, __write, and __close.
+ */
+
+#ifndef __FILEDESC_h
+#define __FILEDESC_h
+
+#include <stdio_lim.h>
+
+#ifndef __DECLARE_FILE_DESCRIPTORS__
+#define FILEDESC_EXTERN extern
+#else
+#define FILEDESC_EXTERN 
+#endif
+
+typedef struct {
+  int  in_use;         /* 1 if in use, 0 otherwise */
+  int  flags;          /* Flags from open */
+}   __no_os_file_descriptor;
+
+#define __FD_Is_valid( _fd ) \
+  ( (_fd) >= 0 && (_fd) < FOPEN_MAX )
+
+FILEDESC_EXTERN __no_os_file_descriptor __FD_Table[ FOPEN_MAX ];
+
+#endif
diff --git a/sysdeps/standalone/i386/Dist b/sysdeps/standalone/i386/Dist
new file mode 100644
index 0000000000..98d13be9af
--- /dev/null
+++ b/sysdeps/standalone/i386/Dist
@@ -0,0 +1 @@
+i386.h
diff --git a/sysdeps/standalone/i386/force_cpu386/Dist b/sysdeps/standalone/i386/force_cpu386/Dist
new file mode 100644
index 0000000000..8b7b09e10a
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/Dist
@@ -0,0 +1 @@
+target.ld
diff --git a/sysdeps/standalone/i386/force_cpu386/Makefile b/sysdeps/standalone/i386/force_cpu386/Makefile
new file mode 100644
index 0000000000..8483724ee3
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/Makefile
@@ -0,0 +1,24 @@
+# Copyright (C) 1994 Free Software Foundation, Inc.
+# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+#   On-Line Applications Research Corporation.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License
+# as published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+ifeq (bare,$(subdir))
+install-others += $(libdir)/force_cpu386.ld
+$(libdir)/force_cpu386.ld: $(sysdep_dir)/standalone/i386/target.ld
+	$(do-install)
+endif
diff --git a/sysdeps/standalone/i386/force_cpu386/_exit.c b/sysdeps/standalone/i386/force_cpu386/_exit.c
new file mode 100644
index 0000000000..011bb8bda9
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/_exit.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+/* This returns control to FORCEbug. */
+
+void DEFUN_VOID(Bsp_cleanup);
+
+/* The function `_exit' should take a status argument and simply
+   terminate program execution, using the low-order 8 bits of the
+   given integer as status.  */
+
+__NORETURN void
+DEFUN(_exit, (status), int status)
+{
+  /* status is ignored */
+  Bsp_cleanup();
+}
+
+#ifdef	 HAVE_GNU_LD
+
+#include <gnu-stabs.h>
+
+stub_warning(_exit);
+
+#endif	/* GNU stabs.  */
diff --git a/sysdeps/standalone/i386/force_cpu386/brdinit.c b/sysdeps/standalone/i386/force_cpu386/brdinit.c
new file mode 100644
index 0000000000..0d27218121
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/brdinit.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <standalone.h>
+#include "i386.h"
+
+/*  _Board_Initialize()
+
+This routine initializes the FORCE CPU386 board.  */
+
+void DEFUN_VOID(_Console_Initialize);
+
+void 
+DEFUN_VOID(_Board_Initialize)
+{
+  /*
+   *  FORCE documentation incorrectly states that the bus request
+   *  level is initialized to 3.  It is actually initialized by
+   *  FORCEbug to 0.
+   */
+ 
+  outport_byte( 0x00, 0x3f );      /* resets VMEbus request level */
+ 
+  _Console_Initialize();
+}
diff --git a/sysdeps/standalone/i386/force_cpu386/console.c b/sysdeps/standalone/i386/force_cpu386/console.c
new file mode 100644
index 0000000000..5d56f768ea
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/console.c
@@ -0,0 +1,163 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <standalone.h>
+#include "i386.h"
+
+/* Console IO routines for a FORCE CPU386 board. */
+
+/* Force CPU/386 specific IO addressing
+ *
+ * The following determines whether Port B or the Console should
+ * be used for console I/O.  Setting ONE (and only ONE) of these to 1
+ * enables I/O on that port.
+ * 
+ *     PORT A - DUSCC MC68562 Channel A  (*** not supported here ***)
+ *     PORT B - DUSCC MC68562 Channel B
+ *     PORT C - MFP MC68901 Channel      (*** FORCEbug console ***)
+ */
+
+#define PORTB         1               /* use port b as console */
+#define PORTC         0               /* use console port as console */
+
+#if ( PORTB == 1 )
+#define TX_STATUS     0x1b6           /* DUSCC General Status Register */
+#define RX_STATUS     0x1b6           /* DUSCC General Status Register */
+#define TX_BUFFER     0x1e0           /* DUSCC Transmitter Channel B */
+#define RX_BUFFER     0x1e8           /* DUSCC Receiver Channel B */
+#define Is_tx_ready( _status ) ( (_status) & 0x20 )
+#define Is_rx_ready( _status ) ( (_status) & 0x10 )
+#endif
+ 
+#if ( PORTC == 1 )
+#define TX_STATUS     0x12c           /* MFP Transmit Status Register */
+#define RX_STATUS     0x12a           /* MFP Receive Status Register */
+#define TX_BUFFER     0x12e           /* MFP Transmitter Channel  */
+#define RX_BUFFER     0x12e           /* MFP Receiver Channel  */
+#define Is_tx_ready( _status ) ( (_status) & 0x80 )
+#define Is_rx_ready( _status ) ( (_status) & 0x80 )
+#endif
+   
+/* _Console_Initialize
+
+On the Force board the console require some initialization. */
+
+void
+DEFUN_VOID(_Console_Initialize)
+{
+  register unsigned8 ignored;
+
+  /* FORCE technical support mentioned that it may be necessary to
+     read the DUSCC RX_BUFFER port four times to remove all junk.
+     This code is a little more paranoid.  */
+ 
+  inport_byte( RX_BUFFER, ignored );
+  inport_byte( RX_BUFFER, ignored );
+  inport_byte( RX_BUFFER, ignored );
+  inport_byte( RX_BUFFER, ignored );
+  inport_byte( RX_BUFFER, ignored );
+}
+
+/* Miscellaneous support for console IO */
+
+static inline int _Force386_is_rx_ready()
+{
+  register unsigned8 status;
+
+  inport_byte( RX_STATUS, status );
+
+  if ( Is_rx_ready( status ) ) return 1;
+  else                         return 0;
+}
+ 
+static inline int _Force386_is_tx_ready()
+{
+  register unsigned8 status;
+
+  inport_byte( TX_STATUS, status );
+
+  if ( Is_tx_ready( status ) ) return 1;
+  else                         return 0;
+}
+
+
+static inline int _Force386_read_data()
+{
+  register unsigned8 ch;
+
+#if ( PORTB == 1 )
+    /* Force example code resets the Channel B Receiver here.
+     * It appears to cause XON's to be lost.
+     */  
+
+     /* outport_byte( RX_STATUS, 0x10 );  */
+#endif
+
+  inport_byte( RX_BUFFER, ch );
+
+  return ch;
+}
+
+/* _Console_Putc
+
+This routine transmits a character.  It supports XON/XOFF flow control.  */
+
+#define XON             0x11            /* control-Q */
+#define XOFF            0x13            /* control-S */
+
+int
+DEFUN( _Console_Putc, (ch), char ch )
+{
+  register unsigned8 inch;
+
+  while ( !_Force386_is_tx_ready() );
+
+  while ( _Force386_is_rx_ready() == 1 ) {      /* must be an XOFF */
+    inch = _Force386_read_data();
+    if ( inch == XOFF )
+      do {
+        while ( _Force386_is_rx_ready() == 0 );
+        inch = _Force386_read_data();
+      } while ( inch != XON );
+  }
+ 
+  outport_byte( TX_BUFFER, ch );
+  return( 0 );
+}
+
+/* _Console_Getc
+
+This routine reads a character from the UART and returns it. */
+
+int
+DEFUN( _Console_Getc, (poll), int poll )
+{
+  if ( poll ) {
+    if ( !_Force386_is_rx_ready() )
+      return -1;
+    else
+      return _Force386_read_data();
+  } else {
+    while ( !_Force386_is_rx_ready() );
+    return _Force386_read_data();
+  }
+}
diff --git a/sysdeps/standalone/i386/force_cpu386/strtsupp.S b/sysdeps/standalone/i386/force_cpu386/strtsupp.S
new file mode 100644
index 0000000000..6b78a8c343
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/strtsupp.S
@@ -0,0 +1,89 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*  This file assists the board independent startup code by
+ *  loading the proper segment register values.  The values
+ *  loaded are dependent on the FORCEBUG.  
+ *
+ *  NOTE:  No stack has been established when this routine
+ *         is invoked.  It returns by jumping back to the start code.
+ *
+ */
+
+/*
+ *  FORCEBUG loads us into a virtual address space which 
+ *  really starts at PHYSICAL_ADDRESS_BASE.  
+ *  
+ */
+
+.set PHYSICAL_ADDRESS_BASE,    0x00002000
+
+/*
+ *  At reset time, FORCEBUG normally has the segment selectors preloaded.   
+ *  If a human resets the instruction pointer, this will not have occurred.
+ *  However, no guarantee can be made of the other registers if cs:ip was 
+ *  modified to restart the program.  Because of this, the BSP reloads all 
+ *  segment registers (except cs) with the values they have following 
+ *  a reset.  
+ */
+
+
+.set RESET_SS, 0x40        # initial value of stack segment register
+.set RESET_DS, 0x40        # initial value of data segment register
+.set RESET_ES, 0x40        # initial value of extra segment register
+.set RESET_FS, 0x40        # initial value of "f" segment register
+.set RESET_GS, 0x30        # initial value of "g" segment register 
+
+
+#define LOAD_SEGMENTS(_value,_segreg) \
+        movw      $_value##,%ax ;  \
+        movw      %ax,##_segreg
+
+    
+        .global  _load_segments
+
+        .global   _establish_stack
+
+_load_segments:
+
+        LOAD_SEGMENTS( RESET_SS, %ss )
+        LOAD_SEGMENTS( RESET_DS, %ds )
+        LOAD_SEGMENTS( RESET_ES, %es )
+        LOAD_SEGMENTS( RESET_FS, %fs )
+        LOAD_SEGMENTS( RESET_GS, %gs )
+
+        jmp     _establish_stack        # return to the bsp entry code
+
+        .global  _return_to_monitor
+_return_to_monitor:
+
+        movb    $0,%al
+        int     $0x20                   # restart FORCEbug
+        jmp     start                   # FORCEbug does not reset PC
+
+        .data
+
+        .global _Do_Load_IDT
+_Do_Load_IDT:   .byte 1
+
+        .global _Do_Load_GDT
+_Do_Load_GDT:   .byte 0
+
diff --git a/sysdeps/standalone/i386/force_cpu386/target.ld b/sysdeps/standalone/i386/force_cpu386/target.ld
new file mode 100644
index 0000000000..056da10d55
--- /dev/null
+++ b/sysdeps/standalone/i386/force_cpu386/target.ld
@@ -0,0 +1,59 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* This file contains directives for the GNU linker which are specific
+to the FORCE CPU386 board.  */
+
+MEMORY 
+        {
+        ram : org = 0x0, l = 1M
+        }
+
+/* This value is also when the space is allocated.  If you change
+this one, change the other one!!! */
+
+heap_size = 0x20000;
+
+SECTIONS
+{
+        .text 0x0 : 
+        {
+            _text_start = ABSOLUTE(.) ;
+            *(.text)
+            _etext = ALIGN( 0x10 ) ;
+        }
+        .data ADDR( .text ) + SIZEOF( .text ): 
+        {
+            _data_start = . ;
+            *(.data)
+            _edata = ALIGN( 0x10 ) ;
+        }
+        .bss ADDR( .data ) + SIZEOF( .data ): 
+        {
+            _bss_start = . ;
+            *(.bss)
+            *(COMMON)
+            heap_memory = .;
+            . += 0x20000;
+            _end = . ;
+            __end = . ;
+        }
+}
diff --git a/sysdeps/standalone/i386/i386.h b/sysdeps/standalone/i386/i386.h
new file mode 100644
index 0000000000..8302773709
--- /dev/null
+++ b/sysdeps/standalone/i386/i386.h
@@ -0,0 +1,327 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*  i386.h
+ *
+ *  This file contains macros which are used to access i80386 
+ *  registers which are not addressable by C.  This file contains
+ *  functions which are useful to those developing target 
+ *  specific support routines.
+ */
+
+#ifndef i386_h__
+#define i386_h__
+
+typedef unsigned char   unsigned8;
+typedef unsigned short  unsigned16;
+typedef unsigned int    unsigned32;
+
+#define disable_intr( isrlevel ) \
+  { (isrlevel) = 0; \
+    asm volatile ( "pushf ; \
+                    pop  %0 ; \
+                    cli   " \
+                    : "=r" ((isrlevel)) : "0" ((isrlevel)) ); \
+  }
+
+
+#define enable_intr( isrlevel ) \
+  { asm volatile ( "push %0 ; \
+                    popf " \
+                    : "=r" ((isrlevel)) : "0" ((isrlevel)) ); \
+  }
+
+#define delay( _microseconds ) \
+  { \
+    unsigned32 _counter; \
+    \
+    _counter = (_microseconds); \
+    \
+    asm volatile ( "0: nop;" \
+                   " mov %0,%0 ;" \
+                   " loop 0" : "=c" (_counter) \
+                                      : "0"  (_counter) \
+                 ); \
+    \
+  }
+
+/* segment access functions */
+
+static inline unsigned16 get_cs()
+{
+  register unsigned16 segment = 0;
+
+  asm volatile ( "movw %%cs,%0" : "=r" (segment) : "0" (segment) ); 
+
+  return segment;
+}
+
+static inline unsigned16 get_ds()
+{
+  register unsigned16 segment = 0;
+
+  asm volatile ( "movw %%ds,%0" : "=r" (segment) : "0" (segment) ); 
+
+  return segment;
+}
+
+static inline unsigned16 get_es()
+{
+  register unsigned16 segment = 0;
+
+  asm volatile ( "movw %%es,%0" : "=r" (segment) : "0" (segment) ); 
+
+  return segment;
+}
+
+static inline unsigned16 get_ss()
+{
+  register unsigned16 segment = 0;
+
+  asm volatile ( "movw %%ss,%0" : "=r" (segment) : "0" (segment) ); 
+
+  return segment;
+}
+
+static inline unsigned16 get_fs()
+{
+  register unsigned16 segment = 0;
+
+  asm volatile ( "movw %%fs,%0" : "=r" (segment) : "0" (segment) ); 
+
+  return segment;
+}
+
+static inline unsigned16 get_gs()
+{
+  register unsigned16 segment = 0;
+
+  asm volatile ( "movw %%gs,%0" : "=r" (segment) : "0" (segment) ); 
+
+  return segment;
+}
+
+/* i80x86 I/O instructions */
+
+#define outport_byte( _port, _value ) \
+   { register unsigned16 __port  = _port; \
+     register unsigned8  __value = _value; \
+     \
+     asm volatile ( "outb %0,%1" : "=a" (__value), "=d" (__port) \
+                                 : "0"   (__value), "1"  (__port) \
+                  ); \
+   }
+
+#define outport_word( _port, _value ) \
+   { register unsigned16 __port  = _port; \
+     register unsigned16 __value = _value; \
+     \
+     asm volatile ( "outw %0,%1" : "=a" (__value), "=d" (__port) \
+                                 : "0"   (__value), "1"  (__port) \
+                  ); \
+   }
+
+#define outport_long( _port, _value ) \
+   { register unsigned16 __port  = _port; \
+     register unsigned32 __value = _value; \
+     \
+     asm volatile ( "outl %0,%1" : "=a" (__value), "=d" (__port) \
+                                 : "0"   (__value), "1"  (__port) \
+                  ); \
+   }
+
+#define inport_byte( _port, _value ) \
+   { register unsigned16 __port  = _port; \
+     register unsigned8  __value = 0; \
+     \
+     asm volatile ( "inb %1,%0" : "=a" (__value), "=d" (__port) \
+                                : "0"   (__value), "1"  (__port) \
+                  ); \
+     _value = __value; \
+   }
+
+#define inport_word( _port, _value ) \
+   { register unsigned16 __port  = _port; \
+     register unsigned16 __value = 0; \
+     \
+     asm volatile ( "inw %1,%0" : "=a" (__value), "=d" (__port) \
+                                : "0"   (__value), "1"  (__port) \
+                  ); \
+     _value = __value; \
+   }
+
+#define inport_long( _port, _value ) \
+   { register unsigned16 __port  = _port; \
+     register unsigned32 __value = 0; \
+     \
+     asm volatile ( "inl %1,%0" : "=a" (__value), "=d" (__port) \
+                                : "0"   (__value), "1"  (__port) \
+                  ); \
+     _value = __value; \
+   }
+
+/* structures */
+
+/* See Chapter 5 - Memory Management in i386 manual */
+
+struct GDT_slot {
+  unsigned16 limit_0_15;
+  unsigned16 base_0_15;
+  unsigned8  base_16_23;
+  unsigned8  type_dt_dpl_p;
+  unsigned8  limit_16_19_granularity;
+  unsigned8  base_24_31;
+};
+
+/* See Chapter 9 - Exceptions and Interrupts in i386 manual 
+ *
+ *  NOTE: This is the IDT entry for interrupt gates ONLY.
+ */
+
+struct IDT_slot {
+  unsigned16 offset_0_15;
+  unsigned16 segment_selector;
+  unsigned8  reserved;
+  unsigned8  p_dpl;
+  unsigned16 offset_16_31;
+};
+
+struct DTR_load_save_format {
+  unsigned16 limit;
+  unsigned32 physical_address;
+};
+
+/* variables */
+
+extern struct IDT_slot Interrupt_descriptor_table[ 256 ];
+extern struct GDT_slot Global_descriptor_table[ 8192 ];
+
+/* functions */
+
+#ifdef CPU_INITIALIZE
+#define EXTERN
+#else
+#undef EXTERN
+#define EXTERN extern
+#endif
+
+void *Logical_to_physical(
+  unsigned16  segment,
+  void             *address
+);
+
+void *Physical_to_logical(
+  unsigned16  segment,
+  void             *address
+);
+
+/* complicated static inline functions */
+
+#define get_GDTR( _gdtr_address ) \
+  { \
+    void                        *_gdtr = (_gdtr_address); \
+    \
+    asm volatile( "sgdt   (%0)" : "=r" (_gdtr) : "0" (_gdtr) ); \
+  }
+
+#define get_GDT_slot( _gdtr_base, _segment, _slot_address ) \
+  { \
+    register unsigned32  _gdt_slot  = (_gdtr_base) + (_segment); \
+    register volatile void    *_slot      = (_slot_address); \
+    register unsigned32  _temporary = 0; \
+    \
+    asm volatile( "movl %%gs:(%0),%1 ; \
+                   movl %1,(%2) ; \
+                   movl %%gs:4(%0),%1 ; \
+                   movl %1,4(%2)"  \
+                     : "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
+                     : "0"  (_gdt_slot), "1"  (_temporary), "2"  (_slot) \
+                );  \
+  }
+
+#define set_GDT_slot( _gdtr_base, _segment, _slot_address ) \
+  { \
+    register unsigned32  _gdt_slot  = (_gdtr_base) + (_segment); \
+    register volatile void    *_slot      = (_slot_address); \
+    register unsigned32  _temporary = 0; \
+    \
+    asm volatile( "movl (%2),%1 ; \
+                   movl %1,%%gs:(%0) ; \
+                   movl 4(%2),%1 ; \
+                   movl %1,%%gs:4(%0) \
+                  " \
+                     : "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
+                     : "0"  (_gdt_slot), "1"  (_temporary), "2"  (_slot) \
+                );  \
+  }
+
+static inline void set_segment( 
+  unsigned16 segment, 
+  unsigned32 base,
+  unsigned32 limit 
+) 
+{ 
+  struct DTR_load_save_format  gdtr; 
+  volatile struct GDT_slot     Gdt_slot;
+  volatile struct GDT_slot    *gdt_slot = &Gdt_slot;
+  unsigned16             tmp_segment = 0;
+  unsigned32             limit_adjusted;
+ 
+  
+  /* load physical address of the GDT */
+
+  get_GDTR( &gdtr );
+ 
+  gdt_slot->type_dt_dpl_p  = 0x92;             /* present, dpl=0,      */
+                                               /* application=1,       */
+                                               /* type=data read/write */
+  gdt_slot->limit_16_19_granularity = 0x40;    /* 32 bit segment       */
+
+  limit_adjusted = limit;
+  if ( limit > 4095 ) {
+    gdt_slot->limit_16_19_granularity |= 0x80; /* set granularity bit */
+    limit_adjusted /= 4096;
+  } 
+ 
+  gdt_slot->limit_16_19_granularity |= (limit_adjusted >> 16) & 0xff;
+  gdt_slot->limit_0_15               = limit_adjusted & 0xffff;
+ 
+  gdt_slot->base_0_15  = base & 0xffff;
+  gdt_slot->base_16_23 = (base >> 16) & 0xff;
+  gdt_slot->base_24_31 = (base >> 24);
+ 
+  set_GDT_slot( gdtr.physical_address, segment, gdt_slot );
+
+  /* Now, reload all segment registers so the limit takes effect. */
+
+  asm volatile( "movw %%ds,%0 ; movw %0,%%ds
+                 movw %%es,%0 ; movw %0,%%es
+                 movw %%fs,%0 ; movw %0,%%fs
+                 movw %%gs,%0 ; movw %0,%%gs
+                 movw %%ss,%0 ; movw %0,%%ss"
+                   : "=r" (tmp_segment) 
+                   : "0"  (tmp_segment)
+              );
+                 
+}
+
+#endif
+/* end of include file */
diff --git a/sysdeps/standalone/i386/start.S b/sysdeps/standalone/i386/start.S
new file mode 100644
index 0000000000..8331a331c1
--- /dev/null
+++ b/sysdeps/standalone/i386/start.S
@@ -0,0 +1,323 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*  entry.s
+ *
+ *  This file contains the entry point for the application.
+ *  The name of this entry point is compiler dependent.
+ *  It jumps to the BSP which is responsible for performing
+ *  all initialization.
+ *
+ */
+
+        .data
+        .global  _Do_Load_IDT
+        .global  _Do_Load_GDT
+
+        .text
+	      .global  start                  # GNU default entry point
+        .global  _establish_stack
+
+        .global   _bsp_start
+        .global   _load_segments
+        .global   __exit
+
+start:
+        nop
+        cli                             # DISABLE INTERRUPTS!!!
+#
+#  Load the segment registers
+#
+#  NOTE: Upon return, gs will contain the segment descriptor for
+#        a segment which maps directly to all of physical memory.
+#
+        jmp     _load_segments          # load board dependent segments
+
+#
+#  Set up the stack
+#
+
+_establish_stack:
+
+        movl    $stack_end,%esp         # set stack pointer
+        movl    $stack_end,%ebp         # set base pointer
+
+#
+#  Zero out the BSS segment
+#
+zero_bss:
+        cld                             # make direction flag count up
+        movl    $_end,%ecx              # find end of .bss
+        movl    $_bss_start,%edi        # edi = beginning of .bss
+        subl    %edi,%ecx               # ecx = size of .bss in bytes
+        shrl    $2,%ecx                 # size of .bss in longs
+        xorl    %eax,%eax               # value to clear out memory
+        repne                           # while ecx != 0
+        stosl                           #   clear a long in the bss
+
+#
+#  Set the C heap information for malloc
+#
+        movl    $heap_size,___C_heap_size    # set ___C_heap_size
+        movl    $heap_memory,___C_heap_start # set ___C_heap_start
+
+#
+#  Copy the Global Descriptor Table to our space
+#
+
+        sgdt    _Original_GDTR          # save original GDT
+        movzwl  _Original_GDTR_limit,%ecx # size of GDT in bytes; limit 
+                                          #   is 8192 entries * 8 bytes per
+
+        # make ds:esi point to the original GDT
+
+        movl    _Original_GDTR_base,%esi
+        push    %ds                     # save ds
+        movw    %gs,%ax
+        movw    %ax,%ds 
+
+        # make es:edi point to the new (our copy) GDT
+        movl    $_Global_descriptor_table,%edi
+
+        rep
+        movsb                            # copy the GDT (ds:esi -> es:edi)
+
+        pop     %ds                      # restore ds
+      
+        # Build and load new contents of GDTR
+        movw    _Original_GDTR_limit,%ecx # set new limit
+        movw    %cx,_New_GDTR_limit
+
+        push    $_Global_descriptor_table
+        push    %es
+        call    _Logical_to_physical
+        addl    $6,%esp
+        movl    %eax,_New_GDTR_base      # set new base
+
+        cmpb    $0,_Do_Load_GDT          # Should the new GDT be loaded?
+        je      no_gdt_load              # NO, then branch
+        lgdt    _New_GDTR                # load the new GDT
+no_gdt_load:
+
+#
+#  Copy the Interrupt Descriptor Table to our space
+#
+
+        sidt    _Original_IDTR          # save original IDT
+        movzwl  _Original_IDTR_limit,%ecx # size of IDT in bytes; limit
+                                          #   is 256 entries * 8 bytes per
+ 
+
+        # make ds:esi point to the original IDT
+        movl    _Original_IDTR_base,%esi
+
+        push    %ds                     # save ds
+        movw    %gs,%ax
+        movw    %ax,%ds 
+
+        # make es:edi point to the new (our copy) IDT
+        movl    $_Interrupt_descriptor_table,%edi
+
+        rep
+        movsb                            # copy the IDT (ds:esi -> es:edi)
+        pop     %ds                      # restore ds
+
+        # Build and load new contents of IDTR
+        movw    _Original_IDTR_limit,%ecx # set new limit
+        movw    %cx,_New_IDTR_limit
+
+        push    $_Interrupt_descriptor_table
+        push    %es
+        call    _Logical_to_physical
+        addl    $6,%esp
+        movl    %eax,_New_IDTR_base      # set new base
+
+        cmpb    $0,_Do_Load_IDT          # Should the new IDT be loaded?
+        je      no_idt_load              # NO, then branch
+        lidt    _New_IDTR                # load the new IDT
+no_idt_load:
+
+#
+#  Initialize the i387.
+#
+#  Using the NO WAIT form of the instruction insures that if
+#  it is not present the board will not lock up or get an
+#  exception.
+#
+
+        fninit                           # MUST USE NO-WAIT FORM
+
+        call    __Board_Initialize       # initialize the board
+
+        pushl   $0                       # envp = NULL 
+        pushl   $0                       # argv = NULL 
+        pushl   $0                       # argc = NULL 
+        call    ___libc_init             # initialize the library and
+                                         #   call main
+        addl    $12,%esp
+ 
+        pushl   $0                       # argc = NULL 
+        call    __exit                   # call the Board specific exit
+        addl     $4,%esp
+
+#
+#  Clean up
+#
+
+
+        .global  _Bsp_cleanup
+
+        .global   _return_to_monitor
+
+_Bsp_cleanup:
+        cmpb    $0,_Do_Load_IDT          # Was the new IDT loaded?
+        je      no_idt_restore           # NO, then branch
+        lidt    _Original_IDTR           # restore the new IDT
+no_idt_restore:
+
+        cmpb    $0,_Do_Load_GDT          # Was the new GDT loaded?
+        je      no_gdt_restore           # NO, then branch
+        lgdt    _Original_GDTR           # restore the new GDT
+no_gdt_restore:
+        jmp     _return_to_monitor
+
+#
+#  void *Logical_to_physical( 
+#     rtems_unsigned16  segment,
+#     void             *address
+#  );
+#
+#  Returns thirty-two bit physical address for segment:address.
+#
+
+        .global  _Logical_to_physical
+
+.set SEGMENT_ARG, 4
+.set ADDRESS_ARG, 8
+
+_Logical_to_physical:
+
+        xorl    %eax,%eax                # clear eax
+        movzwl  SEGMENT_ARG(%esp),%ecx   # ecx = segment value
+        movl    $_Global_descriptor_table,%edx # edx = address of our GDT
+        addl    %ecx,%edx                # edx = address of desired entry
+        movb    7(%edx),%ah              # ah = base 31:24
+        movb    4(%edx),%al              # al = base 23:16
+        shll    $16,%eax                 # move ax into correct bits
+        movw    2(%edx),%ax              # ax = base 0:15
+        movl    ADDRESS_ARG(%esp),%ecx   # ecx = address to convert
+        addl    %eax,%ecx                # ecx = physical address equivalent
+        movl    %ecx,%eax                # eax = ecx
+        ret
+       
+#
+#  void *Physical_to_logical( 
+#     rtems_unsigned16  segment,
+#     void             *address
+#  );
+#
+#  Returns thirty-two bit physical address for segment:address.
+#
+
+        .global  _Physical_to_logical
+
+#.set SEGMENT_ARG, 4
+#.set ADDRESS_ARG, 8   -- use sets from above
+
+_Physical_to_logical:
+
+        xorl    %eax,%eax                # clear eax
+        movzwl  SEGMENT_ARG(%esp),%ecx   # ecx = segment value
+        movl    $_Global_descriptor_table,%edx # edx = address of our GDT
+        addl    %ecx,%edx                # edx = address of desired entry
+        movb    7(%edx),%ah              # ah = base 31:24
+        movb    4(%edx),%al              # al = base 23:16
+        shll    $16,%eax                 # move ax into correct bits
+        movw    2(%edx),%ax              # ax = base 0:15
+        movl    ADDRESS_ARG(%esp),%ecx   # ecx = address to convert
+        subl    %eax,%ecx                # ecx = logical address equivalent
+        movl    %ecx,%eax                # eax = ecx
+        ret
+       
+
+/*
+ *  Data Declarations.  Start with a macro which helps declare space.
+ */
+
+        .bss
+
+#define DECLARE_SPACE(_name,_space,_align) \
+          .globl   _name ; \
+          .align   _align ; \
+_name##:  .space _space
+
+#define DECLARE_LABEL(_name) \
+          .globl   _name ; \
+_name##:  
+
+#define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
+#define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
+#define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
+
+/*
+ *  Require environment stuff
+ */
+
+DECLARE_LABEL(_environ)
+DECLARE_PTR(environ)
+
+DECLARE_LABEL(_errno)
+DECLARE_U32(errno)
+
+/* 
+ *  Miscellaneous Variables used to restore the CPU state.
+ *
+ *  Start with a macro to declare the space for the contents of
+ *  a Descriptor Table register.
+ */
+
+#define DECLARE_DTR_SPACE(_name) \
+          .global   _name ; \
+          .align    4 ; \
+_name##:  ; \
+_name##_limit:  .space 2  ; \
+_name##_base:   .space 4
+
+DECLARE_SPACE(_Interrupt_descriptor_table,256*8,4)
+DECLARE_SPACE(_Global_descriptor_table,8192*8,4)
+
+DECLARE_DTR_SPACE(_Original_IDTR)
+DECLARE_DTR_SPACE(_New_IDTR)
+DECLARE_DTR_SPACE(_Original_GDTR)
+DECLARE_DTR_SPACE(_New_GDTR)
+
+DECLARE_SPACE(_Physical_base_of_ds,4,4)
+DECLARE_SPACE(_Physical_base_of_cs,4,4)
+
+/*
+ *  Stack Size and Space
+ */
+
+        .set stack_size, 0x20000
+
+DECLARE_SPACE(stack_memory,stack_size,4)
+DECLARE_LABEL(stack_end)
+
diff --git a/sysdeps/standalone/i960/Dist b/sysdeps/standalone/i960/Dist
new file mode 100644
index 0000000000..e1747ef91e
--- /dev/null
+++ b/sysdeps/standalone/i960/Dist
@@ -0,0 +1 @@
+i960ca.h
diff --git a/sysdeps/standalone/i960/i960ca.h b/sysdeps/standalone/i960/i960ca.h
new file mode 100644
index 0000000000..21012b4ccc
--- /dev/null
+++ b/sysdeps/standalone/i960/i960ca.h
@@ -0,0 +1,207 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* i960ca.h
+ *
+ *  This file contains macros which are used to access i80960CA 
+ *  registers which are not addressable by C.  The functions
+ *  in this file sould be useful to the developer of target 
+ *  specific code.
+ */
+
+#ifndef i960ca_h__
+#define i960ca_h__
+
+typedef unsigned char   unsigned8;
+typedef unsigned short  unsigned16;
+typedef unsigned int    unsigned32;
+
+/*
+ *  Intel i80960CA Processor Control Block
+ */
+ 
+struct i80960ca_prcb {
+  unsigned32          *fault_tbl;     /* fault table base address     */ 
+  struct i80960ca_ctltbl
+                      *control_tbl;   /* control table base address   */
+  unsigned32           initial_ac;    /* AC register initial value    */
+  unsigned32           fault_config;  /* fault configuration word     */ 
+  void                *intr_tbl;      /* interrupt table base address */
+  void                *sys_proc_tbl;  /* system procedure table       */ 
+                                      /*   base address               */ 
+  unsigned32           reserved;      /* reserved                     */ 
+  unsigned32          *intr_stack;    /* interrupt stack pointer      */ 
+  unsigned32           ins_cache_cfg; /* instruction cache            */ 
+                                      /*   configuration word         */ 
+  unsigned32           reg_cache_cfg; /* register cache               */ 
+                                      /*   configuration word         */ 
+};
+
+/*
+ *  Intel i80960CA Control Table
+ */
+
+struct i80960ca_ctltbl {
+                            /* Control Group 0 */
+  unsigned32       ipb0;              /* IP breakpoint 0 */
+  unsigned32       ipb1;              /* IP breakpoint 1 */
+  unsigned32       dab0;              /* data address breakpoint 0 */
+  unsigned32       dab1;              /* data address breakpoint 1 */
+                            /* Control Group 1 */
+  unsigned32       imap0;             /* interrupt map 0 */
+  unsigned32       imap1;             /* interrupt map 1 */
+  unsigned32       imap2;             /* interrupt map 2 */
+  unsigned32       icon;              /* interrupt control */
+                            /* Control Group 2 */
+  unsigned32       mcon0;             /* memory region 0 configuration */
+  unsigned32       mcon1;             /* memory region 1 configuration */
+  unsigned32       mcon2;             /* memory region 2 configuration */
+  unsigned32       mcon3;             /* memory region 3 configuration */
+                            /* Control Group 3 */
+  unsigned32       mcon4;             /* memory region 4 configuration */
+  unsigned32       mcon5;             /* memory region 5 configuration */
+  unsigned32       mcon6;             /* memory region 6 configuration */
+  unsigned32       mcon7;             /* memory region 7 configuration */
+                            /* Control Group 4 */
+  unsigned32       mcon8;             /* memory region 8 configuration */
+  unsigned32       mcon9;             /* memory region 9 configuration */
+  unsigned32       mcon10;            /* memory region 10 configuration */
+  unsigned32       mcon11;            /* memory region 11 configuration */
+                            /* Control Group 5 */
+  unsigned32       mcon12;            /* memory region 12 configuration */
+  unsigned32       mcon13;            /* memory region 13 configuration */
+  unsigned32       mcon14;            /* memory region 14 configuration */
+  unsigned32       mcon15;            /* memory region 15 configuration */
+                            /* Control Group 6 */
+  unsigned32       bpcon;             /* breakpoint control */
+  unsigned32       tc;                /* trace control */
+  unsigned32       bcon;              /* bus configuration control */
+  unsigned32       reserved;          /* reserved */
+};
+
+#define disable_intr( oldlevel ) \
+  { (oldlevel) = 0x1f0000; \
+    asm volatile ( "modpc   0,%1,%1" \
+                       : "=d" ((oldlevel)) \
+                       : "0"  ((oldlevel)) ); \
+  }
+
+#define enable_intr( oldlevel ) \
+  { unsigned32 _mask = 0x1f0000; \
+    asm volatile ( "modpc   0,%0,%1" \
+                       : "=d" (_mask), "=d" ((oldlevel)) \
+                       : "0"  (_mask), "1"  ((oldlevel)) ); \
+  }
+
+#define flash_intr( oldlevel ) \
+  { unsigned32 _mask = 0x1f0000; \
+    asm volatile ( "modpc   0,%0,%1 ; \
+                    mov     %0,%1 ; \
+                    modpc   0,%0,%1"  \
+                       : "=d" (_mask), "=d" ((oldlevel)) \
+                       : "0"  (_mask), "1"  ((oldlevel)) ); \
+  }
+
+#define atomic_modify( mask, addr, prev ) \
+ { register unsigned32  _mask = (mask); \
+   register unsigned32 *_addr = (unsigned32 *)(addr); \
+   asm volatile( "atmod  %0,%1,%1" \
+                  : "=d" (_addr), "=d" (_mask) \
+                  : "0"  (_addr), "1"  (_mask) ); \
+   (prev) = _mask; \
+ }
+   
+#define delay( microseconds ) \
+  { register unsigned32 _delay=(microseconds); \
+    register unsigned32 _tmp; \
+    asm volatile( "delay0: \
+                     remo      3,31,%0 ; \
+                     cmpo      0,%0 ; \
+                     subo      1,%1,%1 ; \
+                     cmpobne.t 0,%1,delay0 " \
+                  : "=d" (_tmp), "=d" (_delay) \
+                  : "0"  (_tmp), "1"  (_delay) ); \
+  }
+
+#define enable_tracing() \
+ { register unsigned32 _pc = 0x1; \
+   asm volatile( "modpc 0,%0,%0" : "=d" (_pc) : "0" (_pc) ); \
+ }
+
+#define unmask_intr( xint ) \
+ { register unsigned32 _mask= (1<<(xint)); \
+   asm volatile( "or sf1,%0,sf1" : "=d" (_mask) : "0" (_mask) ); \
+ }
+
+#define mask_intr( xint ) \
+ { register unsigned32 _mask= (1<<(xint)); \
+   asm volatile( "andnot %0,sf1,sf1" : "=d" (_mask) : "0" (_mask) ); \
+ }
+
+#define clear_intr( xint ) \
+ { register unsigned32 _xint=(xint); \
+   asm volatile( "loop_til_cleared:
+                    clrbit %0,sf0,sf0 ; \
+                    bbs    %0,sf0,loop_til_cleared" \
+                  : "=d" (_xint) : "0" (_xint) ); \
+ }
+
+#define reload_ctl_group( group ) \
+ { register int _cmd = ((group)|0x400) ; \
+   asm volatile( "sysctl %0,%0,%0" : "=d" (_cmd) : "0" (_cmd) ); \
+ }
+
+#define cause_intr( intr ) \
+ { register int _intr = (intr); \
+   asm volatile( "sysctl %0,%0,%0" : "=d" (_intr) : "0" (_intr) ); \
+ }
+
+#define soft_reset( prcb ) \
+ { register struct i80960ca_prcb *_prcb = (prcb); \
+   register unsigned32         *_next=0; \
+   register unsigned32          _cmd  = 0x30000; \
+   asm volatile( "lda    next,%1; \
+                  sysctl %0,%1,%2; \
+            next: mov    g0,g0" \
+                  : "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
+                  : "0"  (_cmd), "1"  (_next), "2"  (_prcb) ); \
+ }
+
+static inline unsigned32 pend_intrs() 
+{ register unsigned32 _intr=0; 
+  asm volatile( "mov sf0,%0" : "=d" (_intr) : "0" (_intr) ); 
+  return ( _intr ); 
+}
+
+static inline unsigned32 mask_intrs() 
+{ register unsigned32 _intr=0;
+  asm volatile( "mov sf1,%0" : "=d" (_intr) : "0" (_intr) ); 
+  return( _intr );
+}
+
+static inline unsigned32 get_fp() 
+{ register unsigned32 _fp=0; 
+  asm volatile( "mov fp,%0" : "=d" (_fp) : "0" (_fp) ); 
+  return ( _fp ); 
+}
+
+#endif
+/* end of include file */
diff --git a/sysdeps/standalone/i960/nindy960/Makefile b/sysdeps/standalone/i960/nindy960/Makefile
new file mode 100644
index 0000000000..e6e65ea064
--- /dev/null
+++ b/sysdeps/standalone/i960/nindy960/Makefile
@@ -0,0 +1,23 @@
+# Copyright (C) 1993 Free Software Foundation, Inc.
+# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+#   On-Line Applications Research Corporation.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License
+# as published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+
+# The nindy960 support has only been tested on the following boards:
+# 
+#   + Cyclone CVME961 VMEbus single board computer.
diff --git a/sysdeps/standalone/i960/nindy960/_exit.c b/sysdeps/standalone/i960/nindy960/_exit.c
new file mode 100644
index 0000000000..33553a7a2c
--- /dev/null
+++ b/sysdeps/standalone/i960/nindy960/_exit.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+/* The function `_exit' should take a status argument and simply
+   terminate program execution, using the low-order 8 bits of the
+   given integer as status.  */
+
+/* This returns control to Nindy.  */
+
+__NORETURN void
+DEFUN(_exit, (status), int status)
+{
+  /* status is ignored */
+
+  asm volatile( "mov   0,g0; \
+                 fmark ; \
+           syncf ; \
+           .word    0xfeedface ; \
+                 bx       start" : : );
+ /*  The constant 0xfeedface is a magic word for break which
+  *  is defined by NINDY.  The branch extended restarts the
+  *  application if the user types "go".
+  */
+}
+
+
+#ifdef	 HAVE_GNU_LD
+
+#include <gnu-stabs.h>
+
+stub_warning(_exit);
+
+#endif	/* GNU stabs.  */
diff --git a/sysdeps/standalone/i960/nindy960/brdinit.c b/sysdeps/standalone/i960/nindy960/brdinit.c
new file mode 100644
index 0000000000..c16adcd390
--- /dev/null
+++ b/sysdeps/standalone/i960/nindy960/brdinit.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <standalone.h>
+#include "i960ca.h"
+
+/*  _Board_Initialize()
+
+This routine initializes the board.  
+
+NOTE: Only tested on a Cyclone CVME961 but should be OK on any i960ca board. */
+
+void 
+DEFUN_VOID(_Board_Initialize)
+{
+  struct i80960ca_prcb   *prcb;     /* ptr to processor control block */
+  struct i80960ca_ctltbl *ctl_tbl;  /* ptr to control table */
+
+  static inline struct i80960ca_prcb *get_prcb()
+  { register struct i80960ca_prcb *_prcb = 0;
+    asm volatile( "calls 5; \
+                   mov   g0,%0" \
+                   : "=d" (_prcb) \
+                   : "0" (_prcb) );
+    return ( _prcb );
+  }
+
+  prcb    = get_prcb();
+  ctl_tbl = prcb->control_tbl;
+
+  /*   The following configures the data breakpoint (which must be set
+   *   before this is executed) to break on writes only.
+   */
+
+  ctl_tbl->bpcon &= ~0x00cc0000;
+  reload_ctl_group( 6 );
+
+   /*  bit 31 of the Register Cache Control can be set to
+    *  enable an alternative caching algorithm.  It does
+    *  not appear to help our applications.
+    */
+
+   /* Configure Number of Register Caches */
+
+  prcb->reg_cache_cfg = 8;
+  soft_reset( prcb );
+}
diff --git a/sysdeps/standalone/i960/nindy960/console.c b/sysdeps/standalone/i960/nindy960/console.c
new file mode 100644
index 0000000000..821514458a
--- /dev/null
+++ b/sysdeps/standalone/i960/nindy960/console.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <standalone.h>
+#include "i960ca.h"
+
+/* Console IO routines for a NINDY960 board. */
+   
+/*
+ *  NINDY_IO( ... )
+ *
+ *  Interface to NINDY.
+ */
+
+#define NINDY_INPUT   0
+#define NINDY_OUTPUT  1
+
+void ___NINDY_IO_WRAPPER( void )  /* never called */
+{
+   asm volatile ( "       .text" );
+   asm volatile ( "       .align 4" );
+   asm volatile ( "       .globl _NINDY_IO" );
+   asm volatile ( "_NINDY_IO:" );
+   asm volatile ( "        calls   0       /* call console routines */" );
+   asm volatile ( "        ret" );
+}
+
+/***** !!!! HOW DO I EXFUN NINDY_IO? !!!! *****/
+
+/* _Console_Putc
+
+This routine transmits a character using NINDY.  */
+
+int
+DEFUN( _Console_Putc, (ch), char ch )
+{
+  NINDY_IO( NINDY_OUTPUT, ch );
+  return( 0 );
+}
+
+/* _Console_Getc
+
+This routine reads a character from NINDY and returns it. */
+
+int
+DEFUN( _Console_Getc, (poll), int poll )
+{
+  char ch;
+
+  if ( poll ) {
+    /* I don't know how to poll with NINDY */
+    return -1;
+  } else {
+    NINDY_IO( NINDY_INPUT, &ch );
+    return ch;
+  }
+}
diff --git a/sysdeps/standalone/i960/start.S b/sysdeps/standalone/i960/start.S
new file mode 100644
index 0000000000..c14449d3ff
--- /dev/null
+++ b/sysdeps/standalone/i960/start.S
@@ -0,0 +1,137 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*  entry.s
+ *
+ *  This file contains the entry point for the application.
+ *  The name of this entry point is compiler dependent.
+ *  It jumps to the BSP which is responsible for performing
+ *  all initialization.
+ *
+ */
+
+         .text
+         .globl  start                  # GNU960 default entry point
+
+start:
+        mov     3, r12
+        modpc   r12, r12, r12         # enable tracing/trace faults
+        mov     g5, g5                # NOP
+        mov     0, g14                # initialize constant for C
+
+        /*
+         * zero out uninitialized data area
+         */
+zerobss:
+        lda     _end, r4        /* find end of .bss */
+        lda     _bss_start, r5  /* find beginning of .bss */
+        ldconst 0, r6
+
+loop:   st      r6, (r5)        /* to zero out uninitialized */
+        addo    4, r5, r5       /* data area                 */
+        cmpobl  r5, r4, loop    /* loop until _end reached   */
+
+
+        lda     heap_memory, r12      /* tell C lib where heap is */
+        st      r12,___C_heap_start
+        lda     heap_size, r12        /* tell C lib how big heap is */
+        st      r12,___C_heap_size
+        lda     stack_memory,r12      /* set up stack pointer: */
+        mov     r12, sp
+        mov     0, g14           /* initialize constant for C */
+
+        call    init_frames
+        ret                      /* return to monitor */
+
+init_frames:
+        ldconst 0x3b001000, g0
+        ldconst 0x00009107, g1
+        modac   g1, g0, g0       /* set AC controls */
+
+        /*
+         * Call application mainline.
+         *      Someday, real values of argc and argv will be set up.
+         *      For now, they are set to 0.
+         */
+
+        callx   __Board_Initialize    /* Initialize the board */
+
+        ldconst 0,g0
+        ldconst 0,g1
+        ldconst 0,g2
+        callx   ___libc_init          /* initialize the library and */
+                                      /*   call main */
+        /*
+         * if we return from main, we have "fallen" off the end
+         * of the program, therefore status is 0
+         * so move 0 to g0 (exit parameter)
+         */
+
+        mov     0, g0
+        callx   __exit
+        ret
+
+
+/*
+ *  Data Declarations.  Start with a macro which helps declare space.
+ */
+
+#define DECLARE_SPACE(_name,_space,_align) \
+          .globl   _name ; \
+          .align   _align ; \
+.comm     _name##,_space
+
+#define DECLARE_LABEL(_name) \
+          .globl   _name ; \
+_name##:  
+
+#define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
+#define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
+#define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
+
+/*
+ *  Require environment stuff
+ */
+
+DECLARE_LABEL(_environ)
+DECLARE_PTR(environ)
+
+DECLARE_LABEL(_errno)
+DECLARE_U32(errno)
+
+/*
+ *  Stack Size and Space
+ */
+
+        .set stack_size, 0x20000
+
+DECLARE_SPACE(stack_memory,stack_size,4)
+DECLARE_LABEL(stack_end)
+
+/*
+ *  Heap Size and Space
+ */
+
+        .set heap_size, 0x20000
+
+DECLARE_SPACE(heap_memory,heap_size,4)
+DECLARE_LABEL(heap_end)
+
diff --git a/sysdeps/standalone/m68k/m68020/Dist b/sysdeps/standalone/m68k/m68020/Dist
new file mode 100644
index 0000000000..90b37b40eb
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/Dist
@@ -0,0 +1 @@
+m68020.h
diff --git a/sysdeps/standalone/m68k/m68020/m68020.h b/sysdeps/standalone/m68k/m68020/m68020.h
new file mode 100644
index 0000000000..e9e6f7d875
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/m68020.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*  m68020.h
+ *
+ *  This file contains macros which are used to access MC68020 
+ *  registers which are not addressable by C.  These are
+ *  useful when developing the board specific support.
+ */
+
+#ifndef m68020_h__
+#define m68020_h__
+
+typedef void ( *mc68020_isr )( void );
+
+#define disable_intr( level ) \
+  { (level) = 0; \
+    asm volatile ( "movew   %%sr,%0 ; \
+                    orw     #0x0700,%%sr" \
+                    : "=d" ((level)) : "0" ((level)) ); \
+  }
+
+#define enable_intr( level ) \
+  { asm volatile ( "movew   %0,%%sr " \
+                       : "=d" ((level)) : "0" ((level)) ); \
+  }
+
+#define flash_intr( level ) \
+  { asm volatile ( "movew   %0,%%sr ; \
+                    orw     #0x0700,%%sr" \
+                       : "=d" ((level)) : "0" ((level)) ); \
+  }
+
+#define get_vbr( vbr ) \
+  { (vbr) = 0; \
+    asm volatile ( "movec   %%vbr,%0 " \
+                       : "=a" (vbr) : "0" (vbr) ); \
+  }
+
+#define set_vbr( vbr ) \
+  { register mc68020_isr *_vbr= (mc68020_isr *)(vbr); \
+    asm volatile ( "movec   %0,%%vbr " \
+                       : "=a" (_vbr) : "0" (_vbr) ); \
+  }
+
+#define enable_caching() \
+  { register unsigned int _ctl=0x01; \
+    asm volatile ( "movec   %0,%%cacr" \
+                       : "=d" (_ctl) : "0" (_ctl) ); \
+  }
+
+#define delay( microseconds ) \
+  { register unsigned int _delay=(microseconds); \
+    register unsigned int _tmp=123; \
+    asm volatile( "0: \
+                     nbcd      %0 ; \
+                     nbcd      %0 ; \
+                     dbf       %1,0 " \
+                  : "=d" (_tmp), "=d" (_delay) \
+                  : "0"  (_tmp), "1"  (_delay) ); \
+  }
+
+#define enable_tracing() 
+#define cause_intr( X ) 
+#define clear_intr( X ) 
+
+extern mc68020_isr     M68Kvec[];   /* vector table address */
+
+#endif
+/* end of include file */
diff --git a/sysdeps/standalone/m68k/m68020/mvme135/Implies b/sysdeps/standalone/m68k/m68020/mvme135/Implies
new file mode 100644
index 0000000000..7142fe2985
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme135/Implies
@@ -0,0 +1,2 @@
+# Motorola MVME135 and MVME136 are compatible.
+standalone/m68k/m68020/mvme136
diff --git a/sysdeps/standalone/m68k/m68020/mvme136/Dist b/sysdeps/standalone/m68k/m68020/mvme136/Dist
new file mode 100644
index 0000000000..97b90583eb
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme136/Dist
@@ -0,0 +1 @@
+mvme136.ld
diff --git a/sysdeps/standalone/m68k/m68020/mvme136/Makefile b/sysdeps/standalone/m68k/m68020/mvme136/Makefile
new file mode 100644
index 0000000000..33f049c58c
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme136/Makefile
@@ -0,0 +1,22 @@
+# Copyright (C) 1993 Free Software Foundation, Inc.
+# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+#   On-Line Applications Research Corporation.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License
+# as published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+ifeq (bare,$(subdir))
+install-lib += mvme136.ld
+endif
diff --git a/sysdeps/standalone/m68k/m68020/mvme136/_exit.c b/sysdeps/standalone/m68k/m68020/mvme136/_exit.c
new file mode 100644
index 0000000000..d13b4d9770
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme136/_exit.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "m68020.h"
+
+/* Return control to 135Bug */
+
+void 
+DEFUN_VOID(__exit_trap)
+{
+  set_vbr( 0 );                     /* restore 135Bug vectors */
+  asm volatile( "trap   #15"  );    /* trap to 135Bug */
+  asm volatile( ".short 0x63" );    /* return to 135Bug (.RETURN) */
+  asm volatile( "jmp    main" );    /* restart program */
+}
+
+/* The function `_exit' should take a status argument and simply
+   terminate program execution, using the low-order 8 bits of the
+   given integer as status.  */
+
+__NORETURN void
+DEFUN(_exit, (status), int status)
+{
+  /* status is ignored */
+
+  M68Kvec[ 45 ] = __exit_trap;   /* install exit_trap handler */
+  asm volatile( "trap #13" );  /* insures SUPV mode */
+}
diff --git a/sysdeps/standalone/m68k/m68020/mvme136/brdinit.c b/sysdeps/standalone/m68k/m68020/mvme136/brdinit.c
new file mode 100644
index 0000000000..0c4801a49b
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme136/brdinit.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <standalone.h>
+#include "m68020.h"
+
+/*  _Board_Initialize()
+
+This routine initializes the Motorola MVME135/MVME136.  */
+
+void 
+DEFUN_VOID(_Board_Initialize)
+{
+  mc68020_isr *monitors_vector_table;
+  int          index;
+ 
+  monitors_vector_table = (mc68020_isr *)0;   /* 135Bug Vectors are at 0 */
+  set_vbr( monitors_vector_table );
+
+  for ( index=2 ; index<=255 ; index++ )
+    M68Kvec[ index ] = monitors_vector_table[ 32 ];
+
+  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
+  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
+  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
+  M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
+
+  set_vbr( &M68Kvec );
+
+  (*(unsigned char *)0xfffb0067) = 0x7f; /* make VME access round-robin */
+
+  enable_caching();
+
+}
diff --git a/sysdeps/standalone/m68k/m68020/mvme136/console.c b/sysdeps/standalone/m68k/m68020/mvme136/console.c
new file mode 100644
index 0000000000..159070bab9
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme136/console.c
@@ -0,0 +1,101 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <standalone.h>
+#include "m68020.h"
+
+/* Console IO routines for a Motorola MVME135/MVME136 board.
+   
+They currently use the B port.  It should be possible to
+use the A port by filling in the reset of the chip structure,
+adding an ifdef for PORTA/PORTB, and switching the addresses,
+and maybe the macroes based on the macro. */
+
+/* M68681 DUART chip register structures and constants */
+
+typedef struct {
+  volatile unsigned char fill1[ 5 ];     /* channel A regs ( not used ) */
+  volatile unsigned char isr;            /* interrupt status reg */
+  volatile unsigned char fill2[ 2 ];     /* counter regs (not used) */
+  volatile unsigned char mr1mr2b;        /* MR1B and MR2B regs */
+  volatile unsigned char srb;            /* status reg channel B */
+  volatile unsigned char fill3;          /* do not access */
+  volatile unsigned char rbb;            /* receive buffer channel B */
+  volatile unsigned char ivr;            /* interrupt vector register */
+} r_m681_info;
+
+typedef struct {
+  volatile unsigned char fill1[ 4 ];     /* channel A regs (not used) */
+  volatile unsigned char acr;            /* auxillary control reg */
+  volatile unsigned char imr;            /* interrupt mask reg */
+  volatile unsigned char fill2[ 2 ];     /* counter regs (not used) */
+  volatile unsigned char mr1mr2b;        /* MR1B and MR2B regs */
+  volatile unsigned char csrb;           /* clock select reg */
+  volatile unsigned char crb;            /* command reg */
+  volatile unsigned char tbb;            /* transmit buffer channel B */
+  volatile unsigned char ivr;            /* interrupt vector register */
+} w_m681_info;
+
+#define RD_M68681     ((r_m681_info *)0xfffb0040)   /* ptr to the M68681 */
+#define WR_M68681     ((w_m681_info *)0xfffb0040)   /* ptr to the M68681 */
+#define RXRDYB        0x01               /* status reg recv ready mask */
+#define TXRDYB        0x04               /* status reg trans ready mask */
+
+/* _Console_Putc
+
+This routine transmits a character out the M68681.  It supports
+XON/XOFF flow control.  */
+
+#define XON             0x11            /* control-Q */
+#define XOFF            0x13            /* control-S */
+
+int
+DEFUN( _Console_Putc, (ch), char ch )
+{
+  while ( ! (RD_M68681->srb & TXRDYB) ) ;
+  while ( RD_M68681->srb & RXRDYB )        /* must be an XOFF */
+    if ( RD_M68681->rbb == XOFF ) 
+      do {
+        while ( ! (RD_M68681->srb & RXRDYB) ) ;
+      } while ( RD_M68681->rbb != XON ); 
+
+  WR_M68681->tbb = ch;
+  return( 0 );
+}
+
+/* _Console_Getc
+
+This routine reads a character from the UART and returns it. */
+
+int
+DEFUN( _Console_Getc, (poll), int poll )
+{
+  if ( poll ) {
+    if ( !(RD_M68681->srb & RXRDYB) ) 
+      return -1;
+    else
+      return RD_M68681->rbb;
+  } else {
+    while ( !(RD_M68681->srb & RXRDYB) );
+    return RD_M68681->rbb;
+  }
+}
diff --git a/sysdeps/standalone/m68k/m68020/mvme136/mvme136.ld b/sysdeps/standalone/m68k/m68020/mvme136/mvme136.ld
new file mode 100644
index 0000000000..0f68330241
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/mvme136/mvme136.ld
@@ -0,0 +1,62 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* This file contains directives for the GNU linker which are specific
+to the Motorola MVME136/MVME135 boards.  */
+
+MEMORY 
+        {
+        ram : org = 0x3000, l = 1M
+        }
+
+/* This value is also when the space is allocated.  If you change
+this one, change the other one!!! */
+
+heap_size = 0x20000;
+
+SECTIONS
+{
+        .text 0x3000 :  
+        {
+          text_start = ABSOLUTE(.) ;
+          *(.text)
+          etext = ALIGN( 0x10 ) ;
+        } 
+
+        .data ADDR( .text ) + SIZEOF( .text ): 
+        {
+          data_start = . ;
+          *(.data)
+          edata = ALIGN( 0x10 ) ;
+        }
+
+        .bss ADDR( .data ) + SIZEOF( .data ): 
+        {
+          bss_start = . ;
+          _bss_start = . ;
+          *(.bss)
+          *(COMMON)
+          heap_memory = .;
+          . += 0x20000;
+          end = . ;
+          _end = . ;
+        }  
+}
diff --git a/sysdeps/standalone/m68k/m68020/start.S b/sysdeps/standalone/m68k/m68020/start.S
new file mode 100644
index 0000000000..cbabf5bf07
--- /dev/null
+++ b/sysdeps/standalone/m68k/m68020/start.S
@@ -0,0 +1,155 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/*  entry.s
+ *
+ *  This file contains the entry point for the application.
+ *  The name of this entry point is compiler dependent.
+ *  It jumps to the BSP which is responsible for performing
+ *  all initialization.
+ */
+
+        .text
+	      .globl   start                        | Default entry point
+	      .globl   _start                       | Default entry point
+	      .globl   M68Kvec                      | Vector Table
+	      .globl   _M68Kvec                     | Vector Table
+
+start:
+_start:
+M68Kvec:                               | standard location for vectors
+_M68Kvec:                               | standard location for vectors
+        nop                             | for linkers with problem
+                                        |   using location zero as entry
+        jmp      around
+        .space   4088                   | to avoid initial intr stack
+                                        |   from 135BUG on MVME13? as entry
+                                        |   and start code at 0x4000
+around: 
+        move.w  %sr,initial_sr          | save initial values
+        movec   %isp,%a0
+        movel   %a0,initial_isp
+        movec   %usp,%a0
+        movel   %a0,initial_usp
+        movec   %msp,%a0
+        movel   %a0,initial_msp
+        oriw    #0x0700,%sr             | INTERRUPTS OFF!!!
+
+        
+
+        |
+        | zero out uninitialized data area
+        |
+zerobss:
+        moveal  #end,%a0                | find end of .bss 
+        moveal  #_bss_start,%a1         | find beginning of .bss 
+        movel   #0,%d0
+
+loop:   movel   #0,%a1@+                | to zero out uninitialized
+        cmpal   %a0,%a1
+        jlt     loop                    | loop until _end reached 
+
+        movel   #heap_size,__C_heap_size | set ___C_heap_size
+        movel   #heap_memory,__C_heap_start | set ___C_heap_start
+        moveal  #interrupt_stack_end,%a0 | set interrupt stack pointer
+        movec   %a0,%isp
+        moveal  #stack_end,%a0          | set master stack pointer
+        movec   %a0,%msp
+        moveal  #stack_end,%a6          | set base pointer
+        movw    #0x3000,%sr             | SUPV MODE,INTERRUPTS ON!!!
+
+#ifdef NEED_UNDERSCORES
+        jsr     __Board_Initialize      | initialize the board 
+#else
+        jsr     _Board_Initialize       | initialize the board 
+#endif
+
+        move.l  #0,%sp@-                | envp = NULL 
+        move.l  #0,%sp@-                | argv = NULL 
+        move.l  #0,%sp@-                | argc = NULL 
+#ifdef NEED_UNDERSCORES
+        jsr     ___libc_init            | initialize the library and
+                                        |   call main
+#else
+        jsr     __libc_init             | initialize the library and
+                                        |   call main
+#endif
+        add.l   #12,%sp
+ 
+        move.l  #0,%sp@-                | argc = NULL 
+        jsr     __exit                  | call the Board specific exit
+        addq.l  #4,%sp
+
+        move.l  initial_isp,%a0         | if __exit returns then we can
+        movec   %a0,%isp                |   restore the initial values
+        move.l  initial_usp,%a0
+        movec   %a0,%usp
+        move.l  initial_msp,%a0
+        movec   %a0,%msp
+        move.w  initial_sr,%sr
+        rts
+
+
+        .bss
+
+/*
+ *  So initial stack registers and status register can be saved.
+ */
+
+#define DECLARE_SPACE(_name,_space,_align) \
+          .globl   _name ; \
+          .align   _align ; \
+_name##:  .space _space
+
+#define DECLARE_LABEL(_name) \
+          .globl   _name ; \
+_name##:  
+
+#define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
+#define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
+#define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
+
+DECLARE_U32(initial_isp)
+DECLARE_U32(initial_msp)
+DECLARE_U32(initial_usp)
+DECLARE_U16(initial_sr)
+
+/*
+ *  Require environment stuff
+ */
+
+DECLARE_LABEL(_environ)
+DECLARE_PTR(environ)
+
+DECLARE_LABEL(_errno)
+DECLARE_U32(errno)
+
+/*
+ *  Stack Size and Space
+ */
+
+        .set stack_size, 0x20000
+
+DECLARE_SPACE(stack_memory,stack_size,4)
+DECLARE_LABEL(stack_end)
+
+DECLARE_SPACE(interrupt_stack_memory,0x1000,4)
+DECLARE_LABEL(interrupt_stack_end)
diff --git a/sysdeps/standalone/open.c b/sysdeps/standalone/open.c
new file mode 100644
index 0000000000..910e7933e7
--- /dev/null
+++ b/sysdeps/standalone/open.c
@@ -0,0 +1,122 @@
+/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+#include <stdio.h>
+#include <stdio_lim.h>
+#include <unistd.h>
+
+#define __DECLARE_FILE_DESCRIPTORS__
+
+#include "filedesc.h"
+
+/* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
+   a third argument is the file protection.  */
+int
+DEFUN(__open, (file, oflag), CONST char *file AND int oflag DOTS)
+{
+  int mode;
+  int newfd;
+  int index;
+
+  if (file == NULL)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start(arg, oflag);
+      mode = va_arg(arg, int);
+      va_end(arg);
+    }
+
+  /*
+   *  Find an open slot.
+   */
+
+  newfd = -1;
+
+  for ( index=0 ; index< FOPEN_MAX ; index++ )
+    if ( !__FD_Table[ index ].in_use ) {
+      newfd = index;
+      break;
+    }
+
+  if ( newfd == -1 ) {
+    errno = ENFILE;
+    return -1;
+  }
+
+  /* 
+   *  Initialize the open slot
+   */
+
+  __FD_Table[ newfd ].in_use = 1;
+  __FD_Table[ newfd ].flags = oflag;
+  
+  return newfd;
+}
+
+/* Initialization Code for Console I/O */
+
+#ifdef HAVE_GNU_LD
+static
+#endif
+void
+DEFUN(__NONE_init_console_io, (argc, argv, envp),
+      int argc AND char **argv AND char **envp)
+{
+  int index;
+
+  for ( index=0 ; index< FOPEN_MAX ; index++ )
+    __FD_Table[ index ].in_use = 0;
+
+  stdin = fopen( "", "r" );
+
+  stdout = fopen( "", "w" );
+
+  stderr = fopen( "", "w" );
+
+  /*
+   *  Line buffer the standard input and output and use no buffering for
+   *  standard error.
+   */
+
+  setvbuf( stdin,  NULL, _IOLBF, BUFSIZ );
+  setvbuf( stdout, NULL, _IOLBF, BUFSIZ );
+  setvbuf( stderr, NULL, _IONBF, BUFSIZ );
+
+  (void) &__NONE_init_console_io;  /* Avoid "defined but not used" warning. */
+}
+
+#ifdef  HAVE_GNU_LD
+text_set_element (__libc_subinit, __NONE_init_console_io);
+#endif
+
+weak_alias (__open, open)
diff --git a/sysdeps/standalone/read.c b/sysdeps/standalone/read.c
new file mode 100644
index 0000000000..284321d717
--- /dev/null
+++ b/sysdeps/standalone/read.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+#include "filedesc.h"
+#include <fcntl.h>
+#include <standalone.h>
+
+/* Read NBYTES into BUF from FD.  Return the number read or -1.  */
+ssize_t
+DEFUN(__read, (fd, buf, nbytes),
+      int fd AND PTR buf AND size_t nbytes)
+{
+  char *buffer = (char *) buf;
+  int data;
+  int poll;
+
+  errno = 0;
+
+  if (nbytes == 0)
+    return 0;
+
+  if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use )
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (buf == NULL)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if ( __FD_Table[ fd ].flags & O_WRONLY )  /* is it write only? */
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  /* If this is a non-blocking fd, then we want to poll the console.  */
+
+  poll = ( __FD_Table[ fd ].flags & O_NONBLOCK ) ? 1 : 0;
+
+  /* Read a single character.  This is a cheap way to insure that the 
+     upper layers get every character because _Console_Getc can't timeout 
+     or otherwise know when to stop.  */
+
+  
+  data = _Console_Getc(poll);
+
+  if ( data == -1 )                 /* if no data return */
+    return -1;
+
+  (void) _Console_Putc(data);       /* echo the character */
+
+  if ( data == '\r' ) {		/* translate CR -> CR/LF */
+    (void) _Console_Putc('\n');
+    data = '\n';
+  }
+
+  *buffer = data;
+  return 1;
+}
+
+weak_alias (__read, read)
diff --git a/sysdeps/standalone/standalone.h b/sysdeps/standalone/standalone.h
new file mode 100644
index 0000000000..13d58f03e8
--- /dev/null
+++ b/sysdeps/standalone/standalone.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef _STANDALONE_H
+#define _STANDALONE_H
+
+#include <sys/cdefs.h>
+
+extern void _Board_Initialize __P ((void));
+
+extern int _Console_Putc __P ((char c));
+extern int _Console_Getc __P ((int poll));
+
+#endif
diff --git a/sysdeps/standalone/stdio_lim.h b/sysdeps/standalone/stdio_lim.h
new file mode 100644
index 0000000000..5552bc4325
--- /dev/null
+++ b/sysdeps/standalone/stdio_lim.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+ 
+This file is part of the GNU C Library.
+ 
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+ 
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+ 
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#define	L_tmpnam	1
+#define	TMPMAX		0
+#define	L_ctermid	1
+#define	L_cuserid	1
+#define	FOPEN_MAX	16
+#define	FILENAME_MAX	14
diff --git a/sysdeps/standalone/write.c b/sysdeps/standalone/write.c
new file mode 100644
index 0000000000..f0ae3888f6
--- /dev/null
+++ b/sysdeps/standalone/write.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+   Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
+     On-Line Applications Research Corporation.
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <sysdep.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+#include "filedesc.h"
+#include <fcntl.h>
+#include <standalone.h>
+
+/* Write NBYTES of BUF to FD.  Return the number written, or -1.  */
+ssize_t
+DEFUN(__write, (fd, buf, nbytes),
+      int fd AND CONST PTR buf AND size_t nbytes)
+{
+  int count;
+  CONST char *data = buf;
+
+  if (nbytes == 0)
+    return 0;
+  if ( !__FD_Is_valid( fd ) || !__FD_Table[ fd ].in_use )
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (buf == NULL)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if ( !(__FD_Table[ fd ].flags & (O_WRONLY|O_RDWR)) )  /* is it writeable? */
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  /*
+   *  All open file descriptors are mapped to the console.
+   */
+
+  for ( count=0 ; count != nbytes ; count++ ) {
+    if ( _Console_Putc(data[ count ]) == -1 )
+      return -1;
+    if ( data[count] == '\n' && _Console_Putc('\r') == -1 )
+      return -1;
+  }
+
+  return count;
+}
+
+
+weak_alias (__write, write)