changeset 191:678094f34118

Merge from eCos master repository on 2001-10-19-06:43:02-BST
author jlarmour
date Fri, 19 Oct 2001 07:02:26 +0000
parents 7e4874fa4fbe
children 9dd39c51f7a7
files host/ChangeLog host/libcdl/cdl.dsp host/tools/configtool/common/common/build.cxx host/tools/configtool/common/common/build.hxx host/tools/configtool/standalone/win32/MainFrm.cpp host/tools/configtool/standalone/wxwin/CHANGES.txt host/tools/configtool/standalone/wxwin/configtool.cpp host/tools/configtool/standalone/wxwin/configtool.h host/tools/configtool/standalone/wxwin/configtooldoc.cpp host/tools/configtool/standalone/wxwin/filename.cpp host/tools/configtool/standalone/wxwin/setup/configtool.iss host/tools/configtool/standalone/wxwin/symbols.h packages/ChangeLog packages/NEWS packages/compat/posix/current/ChangeLog packages/compat/posix/current/cdl/posix.cdl packages/compat/posix/current/include/time.h packages/compat/posix/current/src/pprivate.h packages/compat/posix/current/src/pthread.cxx packages/compat/posix/current/src/signal.cxx packages/compat/posix/current/src/time.cxx packages/compat/posix/current/tests/mutex3.c packages/compat/posix/current/tests/signal2.c packages/devs/eth/amd/pcnet/current/ChangeLog packages/devs/eth/amd/pcnet/current/cdl/amd_pcnet_eth_drivers.cdl packages/devs/eth/amd/pcnet/current/src/amd_pcnet.h packages/devs/eth/amd/pcnet/current/src/if_pcnet.c packages/devs/eth/arm/edb7xxx/current/ChangeLog packages/devs/eth/arm/edb7xxx/current/cdl/edb7xxx_eth_drivers.cdl packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c packages/devs/eth/arm/iq80310/current/ChangeLog packages/devs/eth/arm/iq80310/current/cdl/iq80310_eth_drivers.cdl packages/devs/eth/arm/iq80310/current/include/iq80310_info.h packages/devs/eth/arm/iq80310/current/src/if_iq80310.c packages/devs/eth/arm/iq80310/current/src/if_shmem.S packages/devs/eth/cf/current/ChangeLog packages/devs/eth/cf/current/include/devs_eth_cf.inl packages/devs/eth/mips/atlas/current/ChangeLog packages/devs/eth/mips/atlas/current/src/if_atlas.c packages/devs/eth/ns/dp83902a/current/ChangeLog packages/devs/eth/ns/dp83902a/current/include/dp83902a.h packages/devs/eth/ns/dp83902a/current/src/if_dp83902a.c packages/devs/flash/arm/edb7xxx/current/ChangeLog packages/devs/flash/arm/edb7xxx/current/cdl/flash_edb7xxx.cdl packages/devs/flash/intel/28fxxx/current/ChangeLog packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl packages/devs/serial/arm/e7t/current/ChangeLog packages/devs/serial/arm/e7t/current/cdl/ser_arm_e7t.cdl packages/devs/serial/arm/e7t/current/src/e7t_serial.c packages/devs/serial/arm/e7t/current/src/e7t_serial.h packages/devs/serial/arm/edb7xxx/current/ChangeLog packages/devs/serial/arm/edb7xxx/current/cdl/ser_arm_edb7xxx.cdl packages/devs/serial/arm/sa11x0/current/ChangeLog packages/devs/serial/arm/sa11x0/current/src/sa11x0_serial.c packages/ecos.db packages/fs/rom/current/ChangeLog packages/fs/rom/current/cdl/romfs.cdl packages/fs/rom/current/support/mk_romfs.c packages/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/include/hal_io.h packages/hal/arm/edb7xxx/current/ChangeLog packages/hal/arm/edb7xxx/current/cdl/hal_arm_edb7xxx.cdl packages/hal/arm/sa11x0/nano/current/ChangeLog packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h packages/hal/arm/sa11x0/var/current/ChangeLog packages/hal/arm/sa11x0/var/current/src/hal_diag.c packages/hal/common/current/ChangeLog packages/hal/common/current/cdl/debugging.cdl packages/hal/common/current/include/generic-stub.h packages/hal/common/current/include/hal_stub.h packages/hal/common/current/src/generic-stub.c packages/hal/common/current/src/hal_if.c packages/hal/common/current/src/hal_stub.c packages/hal/common/current/src/thread-packets.c packages/hal/i386/arch/current/ChangeLog packages/hal/i386/arch/current/cdl/hal_i386.cdl packages/hal/i386/arch/current/include/arch.inc packages/hal/i386/arch/current/include/hal_arch.h packages/hal/i386/arch/current/include/hal_io.h packages/hal/i386/arch/current/include/i386.inc packages/hal/i386/arch/current/include/i386_stub.h packages/hal/i386/arch/current/src/i386_stub.c packages/hal/i386/arch/current/src/romboot.S packages/hal/i386/arch/current/src/romboot.ld packages/hal/i386/arch/current/src/vectors.S packages/hal/i386/pc/current/ChangeLog packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl packages/hal/i386/pc/current/misc/redboot_FLOPPY_D850GB.ecm packages/hal/i386/pc/current/src/hal_diag.c packages/hal/i386/pc/current/src/romboot.S packages/hal/i386/pc/current/src/romboot.ld packages/hal/i386/pcmb/current/ChangeLog packages/hal/i386/pcmb/current/src/pcmb_screen.c packages/hal/i386/pcmb/current/src/pcmb_serial.c packages/hal/mips/vr4300/current/ChangeLog packages/hal/mips/vr4300/current/src/mips_vr4300.ld packages/hal/mn10300/am31/current/ChangeLog packages/hal/mn10300/am31/current/src/mn10300_am31.ld packages/hal/mn10300/am33/current/ChangeLog packages/hal/mn10300/am33/current/include/variant.inc packages/hal/mn10300/arch/current/ChangeLog packages/hal/mn10300/arch/current/cdl/hal_mn10300.cdl packages/hal/mn10300/arch/current/include/mn10300_stub.h packages/hal/mn10300/arch/current/src/hal_syscall.c packages/hal/mn10300/arch/current/src/mn10300_stub.c packages/hal/mn10300/arch/current/src/vectors.S packages/hal/sh/arch/current/ChangeLog packages/hal/sh/arch/current/cdl/hal_sh.cdl packages/hal/sh/arch/current/src/hal_mk_defs.c packages/hal/sh/sh3/current/ChangeLog packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl packages/hal/sh/sh3/current/include/mod_7709r.h packages/hal/sh/sh3/current/src/var_mk_defs.c packages/hal/sh/sh4/current/ChangeLog packages/hal/sh/sh4/current/include/mod_regs_ubc.h packages/io/eth/current/ChangeLog packages/io/eth/current/cdl/eth_drivers.cdl packages/io/eth/current/include/eth_drv.h packages/io/eth/current/include/eth_drv_stats.h packages/io/eth/current/include/netdev.h packages/io/eth/current/src/net/eth_drv.c packages/io/eth/current/src/stand_alone/eth_drv.c packages/io/fileio/current/ChangeLog packages/io/fileio/current/src/fio.h packages/io/fileio/current/src/misc.cxx packages/io/fileio/current/tests/select.c packages/io/flash/current/ChangeLog packages/io/flash/current/cdl/io_flash.cdl packages/io/flash/current/src/flash.c packages/isoinfra/current/ChangeLog packages/isoinfra/current/cdl/isoinfra.cdl packages/isoinfra/current/include/pthread.h packages/isoinfra/current/include/string.h packages/isoinfra/current/include/time.h packages/isoinfra/current/include/unistd.h packages/kernel/current/ChangeLog packages/kernel/current/cdl/synch.cdl packages/kernel/current/include/mqueue.hxx packages/kernel/current/include/mqueue.inl packages/kernel/current/src/sync/mqueue.cxx packages/kernel/current/tests/dhrystone.c packages/kernel/current/tests/kcache2.c packages/kernel/current/tests/kmutex3.c packages/kernel/current/tests/kmutex4.c packages/kernel/current/tests/mqueue1.cxx packages/kernel/current/tests/mutex3.cxx packages/kernel/current/tests/stress_threads.c packages/kernel/current/tests/testaux.hxx packages/language/c/libc/startup/current/ChangeLog packages/language/c/libc/startup/current/src/invokemain.cxx packages/net/tcpip/current/ChangeLog packages/net/tcpip/current/src/sys/netinet/in.c packages/net/tcpip/current/tests/ftp_test.c packages/redboot/current/ChangeLog packages/redboot/current/cdl/redboot.cdl packages/redboot/current/include/net/net.h packages/redboot/current/src/decompress.c packages/redboot/current/src/flash.c packages/redboot/current/src/io.c packages/redboot/current/src/main.c packages/redboot/current/src/net/enet.c packages/redboot/current/src/net/net_io.c packages/redboot/current/src/syscall.c packages/redboot/current/src/xyzModem.c packages/services/compress/zlib/current/ChangeLog packages/services/compress/zlib/current/cdl/compress_zlib.cdl packages/services/compress/zlib/current/include/zconf.h packages/services/memalloc/common/current/ChangeLog packages/services/memalloc/common/current/cdl/memalloc.cdl packages/services/memalloc/common/current/include/sepmetaimpl.inl packages/services/memalloc/common/current/tests/testaux.hxx
diffstat 171 files changed, 4341 insertions(+), 851 deletions(-) [+]
line wrap: on
line diff
--- a/host/ChangeLog
+++ b/host/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-15  Julian Smart <julians@redhat.com>
+
+    * Mounts /ecos-x now, not /x
+    * Fixed invocation of 'mount' when about to build
+
 2001-07-26  Julian Smart <julians@redhat.com>
 
     * Only use Registry functions if building a GUI Configtool.
--- a/host/libcdl/cdl.dsp
+++ b/host/libcdl/cdl.dsp
@@ -190,6 +190,7 @@ OutDir=V:\cdl\Release
 InputPath=.\ChangeLog
 
 BuildCmds= \
+	echo $(PATH) \
 	if not exist $(IntDir)\tools\configtool\standalone\common\Makefile sh -c "ECOSHOST=`echo ""puts [ file attributes [ pwd ] -shortname ]"" | cygtclsh80`/.. ; echo ""ECOSHOST=$ECOSHOST"" ; echo ""TCLHOME=$TCLHOME"" ; mkdir -p `cygpath -u ""$(IntDir)""` ; cd `cygpath -u ""$(IntDir)""` && CC=cl CXX=cl `cygpath -u ""$ECOSHOST""`/configure --prefix=`cygpath -u ""$(OutDir)""` --with-tcl=`cygpath -u ""$TCLHOME""` --with-tcl_version=82" \
 	cd $(IntDir) \
 	v: \
--- a/host/tools/configtool/common/common/build.cxx
+++ b/host/tools/configtool/common/common/build.cxx
@@ -60,7 +60,8 @@
 // ECOS_USE_CYGDRIVE = 0: use e.g. //c/, but this is deprecated in new versions of Cygwin
 // ECOS_USE_CYGDRIVE = 1: use e.g. /cygdrive/c/
 // ECOS_USE_CYGDRIVE = 2: use e.g. c:/ notation
-#define ECOS_USE_CYGDRIVE 1
+// ECOS_USE_CYGDRIVE = 3: use e.g. /ecos-x notation where x is a drive name.
+#define ECOS_USE_CYGDRIVE 3
 
 // Use registry functions to find out location of /cygdrive
 #define ECOS_USE_REGISTRY 1
@@ -196,6 +197,37 @@ std::string cygpath (const std::string i
 	for (unsigned int n = 0; n < path.size (); n++) { // for each char
 			output += ('\\' == path [n]) ? '/' : path [n]; // convert backslash to slash
 	}
+#elif ECOS_USE_CYGDRIVE == 3
+    // Convert to /ecos-x notation, assuming that this mount point will be created
+    // by the application.
+
+    std::string output1;
+
+    if (path.size() > 1 && path[1] == ':')
+    {
+        output1 = "/ecos-";
+        output1 += tolower(path[0]);
+        output1 += "/";
+
+        // Append the rest of the path
+        if (path.size() > 2)
+        {
+            unsigned int n = 2;
+            unsigned int i;
+
+            if (path[n] == '\\' || path[n] == '//')
+                n ++;
+            
+            for (i = n; i < path.size(); i++)
+                output1 += path[i];
+        }
+    }
+    else
+        output1 = path;
+
+    for (unsigned int n = 0; n < output1.size (); n++) { // for each char
+    	output += ('\\' == output1 [n]) ? '/' : output1 [n]; // convert backslash to slash
+	}
 #else
 	for (unsigned int n = 0; n < path.size (); n++) { // for each char
 		if ((1 == n) && (':' == path [n])) { // if a DOS logical drive letter is present
@@ -416,7 +448,7 @@ bool generate_makefile (const CdlConfigu
 	fprintf (stream, "\n\n");
 	for (count = 0; count < info.headers.size (); count++) { // for each header
 		fprintf (stream, "$(PREFIX)/include/%s: $(REPOSITORY)/$(PACKAGE)/%s\n", info.headers [count].destination.c_str (), info.headers [count].source.c_str ());
-#if (defined(_WIN32) || defined(__CYGWIN__)) && (ECOS_USE_CYGDRIVE == 1)
+#if (defined(_WIN32) || defined(__CYGWIN__)) && (ECOS_USE_CYGDRIVE > 0)
         fprintf (stream, "ifeq ($(HOST),CYGWIN)\n");
 	    fprintf (stream, "\t@mkdir -p `cygpath -w \"$(dir $@)\" | sed \"s/\\\\\\\\\\/\\\\//g\"`\n");
         fprintf (stream, "else\n");
--- a/host/tools/configtool/common/common/build.hxx
+++ b/host/tools/configtool/common/common/build.hxx
@@ -25,3 +25,5 @@
 #include "cdl.hxx"
 extern bool generate_build_tree (const CdlConfiguration config, const std::string build_tree, const std::string install_tree = "");
 extern std::string get_tests (const CdlConfiguration config, const CdlBuildInfo_Loadable & build_info);
+extern std::string cygpath (const std::string input);
+
--- a/host/tools/configtool/standalone/win32/MainFrm.cpp
+++ b/host/tools/configtool/standalone/win32/MainFrm.cpp
@@ -502,6 +502,22 @@ void CMainFrame::Build(const CString &st
       strCmd+=GetApp()->m_strMakeOptions;
     }
 
+    strCmd += _T(" --directory ");
+    
+    // Quoting the name may not mix with the 'sh' command on Unix, so only do it
+    // under Windows where it's more likely there will be spaces needing quoting.
+#ifdef _WINDOWS
+    CString buildDir(pDoc->BuildTree());
+    
+#if 1 // ecUSE_ECOS_X_NOTATION
+    std::string cPath = cygpath(std::string(pDoc->BuildTree()));
+    buildDir = cPath.c_str();
+#endif
+    strCmd += CString(_T("\"")) + buildDir + CString(_T("\""));
+#else
+    strCmd += CString(pDoc->BuildTree()) ;
+#endif
+
     if(PrepareEnvironment()){
       m_strBuildTarget=strWhat;
       SetThermometerMax(250); // This is just a guess.  The thread we are about to spawn will work out the correct answer
@@ -521,8 +537,6 @@ void CMainFrame::Build(const CString &st
 }
 
 
-
-
 CConfigToolApp * CMainFrame::GetApp()
 {
   return (CConfigToolApp *)AfxGetApp();
@@ -1216,14 +1230,17 @@ void CMainFrame::OnUpdateToolsAdministra
 
 void CMainFrame::CygMount(TCHAR c)
 {
-  ASSERT(_istalpha(c));
+  // May not be alpha if it's e.g. a UNC network path
+  if (!_istalpha(c))
+      return;
+
   c=towlower(c);
   if(!m_arMounted[c-_TCHAR('a')]){
     m_arMounted[c-_TCHAR('a')]=true;
     CString strCmd;
     String strOutput;
 
-    strCmd.Format(_T("mount %c: /%c"),c,c);
+    strCmd.Format(_T("mount %c: /ecos-%c"),c,c);
     CSubprocess sub;
     sub.Run(strOutput,strCmd);
   }
--- a/host/tools/configtool/standalone/wxwin/CHANGES.txt
+++ b/host/tools/configtool/standalone/wxwin/CHANGES.txt
@@ -4,6 +4,7 @@ Release History for eCos Configuration T
 *** Version 2.08, September 25th 2001
 
 - Looks in PATH for gcc locations on UNIX.
+
 - Uses current directory for initial save directory, instead of configtool
   directory.
 
--- a/host/tools/configtool/standalone/wxwin/configtool.cpp
+++ b/host/tools/configtool/standalone/wxwin/configtool.cpp
@@ -30,7 +30,7 @@
 // Author(s):   julians
 // Contact(s):  julians
 // Date:        2000/08/24
-// Version:     $Id: configtool.cpp,v 1.47 2001/09/25 09:50:23 julians Exp $
+// Version:     $Id: configtool.cpp,v 1.50 2001/10/15 15:33:02 julians Exp $
 // Purpose:
 // Description: Implementation file for the ConfigTool application class
 // Requires:
@@ -88,6 +88,8 @@
 #include "conflictwin.h"
 #include "propertywin.h"
 #include "symbols.h"
+#include "build.hxx"
+#include "Subprocess.h"
 
 // ----------------------------------------------------------------------------
 // resources
@@ -605,7 +607,7 @@ bool ecApp::VersionStampSplashScreen()
 
         int x = 339; int y = 231;
 #ifdef __WXMSW__
-	y += 6; // For some reason
+        y += 5; // For some reason
 #endif
         int w, h;
         dc.GetTextExtent(verString, & w, & h);
@@ -1073,15 +1075,13 @@ bool ecApp::PrepareEnvironment(bool bWit
                     // Useful for ecosconfig
                     wxSetEnv(wxT("ECOS_REPOSITORY"), pDoc->GetPackagesDir());
 
-                     // No longer necessary because we're using /cygdrive notation
-#if 0
-                    if (! pDoc->GetBuildTree().IsEmpty())
+                    // Mount /ecos-x so we can access these in text mode
+                    if (! pDoc->GetBuildTree().IsEmpty() && wxIsalpha(pDoc->GetBuildTree()[0]))
                         CygMount(pDoc->GetBuildTree()[0]);
-                    if (! pDoc->GetInstallTree().IsEmpty())
+                    if (! pDoc->GetInstallTree().IsEmpty() && wxIsalpha(pDoc->GetInstallTree()[0]))
                         CygMount(pDoc->GetInstallTree()[0]);
-                    if (! pDoc->GetRepository().IsEmpty())
+                    if (! pDoc->GetRepository().IsEmpty() && wxIsalpha(pDoc->GetRepository()[0]))
                         CygMount(pDoc->GetRepository()[0]);
-#endif
                 }
             }
         }
@@ -1181,6 +1181,26 @@ bool ecApp::PrepareEnvironment(bool bWit
 
 void ecApp::CygMount(wxChar c)
 {
+    // May not be alpha if it's e.g. a UNC network path
+    if (!wxIsalpha(c))
+        return;
+    
+    c = wxTolower(c);
+    
+    if(!sm_arMounted[c-_TCHAR('a')])
+    {
+        sm_arMounted[c-wxChar('a')]=true;
+        wxString strCmd;
+        String strOutput;
+        
+        strCmd.Printf(wxT("mount %c: /ecos-%c"),c,c);
+        CSubprocess sub;
+        sub.Run(strOutput,strCmd);
+    }
+
+
+    // Doing it with wxExecute results in a flashing DOS box unfortunately
+#if 0
     wxASSERT(wxIsalpha(c));
     c = wxTolower(c);
     if(!sm_arMounted[c-wxChar('a')])
@@ -1192,6 +1212,52 @@ void ecApp::CygMount(wxChar c)
 
         wxExecute(strCmd, TRUE);
     }
+#endif
+}
+
+// Fiddling directly with the registry DOESN'T WORK because Cygwin mount tables
+// get out of synch with the registry
+void ecApp::CygMountText(wxChar c)
+{
+    wxASSERT(wxIsalpha(c));
+    c = wxTolower(c);
+//    if(!sm_arMounted[c-wxChar('a')])
+    {
+//        sm_arMounted[c-wxChar('a')] = TRUE;
+
+#if 0        
+        wxString strCmd;
+        
+        strCmd.Printf(wxT("mount.exe %c: /ecos-%c"),c,c);
+
+        wxExecute(strCmd, TRUE);
+#else
+        wxString key, value;
+        key.Printf(wxT("/ecos-%c"), c);
+        value.Printf(wxT("%c:"), c);
+
+        // Mount by fiddling with registry instead, so we don't see ugly flashing windows
+#ifdef __WXMSW__
+        HKEY hKey = 0;
+        if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Cygnus Solutions\\Cygwin\\mounts v2",
+            0, KEY_READ, &hKey))
+        {
+            DWORD disposition;
+            HKEY hSubKey = 0;
+
+            if (ERROR_SUCCESS == RegCreateKeyEx(hKey, key, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
+                NULL, & hSubKey, & disposition))
+            {
+                RegSetValueEx(hSubKey, "native", 0, REG_SZ, (unsigned char*) (const wxChar*) value, value.Length() + 1);
+                RegCloseKey(hSubKey);
+            }
+            
+            RegCloseKey(hKey);
+        }
+#endif
+
+#endif
+    }
 }
 
 void ecApp::Build(const wxString &strWhat /*=wxT("")*/ )
@@ -1238,7 +1304,13 @@ void ecApp::Build(const wxString &strWha
         // Quoting the name may not mix with the 'sh' command on Unix, so only do it
         // under Windows where it's more likely there will be spaces needing quoting.
 #ifdef __WXMSW__
-        strCmd += wxString(wxT("\"")) + wxString(pDoc->GetBuildTree()) + wxString(wxT("\""));
+        wxString buildDir(pDoc->GetBuildTree());
+
+#if ecUSE_ECOS_X_NOTATION
+        std::string cPath = cygpath(std::string(pDoc->GetBuildTree()));
+        buildDir = cPath.c_str();
+#endif
+        strCmd += wxString(wxT("\"")) + buildDir + wxString(wxT("\""));
 #else
         strCmd += wxString(pDoc->GetBuildTree()) ;
 #endif
--- a/host/tools/configtool/standalone/wxwin/configtool.h
+++ b/host/tools/configtool/standalone/wxwin/configtool.h
@@ -30,7 +30,7 @@
 // Author(s):   julians
 // Contact(s):  julians
 // Date:        2000/08/24
-// Version:     $Id: configtool.h,v 1.26 2001/09/05 14:35:53 julians Exp $
+// Version:     $Id: configtool.h,v 1.27 2001/10/11 12:31:42 julians Exp $
 // Purpose:
 // Description: main header file for the ConfigTool application
 // Requires:
@@ -128,7 +128,10 @@ public:
     // Fire off a subprocess to build the library or tests
     void Build(const wxString& strWhat = wxEmptyString) ;
 
+    // Mount drive e.g. /c
     static void CygMount(wxChar c);
+    // Mount in text mode e.g. /ecos-c
+    static void CygMountText(wxChar c);
 
     bool InitializeHelpController();
 
--- a/host/tools/configtool/standalone/wxwin/configtooldoc.cpp
+++ b/host/tools/configtool/standalone/wxwin/configtooldoc.cpp
@@ -30,7 +30,7 @@
 // Author(s):   julians
 // Contact(s):  julians
 // Date:        2000/10/05
-// Version:     $Id: configtooldoc.cpp,v 1.41 2001/09/03 17:18:18 julians Exp $
+// Version:     $Id: configtooldoc.cpp,v 1.42 2001/10/11 12:31:42 julians Exp $
 // Purpose:
 // Description: Implementation file for the ecConfigToolDoc class
 // Requires:
@@ -296,7 +296,7 @@ bool ecConfigToolDoc::OnSaveDocument(con
 
             if (!wxGetApp().GetSettings().m_editSaveFileOnly)
             {
-                if (!buildFilename.CreateDirectory() || !installFilename.CreateDirectory())
+                if (!buildFilename.CreateDirectory(FALSE) || !installFilename.CreateDirectory(FALSE))
                 {
                     wxString msg;
                     msg.Printf(_("Failed to save %s"), (const wxChar*) filename);
--- a/host/tools/configtool/standalone/wxwin/filename.cpp
+++ b/host/tools/configtool/standalone/wxwin/filename.cpp
@@ -548,8 +548,8 @@ const ecFileName ecFileName::CygPath () 
     ecFileName rc = ShortName();
     if(wxIsalpha(rc[(size_t)0]) && wxTChar(':')==rc[(size_t)1])
     {
-        // Convert c:\ to //c/
-        wxString s = wxString(wxT("//")) + wxString(rc[(size_t)0]) + rc.Mid(2);
+        // Convert c:\ to /cygdrive/c/
+        wxString s = wxString(wxT("/cygdrive/")) + wxString(rc[(size_t)0]) + rc.Mid(2);
         rc = s;
     }
     size_t i;
@@ -576,6 +576,18 @@ bool ecFileName::CreateDirectory(bool bP
         wxString rest = * this;
         size_t lastPos = 0;
         int len = rest.Len();
+
+#ifdef __WXMSW__
+        // If the path is a network path, ignore the first part of the path
+        if (len > 2 && (rest[0] == wxT('\\') || rest[0] == wxT('/')) && (rest[1] == wxT('\\') || rest[1] == wxT('/')))
+        {
+            rest[(size_t) 0] = wxT('_'); rest[(size_t) 1] = wxT('_');
+            lastPos = rest.Find(cSep);
+            if (lastPos != -1 && lastPos >= 0)
+                rest[lastPos] = wxT('_');
+        }
+#endif
+        
         while (lastPos != -1)
         {
             lastPos = rest.Find(cSep);
--- a/host/tools/configtool/standalone/wxwin/setup/configtool.iss
+++ b/host/tools/configtool/standalone/wxwin/setup/configtool.iss
@@ -4,13 +4,13 @@
 
 [Setup]
     MinVersion=4.0,4.0
-    AppName=eCos Configuration Tool 2.07
+    AppName=eCos Configuration Tool 2.08
     AppId=eCos Configuration Tool
     CreateUninstallRegKey=1
     UsePreviousAppDir=1
     UsePreviousGroup=1
-    AppVersion=2.07
-    AppVerName=eCos Configuration Tool 2.07
+    AppVersion=2.08
+    AppVerName=eCos Configuration Tool 2.08
     AppCopyright=Copyright © Red Hat Inc., 2001
     BackColor=$FF0000
     BackColor2=$000000
@@ -213,7 +213,7 @@
 ; DO NOT DELETE THEM or you may be unable to reload the script
 
 ;[ScriptSetup]
-;VerNum=2.07
+;VerNum=2.08
 ;InnoVer=1.3
 ;AddVerTo=AppVerName
 ;SetupFilename=setup.exe
--- a/host/tools/configtool/standalone/wxwin/symbols.h
+++ b/host/tools/configtool/standalone/wxwin/symbols.h
@@ -30,7 +30,7 @@
 // Author(s):   julians
 // Contact(s):  julians
 // Date:        2001/05/14
-// Version:     $Id: symbols.h,v 1.11 2001/09/25 09:52:56 julians Exp $
+// Version:     $Id: symbols.h,v 1.12 2001/10/11 12:31:42 julians Exp $
 // Purpose:
 // Description: Some important symbols, such as the version
 // Requires:
@@ -45,3 +45,6 @@
 
 #define ecCONFIGURATION_TOOL_VERSION        2.08
 
+// Use /ecos-x notation for drive specification
+#define ecUSE_ECOS_X_NOTATION               1
+
--- a/packages/ChangeLog
+++ b/packages/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-19  Lars Lindqvist  <Lars.Lindqvist@combitechsystems.com>
+2001-10-19  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* ecos.db: Add AEB-2 (E7T) serial drivers.
+
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* ecos.db: Clarify Cirrus Logic related packages' descriptions.
+
 2001-09-18  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* ecos.db: Add i386 PC wallclock driver package, and include it
--- a/packages/NEWS
+++ b/packages/NEWS
@@ -1,3 +1,5 @@
+* Added ARM E7T (AEB-2) serial device drivers contributed by 
+  Lars Lindqvist at Combitech <Lars.Lindqvist@combitechsystems.com>
 * Flash driver added for the SH EDK7708 platform.
 * Added rudimentary ELF loader, including support for dynamic objects under
   services/loader.
--- a/packages/compat/posix/current/ChangeLog
+++ b/packages/compat/posix/current/ChangeLog
@@ -1,3 +1,50 @@
+2001-10-11  Jesper Skov  <jskov@redhat.com>
+
+	* tests/mutex3.c: Fixed warning. 
+	(new_thread): Fixed allocation: increase counter
+	before starting threads which have been allocated resources.
+
+	* tests/signal2.c (cause_illegal_access): Fix warning.
+
+2001-10-10  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/posix.cdl: Only build sem.cxx when the semaphores component
+	is enabled.
+
+2001-10-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/pprivate.h (pthread_info): Conditionalize signal specific
+	members. Conditionalize declaration of 
+	cyg_posix_pthread_release_thread().	
+
+	* cdl/posix.cdl (CYGPKG_POSIX_CLOCKS): new option to separately
+	configure posix clocks from timers.
+	(CYGPKG_POSIX_TIMERS): require clocks and signals.
+
+	* include/time.h: Make proper ISO C. Conditionalize on
+	CYGPKG_POSIX_TIMERS correctly wrt the above change.
+
+	* src/pthread.cxx (posix_asr): Call signal and timer subsystems
+	conditionally.
+
+	* src/pthread.cxx (pthread_reap): Don't destroy signal handling
+	fields if there is no signal handling subsystem.
+	(cyg_posix_pthread_release_thread): Conditionalize on signals.
+	(pthread_create): Init signal subsys conditionally.
+
+	* src/signal.cxx (sleep): Move to...
+
+	* src/time.cxx: ...here.
+	Conditionalize throughout depending on whether it's POSIX clocks
+	or more specifically POSIX timers.
+	(nanosleep): Use PTHREAD_TESTCANCEL() not pthread_testcancel().
+	Get current thread from kernel not pthreads to remove pthread
+	dependency.
+
+2001-10-09  Jesper Skov  <jskov@redhat.com>
+
+	* tests/signal2.c: Also do NA check for signals.
+
 2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/mqueue.cxx (mq_open): Conditionalize use of sigev correctly.
--- a/packages/compat/posix/current/cdl/posix.cdl
+++ b/packages/compat/posix/current/cdl/posix.cdl
@@ -63,7 +63,7 @@ cdl_package CYGPKG_POSIX {
     requires       { CYGBLD_ISO_PTHREAD_MUTEX_HEADER == \
                          "<cyg/posix/mutex.h>" }
     
-    compile        mqueue.cxx mutex.cxx sem.cxx misc.cxx
+    compile        mqueue.cxx mutex.cxx misc.cxx
     compile       -library=libextras.a startup.cxx
 
     cdl_option _POSIX_THREAD_PRIO_INHERIT {
@@ -124,6 +124,27 @@ cdl_package CYGPKG_POSIX {
     # ----------------------------------------------------------------
     # Timers component
 
+    cdl_option CYGPKG_POSIX_CLOCKS {
+	display          "POSIX clocks"
+	flavor           bool
+	default_value    1
+        implements       CYGINT_ISO_POSIX_CLOCK_TYPES
+        implements       CYGINT_ISO_POSIX_CLOCKS
+        implements       CYGINT_ISO_POSIX_SLEEP
+        requires         { CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER == \
+                             "<cyg/posix/time.h>" }
+        requires         { CYGBLD_ISO_POSIX_CLOCKS_HEADER == \
+                             "<cyg/posix/time.h>" }
+        requires         CYGPKG_KERNEL
+        requires         CYGVAR_KERNEL_COUNTERS_CLOCK
+        compile          time.cxx
+	description      "This component provides configuration controls for
+	                  the POSIX clocks."
+    }
+
+    # ----------------------------------------------------------------
+    # Timers component
+
     cdl_option CYGPKG_POSIX_TIMERS {
 	display          "POSIX timers"
 	flavor           bool
@@ -138,7 +159,8 @@ cdl_package CYGPKG_POSIX {
         requires         CYGPKG_KERNEL
         requires         CYGVAR_KERNEL_COUNTERS_CLOCK
         requires         CYGPKG_POSIX_PTHREAD
-        compile          time.cxx
+        requires         CYGPKG_POSIX_CLOCKS
+        requires         CYGPKG_POSIX_SIGNALS
 	description      "This component provides configuration controls for
 	                  the POSIX timers."
     }
@@ -155,6 +177,8 @@ cdl_package CYGPKG_POSIX {
                              "<cyg/posix/semaphore.h>" }
 	description      "This component provides configuration controls for
 	                  POSIX semaphores."
+
+        compile          sem.cxx
     }
 
     # ----------------------------------------------------------------
--- a/packages/compat/posix/current/include/time.h
+++ b/packages/compat/posix/current/include/time.h
@@ -1,6 +1,6 @@
 #ifndef CYGONCE_POSIX_TIME_H
 #define CYGONCE_POSIX_TIME_H
-//=============================================================================
+/*=============================================================================
 //
 //      time.h
 //
@@ -45,23 +45,27 @@
 //
 //####DESCRIPTIONEND####
 //
-//=============================================================================
+//===========================================================================*/
 
+#include <pkgconf/posix.h>
 #include <cyg/infra/cyg_type.h>
 
-//-----------------------------------------------------------------------------
-// Types for timers and clocks
+/*---------------------------------------------------------------------------*/
+/* Types for timers and clocks */
 
 typedef int clockid_t;
 
+#ifdef CYGPKG_POSIX_TIMERS
 typedef int timer_t;
 
-// forward declaration - if the app uses it it will have to include
-// signal.h anyway
+/* forward declaration - if the app uses it it will have to include
+ * signal.h anyway
+ */
 struct sigevent;
+#endif
 
-//-----------------------------------------------------------------------------
-// Structures
+/*---------------------------------------------------------------------------*/
+/* Structures */
 
 struct timespec
 {
@@ -69,62 +73,70 @@ struct timespec
     long        tv_nsec;
 };
 
+#ifdef CYGPKG_POSIX_TIMERS
 struct itimerspec
 {
     struct timespec     it_interval;
     struct timespec     it_value;
 };
+#endif
 
-//-----------------------------------------------------------------------------
-// Manifest constants
+/*---------------------------------------------------------------------------*/
+/* Manifest constants */
 
 #define CLOCK_REALTIME          0
 
+#ifdef CYGPKG_POSIX_TIMERS
 #define TIMER_ABSTIME           1
+#endif
 
-//-----------------------------------------------------------------------------
-// Clock functions
+/*---------------------------------------------------------------------------*/
+/* Clock functions */
 
-// Set the clocks current time
-externC int clock_settime( clockid_t clock_id, const struct timespec *tp);
+/* Set the clocks current time */
+__externC int clock_settime( clockid_t clock_id, const struct timespec *tp);
 
-// Get the clocks current time
-externC int clock_gettime( clockid_t clock_id, struct timespec *tp);
+/* Get the clocks current time */
+__externC int clock_gettime( clockid_t clock_id, struct timespec *tp);
 
-// Get the clocks resolution
-externC int clock_getres( clockid_t clock_id, struct timespec *tp);
+/* Get the clocks resolution */
+__externC int clock_getres( clockid_t clock_id, struct timespec *tp);
 
 
-//-----------------------------------------------------------------------------
-// Timer functions
+/*---------------------------------------------------------------------------*/
+/* Timer functions */
+
+#ifdef CYGPKG_POSIX_TIMERS
 
-// Create a timer based on the given clock.
-externC int timer_create( clockid_t clock_id,
-                          struct sigevent *evp,
-                          timer_t *timer_id);
+/* Create a timer based on the given clock. */
+__externC int timer_create( clockid_t clock_id,
+                            struct sigevent *evp,
+                            timer_t *timer_id);
 
-// Delete the timer
-externC int timer_delete( timer_t timer_id );
+/* Delete the timer */
+__externC int timer_delete( timer_t timer_id );
 
-// Set the expiration time of the timer.
-externC int timer_settime( timer_t timerid, int flags,
-                           const struct itimerspec *value,
-                           struct itimerspec *ovalue );
+/* Set the expiration time of the timer. */
+__externC int timer_settime( timer_t timerid, int flags,
+                             const struct itimerspec *value,
+                             struct itimerspec *ovalue );
 
-// Get current timer values
-externC int timer_gettime( timer_t timerid, struct itimerspec *value );
+/* Get current timer values */
+__externC int timer_gettime( timer_t timerid, struct itimerspec *value );
 
-// Get number of missed triggers
-externC int timer_getoverrun( timer_t timerid );
+/* Get number of missed triggers */
+__externC int timer_getoverrun( timer_t timerid );
+
+#endif
 
-//-----------------------------------------------------------------------------
-// Nanosleep
+/*---------------------------------------------------------------------------*/
+/* Nanosleep */
 
-// Sleep for the given time.
-externC int nanosleep( const struct timespec *rqtp,
-                       struct timespec *rmtp);
+/* Sleep for the given time. */
+__externC int nanosleep( const struct timespec *rqtp,
+                         struct timespec *rmtp);
 
 
-//-----------------------------------------------------------------------------
-#endif // ifndef CYGONCE_POSIX_TIME_H
-// End of time.h
+/*---------------------------------------------------------------------------*/
+#endif /* ifndef CYGONCE_POSIX_TIME_H */
+/* End of time.h */
--- a/packages/compat/posix/current/src/pprivate.h
+++ b/packages/compat/posix/current/src/pprivate.h
@@ -104,8 +104,10 @@ typedef struct
 
     struct pthread_cleanup_buffer *cancelbuffer; // stack of cleanup buffers
 
+#ifdef CYGPKG_POSIX_SIGNALS
     sigset_t            sigpending;     // Set of pending signals
     sigset_t            sigmask;        // Thread's signal mask
+#endif
     
     // The following is space for the eCos thread object that underlies
     // this POSIX thread. It is allocated like this to avoid constructing
@@ -199,7 +201,9 @@ externC pthread_info *pthread_self_info(
 
 externC pthread_info *pthread_info_id( pthread_t id );
 
+# ifdef CYGPKG_POSIX_SIGNALS
 externC void cyg_posix_pthread_release_thread( sigset_t *mask );
+# endif
 #endif
 
 //-----------------------------------------------------------------------------
--- a/packages/compat/posix/current/src/pthread.cxx
+++ b/packages/compat/posix/current/src/pthread.cxx
@@ -269,12 +269,16 @@ static void posix_asr( CYG_ADDRWORD data
 {
     pthread_info *self = (pthread_info *)data;
 
+#ifdef CYGPKG_POSIX_TIMERS
     // Call into timer subsystem to deliver any pending
     // timer expirations.
     cyg_posix_timer_asr(self);
+#endif
     
+#ifdef CYGPKG_POSIX_SIGNALS
     // Call signal subsystem to deliver any signals
     cyg_posix_signal_asr(self);
+#endif
     
     // Check for cancellation
     if( self->cancelpending &&
@@ -341,8 +345,10 @@ static void pthread_reap()
             // destroy the joiner condvar
             thread->joiner->~Cyg_Condition_Variable();
 
+#ifdef CYGPKG_POSIX_SIGNALS
             // Destroy signal handling fields
             cyg_posix_thread_sigdestroy( thread );
+#endif
             
             // Free the stack if we allocated it
             if( thread->freestack )
@@ -390,6 +396,7 @@ externC void cyg_posix_pthread_start( vo
     pthread_create( &main_thread, &attr, call_main, NULL );    
 }
 
+#ifdef CYGPKG_POSIX_SIGNALS
 //-----------------------------------------------------------------------------
 // Look for a thread that can accept delivery of any of the signals in
 // the mask and release it from any wait it is in.  Since this may be
@@ -426,6 +433,7 @@ externC void cyg_posix_pthread_release_t
             count--;
     }
 }
+#endif
 
 //=============================================================================
 // General thread operations
@@ -580,8 +588,10 @@ externC int pthread_create ( pthread_t *
 
     nthread->joiner = new(nthread->joiner_obj) Cyg_Condition_Variable( pthread_mutex );
 
+#ifdef CYGPKG_POSIX_SIGNALS
     // Initialize signal specific fields.
     cyg_posix_thread_siginit( nthread, self );
+#endif
 
     // create the underlying eCos thread
 
--- a/packages/compat/posix/current/src/signal.cxx
+++ b/packages/compat/posix/current/src/signal.cxx
@@ -984,28 +984,6 @@ externC int pause( void )
     SIGNAL_RETURN(EINTR);
 }
 
-// -------------------------------------------------------------------------
-// Wait for a signal, or the given number of seconds
-
-externC unsigned int sleep( unsigned int seconds )
-{
-    SIGNAL_ENTRY();
-
-    struct timespec timeout;
-
-    timeout.tv_sec = seconds;
-    timeout.tv_nsec = 0;
-
-    if( nanosleep( &timeout, &timeout ) != 0 )
-    {
-        CYG_REPORT_RETVAL(timeout.tv_sec);
-        return timeout.tv_sec;
-    }
-
-    CYG_REPORT_RETVAL(0);
-    return 0;
-} 
-
 //==========================================================================
 // Signal sets
 
--- a/packages/compat/posix/current/src/time.cxx
+++ b/packages/compat/posix/current/src/time.cxx
@@ -46,7 +46,7 @@
 
 #include <pkgconf/posix.h>
 
-#ifdef CYGPKG_POSIX_TIMERS
+#ifdef CYGPKG_POSIX_CLOCKS
 
 #include <pkgconf/hal.h>
 #include <pkgconf/kernel.h>
@@ -87,6 +87,7 @@ CYG_MACRO_END
 //==========================================================================
 // Timer control structures
 
+#ifdef CYGPKG_POSIX_TIMERS
 typedef struct
 {
     timer_t             id;             // id value for checking
@@ -117,6 +118,8 @@ static int timer_next = 0;
 #define TIMER_ID_COOKIE_MASK (TIMER_ID_COOKIE_INC-1)
 static timer_t timer_id_cookie = TIMER_ID_COOKIE_INC;
 
+#endif // ifdef CYGPKG_POSIX_TIMERS
+
 //-----------------------------------------------------------------------------
 // new operator to allow us to invoke the constructor on
 // posix_timer.alarm_obj.
@@ -232,6 +235,7 @@ externC void cyg_posix_clock_start()
     init_converters();
 }
 
+#ifdef CYGPKG_POSIX_TIMERS
 //==========================================================================
 // Alarm action routine
 // This is called each time an alarm set up by a timer expires.
@@ -295,6 +299,8 @@ externC void cyg_posix_timer_asr( pthrea
     }
 }
 
+#endif // ifdef CYGPKG_POSIX_TIMERS
+
 //==========================================================================
 // Clock functions
 
@@ -362,6 +368,8 @@ externC int clock_getres( clockid_t cloc
 //==========================================================================
 // Timer functions
 
+#ifdef CYGPKG_POSIX_TIMERS
+
 //-----------------------------------------------------------------------------
 // Create a timer based on the given clock.
 
@@ -598,6 +606,8 @@ externC int timer_getoverrun( timer_t ti
     return overrun;
 }
 
+#endif // ifdef CYGPKG_POSIX_TIMERS
+
 //==========================================================================
 // Nanosleep
 // Sleep for the given time.
@@ -610,7 +620,7 @@ externC int nanosleep( const struct time
     TIME_ENTRY();
 
     // check for cancellation first.
-    pthread_testcancel();
+    PTHREAD_TESTCANCEL();
 
     // Fail an invalid timespec
     if( !valid_timespec( rqtp ) )
@@ -625,13 +635,12 @@ externC int nanosleep( const struct time
 
     CYG_ASSERT( ticks != 0, "Zero tick count");
     
-    pthread_info *self = pthread_self_info();
-
+    Cyg_Thread *self = Cyg_Thread::self();
     
     // Do the delay, keeping track of how long we actually slept for.
     then = Cyg_Clock::real_time_clock->current_value();
 
-    self->thread->delay( ticks );
+    self->delay( ticks );
 
     now = Cyg_Clock::real_time_clock->current_value();
 
@@ -649,12 +658,33 @@ externC int nanosleep( const struct time
     }
     
     // check if we were woken up because we were cancelled.
-    pthread_testcancel();
+    PTHREAD_TESTCANCEL();
 
     TIME_RETURN(0);
 }    
 
-#endif // ifdef CYGPKG_POSIX_TIMERS
+// -------------------------------------------------------------------------
+// Wait for a signal, or the given number of seconds
+
+externC unsigned int sleep( unsigned int seconds )
+{
+    TIME_ENTRY();
+
+    struct timespec timeout;
+
+    timeout.tv_sec = seconds;
+    timeout.tv_nsec = 0;
+
+    if( nanosleep( &timeout, &timeout ) != 0 )
+    {
+        CYG_REPORT_RETVAL(timeout.tv_sec);
+        return timeout.tv_sec;
+    }
+
+    TIME_RETURN(0);
+} 
+
+#endif // ifdef CYGPKG_POSIX_CLOCKS
 
 // -------------------------------------------------------------------------
 // EOF time.cxx
--- a/packages/compat/posix/current/tests/mutex3.c
+++ b/packages/compat/posix/current/tests/mutex3.c
@@ -115,7 +115,7 @@ static int all_exit;
 // argument is 
 static CYG_ADDRWORD thread_data[NTHREADS];
 
-static int nthreads = 0;
+static volatile int nthreads = 0;
 
 // Sleep for 1 tick...
 static struct timespec sleeptime;
@@ -127,31 +127,32 @@ static pthread_t new_thread( void *(*ent
                              int do_resume)
 {
     pthread_attr_t attr;
+    int _nthreads = nthreads++;
 
     struct sched_param schedparam;
     schedparam.sched_priority = priority;
         
     pthread_attr_init( &attr );
-    pthread_attr_setstackaddr( &attr, (void *)((char *)(&stack[nthreads])+STACKSIZE) );        
+    pthread_attr_setstackaddr( &attr, (void *)((char *)(&stack[_nthreads])+STACKSIZE) );        
     pthread_attr_setstacksize( &attr, STACKSIZE );
     pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
     pthread_attr_setschedpolicy( &attr, SCHED_RR );
     pthread_attr_setschedparam( &attr, &schedparam );
     
-    CYG_ASSERT(nthreads < NTHREADS, 
+    CYG_ASSERT(_nthreads < NTHREADS, 
                "Attempt to create more than NTHREADS threads");
 
-    thread_data[nthreads] = data;
+    thread_data[_nthreads] = data;
 
-    sem_init( &hold[nthreads], 0, do_resume ? 1 : 0 );
+    sem_init( &hold[_nthreads], 0, do_resume ? 1 : 0 );
     all_exit = 0;
-    
-    pthread_create( &thread[nthreads],
+
+    pthread_create( &thread[_nthreads],
                     &attr,
                     entry,
-                    (void *)nthreads);
+                    (void *)_nthreads);
 
-    return thread[nthreads++];
+    return thread[_nthreads];
 }
 
 
@@ -234,6 +235,7 @@ static void *extra_thread( void *arg )
 
     XINFO( exiting );
 
+    return NULL;
 }
 
 // ------------------------------------------------------------------------
--- a/packages/compat/posix/current/tests/signal2.c
+++ b/packages/compat/posix/current/tests/signal2.c
@@ -53,6 +53,8 @@
 
 #if CYGINT_ISO_SETJMP == 0
 # define NA_MSG "Requires setjmp/longjmp implementation"
+#elif !defined(CYGPKG_POSIX_SIGNALS)
+# define NA_MSG "POSIX signals not enabled"
 #endif
 
 #ifdef NA_MSG
@@ -117,7 +119,7 @@ cause_illegal_access(void)
     {
         x = *(volatile int *)(p);
         p += (CYG_ADDRESS)0x100000;
-    } while( p != &jbuf );
+    } while( p != (CYG_ADDRESS)&jbuf );
 
 #endif    
 } // cause_illegal_access()
--- a/packages/devs/eth/amd/pcnet/current/ChangeLog
+++ b/packages/devs/eth/amd/pcnet/current/ChangeLog
@@ -1,3 +1,21 @@
+2001-10-16  David Howells  <dhowells@redhat.com>
+
+	* src/if_pcnet.c: don't invert the logic of the auto-negotiation
+	completion flag.
+
+2001-10-16  David Howells  <dhowells@redhat.com>
+
+	* src/if_pcnet.c: check the correct flag to determine end of
+	auto-negotiation.
+	* src/amd_pcnet.h: ditto	
+	
+2001-10-15  David Howells  <dhowells@redhat.com>
+
+	* cdl/amd_pcnet_eth_drivers.cdl: added option to force 10Mbps only
+	speed negotiation.
+	* src/amd_pcnet.h: ditto
+	* src/if_pcnet.c: ditto
+
 2001-09-12  Jesper Skov  <jskov@redhat.com>
 
 	* src/amd_pcnet.h: fix warning.
--- a/packages/devs/eth/amd/pcnet/current/cdl/amd_pcnet_eth_drivers.cdl
+++ b/packages/devs/eth/amd/pcnet/current/cdl/amd_pcnet_eth_drivers.cdl
@@ -66,6 +66,16 @@ cdl_package CYGPKG_DEVS_ETH_AMD_PCNET {
             be supported by the driver."
     }
 
+    cdl_option CYGSEM_DEVS_ETH_AMD_PCNET_FORCE_10MBPS {
+        display       "Force negotiation of a 10Mbps link"
+        flavor        bool
+        default_value 0
+        description   "
+          If this option is enabled then the driver will force the chipset
+          to negotiate only for a 10Mbps link (rather than a 100Mbps
+          link)."
+    }
+
     cdl_component CYGPKG_DEVS_ETH_AMD_PCNET_OPTIONS {
         display "PCNET ethernet driver build options"
         flavor  none
--- a/packages/devs/eth/amd/pcnet/current/src/amd_pcnet.h
+++ b/packages/devs/eth/amd/pcnet/current/src/amd_pcnet.h
@@ -256,12 +256,21 @@
 // ANR registers
 #define PCNET_ANR_PHYCTRL ( 0 |PCNET_ANR_FLAG)
 #define PCNET_ANR_PHYSTAT ( 1 |PCNET_ANR_FLAG)
+#define PCNET_ANR_AAR     ( 4 |PCNET_ANR_FLAG)
 
-#define PCNET_ANR_PHYCTRL_100MBPS 0x2000
-#define PCNET_ANR_PHYCTRL_DUPLEX  0x0100
+#define PCNET_ANR_PHYCTRL_100MBPS     0x2000
+#define PCNET_ANR_PHYCTRL_RENEGOTIATE 0x0200
+#define PCNET_ANR_PHYCTRL_DUPLEX      0x0100
+
+#define PCNET_ANR_PHYSTAT_AUTONEG_COMP    0x0020
+#define PCNET_ANR_PHYSTAT_LINK            0x0004
 
-#define PCNET_ANR_PHYSTAT_LINK    0x0004
-
+#define PCNET_ANR_AAR_100_FD      0x0100
+#define PCNET_ANR_AAR_100_HD      0x0080
+#define PCNET_ANR_AAR_100         0x0180
+#define PCNET_ANR_AAR_10_FD       0x0040
+#define PCNET_ANR_AAR_10_HD       0x0020
+#define PCNET_ANR_AAR_10          0x0060
 
 //----------------------------------------------------------------------------
 // Receive buffer Descriptor
--- a/packages/devs/eth/amd/pcnet/current/src/if_pcnet.c
+++ b/packages/devs/eth/amd/pcnet/current/src/if_pcnet.c
@@ -67,6 +67,7 @@
 #include <cyg/infra/diag.h>
 #include <cyg/hal/drv_api.h>
 #include <cyg/hal/hal_if.h>             // delays
+#include <string.h>
 #include <netdev.h>
 #include <eth_drv.h>
 #ifdef CYGPKG_NET
@@ -463,9 +464,40 @@ amd_pcnet_init(struct cyg_netdevtab_entr
                 cpd->esa[3], cpd->esa[4], cpd->esa[5] );
 #endif
 
+#if CYGSEM_DEVS_ETH_AMD_PCNET_FORCE_10MBPS
+    if (get_reg(sc,PCNET_ANR_AAR) & PCNET_ANR_AAR_100) {
+        cyg_uint16 anr;
+	int loop;
+
+#if DEBUG & 9
+	diag_printf("%s: Forcing 10Mbps negotiation\n", __FUNCTION__);
+#endif
+	// adjust speed/duplex auto-negotiation mask to clear 100Mbps bits
+	anr = get_reg(sc,PCNET_ANR_AAR);
+	anr &= ~PCNET_ANR_AAR_100;
+	put_reg(sc,PCNET_ANR_AAR,anr);
+	// renegotiate
+	anr = get_reg(sc,PCNET_ANR_PHYCTRL);
+	anr |= PCNET_ANR_PHYCTRL_RENEGOTIATE;
+	put_reg(sc,PCNET_ANR_PHYCTRL,anr);
+	loop = 100000;
+	while (loop>0 && !(get_reg(sc,PCNET_ANR_PHYSTAT) & PCNET_ANR_PHYSTAT_AUTONEG_COMP))
+		loop--;
+#if DEBUG & 9
+	diag_printf("ANR0: %04x\n",get_reg(sc,PCNET_ANR_PHYCTRL));
+	diag_printf("ANR1: %04x\n",get_reg(sc,PCNET_ANR_PHYSTAT));
+	diag_printf("ANR4: %04x\n",get_reg(sc,PCNET_ANR_AAR));
+#endif
+    }
+#endif
+
     // Prepare RX and TX rings
     p = cpd->rx_ring = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS((cyg_uint32)pciwindow_mem_alloc((1<<cpd->rx_ring_log_cnt)*PCNET_RD_SIZE));
+    memset(cpd->rx_ring,0,(1<<cpd->rx_ring_log_cnt)*PCNET_RD_SIZE);
+
     d = cpd->rx_buffers = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS((cyg_uint32)pciwindow_mem_alloc(_BUF_SIZE*cpd->rx_ring_cnt));
+    memset(cpd->rx_buffers,0,_BUF_SIZE*cpd->rx_ring_cnt);
+
     for (i = 0; i < cpd->rx_ring_cnt; i++) {
         HAL_PCI_CPU_TO_BUS(d, b);
         _SU32(p, PCNET_RD_PTR) = (b & PCNET_RD_PTR_MASK) | PCNET_RD_PTR_OWN;
@@ -476,6 +508,8 @@ amd_pcnet_init(struct cyg_netdevtab_entr
     cpd->rx_ring_next = 0;
 
     p = cpd->tx_ring = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS((cyg_uint32)pciwindow_mem_alloc((1<<cpd->tx_ring_log_cnt)*PCNET_TD_SIZE));
+    memset(cpd->tx_ring,0,(1<<cpd->tx_ring_log_cnt)*PCNET_TD_SIZE);
+
     d = cpd->tx_buffers = (cyg_uint8*) CYGARC_UNCACHED_ADDRESS((cyg_uint32)pciwindow_mem_alloc(_BUF_SIZE*cpd->tx_ring_cnt));
     for (i = 0; i < cpd->tx_ring_cnt; i++) {
         HAL_PCI_CPU_TO_BUS(d, b);
--- a/packages/devs/eth/arm/edb7xxx/current/ChangeLog
+++ b/packages/devs/eth/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,13 @@
+2001-10-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/if_edb7xxx.c (cs8900_TxEvent): Use cyg_io_eth_net_debug now,
+	conditionally on CYGDBG_IO_ETH_DRIVERS_DEBUG in common eth driver.
+	(cs8900_RxEvent): Ditto.
+
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/edb7xxx_eth_drivers.cdl: Clarify package description strings.
+
 2001-09-25  Gary Thomas  <gthomas@redhat.com>
 
 	* src/if_edb7xxx.c (edb7xxx_cs8900_init): Handle case where device
--- a/packages/devs/eth/arm/edb7xxx/current/cdl/edb7xxx_eth_drivers.cdl
+++ b/packages/devs/eth/arm/edb7xxx/current/cdl/edb7xxx_eth_drivers.cdl
@@ -42,7 +42,7 @@
 # ====================================================================
 
 cdl_package CYGPKG_DEVS_ETH_ARM_EDB7XXX {
-    display       "Cirrus Logic ethernet driver"
+    display       "Cirrus Logic ethernet driver for EP7xxx boards"
 
     parent        CYGPKG_IO_ETH_DRIVERS
     active_if	  CYGPKG_IO_ETH_DRIVERS
@@ -52,7 +52,8 @@ cdl_package CYGPKG_DEVS_ETH_ARM_EDB7XXX 
     implements    CYGHWR_NET_DRIVER_ETH0
     include_dir   .
     include_files ; # none _exported_ whatsoever
-    description   "Ethernet driver for Cirrus Logic EDB7xxx boards."
+    description   "Ethernet driver for Cirrus Logic EP7xxx based
+                  development boards."
     compile       -library=libextras.a if_edb7xxx.c
 
     cdl_component CYGSEM_ARM_EDB7XXX_SET_ESA {
--- a/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c
+++ b/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c
@@ -61,6 +61,7 @@
 #include <pkgconf/net.h>
 #include <cyg/kernel/kapi.h>
 #endif
+#include <pkfconf/io_eth_drivers.h>
 #include <cyg/infra/cyg_type.h>
 #include <cyg/hal/hal_arch.h>
 #include <cyg/hal/hal_intr.h>
@@ -99,7 +100,9 @@ static void cs8900_fake_int(cyg_addrword
 #include "cs8900.h"
 #define ETHER_ADDR_LEN 6
 
-extern int net_debug; // FIXME
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+extern int cyg_io_eth_net_debug;
+#endif
 
 struct cs8900_priv_data {
     int txbusy;            // A packet has been sent
@@ -413,9 +416,11 @@ cs8900_RxEvent(struct eth_drv_sc *sc)
 
     stat = CS8900_RTDATA;
     len = CS8900_RTDATA;
-    if (net_debug) {
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+    if (cyg_io_eth_net_debug) {
         diag_printf("RxEvent - stat: %x, len: %d\n", stat, len);
     }
+#endif
     (sc->funs->eth_drv->recv)(sc, len);
 }
 
@@ -459,9 +464,11 @@ cs8900_TxEvent(struct eth_drv_sc *sc, in
     struct cs8900_priv_data *cpd = (struct cs8900_priv_data *)sc->driver_private;
 
     stat = get_reg(PP_TER);
-    if (net_debug) {
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+    if (cyg_io_eth_net_debug) {
         diag_printf("Tx event: %x\n", stat);
     }
+#endif
     cpd->txbusy = 0;
     (sc->funs->eth_drv->tx_done)(sc, cpd->txkey, 0);
 }
--- a/packages/devs/eth/arm/iq80310/current/ChangeLog
+++ b/packages/devs/eth/arm/iq80310/current/ChangeLog
@@ -1,3 +1,18 @@
+2001-10-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/iq80310_info.h: Remove MAX_TX_DESCRIPTORS and 
+	MAX_RX_DESCRIPTORS, to be replaced by...
+	* cdl/iq80310_eth_drivers.cdl: Add
+	CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_TX_DESCRIPTORS and
+	CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_RX_DESCRIPTORS.
+	* src/if_shmem.S: Use above definitions to calculate size of
+	shared mem.	
+	* src/if_iq80310.c (CYGHWR_HAL_ARM_IQ80310_PCI_MEM_MAP_SIZE): Ditto.
+
+2001-10-09  Jesper Skov  <jskov@redhat.com>
+
+	* src/if_iq80310.c: Made code build with assertions.
+
 2001-08-24  Mark Salter  <msalter@redhat.com>
 
 	* src/if_iq80310.c (PacketRxReady): Break out of Rx loop after
--- a/packages/devs/eth/arm/iq80310/current/cdl/iq80310_eth_drivers.cdl
+++ b/packages/devs/eth/arm/iq80310/current/cdl/iq80310_eth_drivers.cdl
@@ -89,6 +89,38 @@ cdl_package CYGPKG_DEVS_ETH_ARM_IQ80310 
             be supported by the driver."
     }
 
+    cdl_option CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_RX_DESCRIPTORS {
+        display       "Maximum number of RX descriptors"
+        default_value { CYGPKG_REDBOOT ? 4 : 128 }
+        define        MAX_RX_DESCRIPTORS
+        description   "
+                An RX descriptor is used for each ethernet frame required
+                to be passed to the upper networking layers. This option
+                sets the maximum number of these. Higher numbers use more
+                memory, lower numbers will reduce performance. The system
+                appears to work OK with as few as 8 descriptors but limps
+                painfully with only 4. Performance is better with more than
+                8, but since the size of non-cached (so useless for anything
+                else) memory window is 1Mb, we might as well use it all.
+                128 RX and TX descriptors uses the whole 1Mb, near enough."
+    }
+
+    cdl_option CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_TX_DESCRIPTORS {
+        display       "Maximum number of TX descriptors"
+        default_value { CYGPKG_REDBOOT ? 4 : 128 }
+        define        MAX_TX_DESCRIPTORS
+        description   "
+                A TX descriptor is used for each ethernet frame passed down
+                from upper networking layers for transmission. This option
+                sets the maximum number of these. Higher numbers use more
+                memory, lower numbers will reduce performance. The system
+                appears to work OK with as few as 8 descriptors but limps
+                painfully with only 4. Performance is better with more than
+                8, but since the size of non-cached (so useless for anything
+                else) memory window is 1Mb, we might as well use it all.
+                128 RX and TX descriptors uses the whole 1Mb, near enough."
+    }
+
     cdl_component CYGDBG_DEVS_ETH_ARM_IQ80310_KEEP_STATISTICS {
 	display "Keep Ethernet statistics"
 	default_value 1
--- a/packages/devs/eth/arm/iq80310/current/include/iq80310_info.h
+++ b/packages/devs/eth/arm/iq80310/current/include/iq80310_info.h
@@ -108,28 +108,6 @@ extern I82559_COUNTERS i82559_counters[2
 //                      DEVICES AND PACKET QUEUES
 //
 // ------------------------------------------------------------------------
-// The system seems to work OK with as few as 8 of RX and TX descriptors.
-// It limps very painfully with only 4.
-// Performance is better with more than 8.
-// But the size of non-cached (so useless for anything else)
-// memory window is 1Mb, so we might as well use it all.
-//
-// 128 for these uses the whole 1Mb, near enough.
-
-#ifndef MAX_RX_DESCRIPTORS
-#ifdef CYGPKG_REDBOOT
-#define MAX_RX_DESCRIPTORS	4       // number of Rx descriptors
-#else
-#define MAX_RX_DESCRIPTORS	128     // number of Rx descriptors
-#endif
-#endif
-#ifndef MAX_TX_DESCRIPTORS
-#ifdef CYGPKG_REDBOOT
-#define MAX_TX_DESCRIPTORS	4       // number of Tx descriptors
-#else
-#define MAX_TX_DESCRIPTORS	128     // number of Tx descriptors
-#endif
-#endif
 
 
 typedef struct i82559 {
--- a/packages/devs/eth/arm/iq80310/current/src/if_iq80310.c
+++ b/packages/devs/eth/arm/iq80310/current/src/if_iq80310.c
@@ -87,6 +87,15 @@
 #include <cyg/devs/eth/iq80310_info.h>
 #include <eth_drv_stats.h>
 
+extern char cyg_io_iq80310_i82559_shmem[];
+#define CYGHWR_HAL_ARM_IQ80310_PCI_MEM_MAP_BASE ((cyg_addrword_t)cyg_io_iq80310_i82559_shmem)
+// This must match actual size in if_shmem.S:
+#define CYGHWR_HAL_ARM_IQ80310_PCI_MEM_MAP_SIZE        \
+  ((MAX_RX_PACKET_SIZE + sizeof(RFD)) *                \
+   (CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_TX_DESCRIPTORS +   \
+    CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_RX_DESCRIPTORS))
+
+
 // ------------------------------------------------------------------------
 
 #ifdef CYGDBG_DEVS_ETH_ARM_IQ80310_CHATTER
@@ -2109,7 +2118,6 @@ pci_init_find_82559s( void )
     cyg_pci_device dev_info;
     cyg_uint16 cmd;
     int device_index;
-    extern char cyg_io_iq80310_i82559_shmem[];
 
 #ifdef DEBUG
     db_printf("pci_init_find_82559s()\n");
@@ -2124,11 +2132,11 @@ pci_init_find_82559s( void )
     }
 
     // First initialize the heap in PCI window'd memory
-    i82559_heap_size = 16*1024;  // match actual size in if_shmem.S
-    i82559_heap_base = cyg_io_iq80310_i82559_shmem;
+    i82559_heap_size = CYGHWR_HAL_ARM_IQ80310_PCI_MEM_MAP_SIZE;  
+    i82559_heap_base = (cyg_uint8*)CYGHWR_HAL_ARM_IQ80310_PCI_MEM_MAP_BASE;
 
     // only first 1MB of board uses 4K page table
-    if (cyg_io_iq80310_i82559_shmem > (char *)0xa0100000) {
+    if (CYGHWR_HAL_ARM_IQ80310_PCI_MEM_MAP_BASE > (cyg_addrword_t)0xa0100000) {
 #ifdef DEBUG
         db_printf("Can't get shared mem\n");
 #endif
--- a/packages/devs/eth/arm/iq80310/current/src/if_shmem.S
+++ b/packages/devs/eth/arm/iq80310/current/src/if_shmem.S
@@ -36,22 +36,24 @@
 // # Contributors:  msalter
 // # Date:          2000-11-03
 // # Purpose:       
-// # Description:   This file defines a chunk of 4Kbyte aligned memory for use
+// # Description:   This file defines a chunk of aligned memory for use
 // #                by bus-mastering PCI ethernet device.
 // #
 // #####DESCRIPTIONEND####
 // #
 // #========================================================================
 
+#include <pkgconf/devs_eth_arm_iq80310.h>
+        
+#define MAX_PACKET_SIZE   1536
+#define SIZEOF_DESCRIPTOR 16
 	
 	.bss
 	.p2align(12)
 	.globl cyg_io_iq80310_i82559_shmem
 cyg_io_iq80310_i82559_shmem:
-	.rept 16*1024
+	.rept ((MAX_PACKET_SIZE + SIZEOF_DESCRIPTOR) * \
+               (CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_TX_DESCRIPTORS + \
+                CYGNUM_DEVS_ETH_ARM_IQ80310_MAX_RX_DESCRIPTORS))
 	.byte 0
 	.endr
-
-
-	
-	
\ No newline at end of file
--- a/packages/devs/eth/cf/current/ChangeLog
+++ b/packages/devs/eth/cf/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-16  Jesper Skov  <jskov@redhat.com>
+
+	* include/devs_eth_cf.inl: Added buffer parameters.
+
 2001-08-25  Gary Thomas  <gthomas@redhat.com>
 
 	* src/if_sc_lpe.c (sc_lpe_card_handler): Rework ESA discovery code.
--- a/packages/devs/eth/cf/current/include/devs_eth_cf.inl
+++ b/packages/devs/eth/cf/current/include/devs_eth_cf.inl
@@ -63,6 +63,10 @@ externC bool cyg_sc_lpe_init(struct cyg_
 #ifdef CYGPKG_DEVS_ETH_CF_ETH0
 
 static dp83902a_priv_data_t dp83902a_eth0_priv_data = { 
+    tx_buf1: 0x40,
+    tx_buf2: 0x48,
+    rx_buf_start: 0x50,
+    rx_buf_end: 0x80,
 #ifdef CYGSEM_DEVS_ETH_CF_ETH0_SET_ESA
     esa : CYGDAT_DEVS_ETH_CF_ETH0_ESA,
     hardwired_esa : true,
--- a/packages/devs/eth/mips/atlas/current/ChangeLog
+++ b/packages/devs/eth/mips/atlas/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/if_atlas.c: net_debug is no longer used.
+
 2001-10-05  Jesper Skov  <jskov@redhat.com>
 
 	* src/if_atlas.c: Use new HAL endian conversion macros.
--- a/packages/devs/eth/mips/atlas/current/src/if_atlas.c
+++ b/packages/devs/eth/mips/atlas/current/src/if_atlas.c
@@ -105,8 +105,6 @@ RedBoot_config_option("Network hardware 
 
 #define ETHER_ADDR_LEN 6
 
-extern int net_debug; // FIXME
-
 static unsigned poll_count = 0;  // for bug workaround
 static void __tx_poll(struct eth_drv_sc *sc);
 
--- a/packages/devs/eth/ns/dp83902a/current/ChangeLog
+++ b/packages/devs/eth/ns/dp83902a/current/ChangeLog
@@ -1,3 +1,26 @@
+2001-10-16  Jesper Skov  <jskov@redhat.com>
+
+	* include/dp83902a.h: Removed hardwired buffer
+	allocation. Replaced with per-device configuration.
+	* src/if_dp83902a.c: Same.
+
+2001-10-15  Jesper Skov  <jskov@redhat.com>
+
+	* include/dp83902a.h: Added new page allocation layout.
+
+2001-10-12  Gary Thomas  <gthomas@redhat.com>
+
+	* src/if_dp83902a.c: Leave out interrupt code - not needed in 
+	non-NET configurations.
+
+2001-10-10  Gary Thomas  <gthomas@redhat.com>
+
+	* src/if_dp83902a.c: 
+	* include/dp83902a.h: More flexible setup.  Chip reset address is
+	now in device data, along with changes to the PLF reset functions.
+	Also, a new PLF init function can be defined which allows the driver
+	to work in a PCI enviroment (addresses unknown at compile time).
+
 2001-09-12  Jesper Skov  <jskov@redhat.com>
 
 	* src/if_dp83902a.c: Apply a little more DMA magic.
--- a/packages/devs/eth/ns/dp83902a/current/include/dp83902a.h
+++ b/packages/devs/eth/ns/dp83902a/current/include/dp83902a.h
@@ -94,6 +94,7 @@
 typedef struct dp83902a_priv_data {
     cyg_uint8* base;
     cyg_uint8* data;
+    cyg_uint8* reset;
     int tx_next;           // First free Tx page
     int tx_int;            // Expecting interrupt from this buffer
     int rx_next;           // First free Rx page
@@ -111,6 +112,10 @@ typedef struct dp83902a_priv_data {
     // For debugging
     volatile int cr_lock;
     volatile int cr_owner;
+
+    // Buffer allocation
+    int tx_buf1, tx_buf2;
+    int rx_buf_start, rx_buf_end;
 } dp83902a_priv_data_t;
 
 // ------------------------------------------------------------------------
@@ -179,6 +184,10 @@ typedef struct dp83902a_priv_data {
 # define CYGHWR_NS_DP83902A_PLF_INT_CLEAR(_dp_)
 #endif
 
+#ifndef CYGHWR_NS_DP83902A_PLF_INIT
+#define CYGHWR_NS_DP83902A_PLF_INIT(dp) do { } while (0)
+#endif
+
 // ------------------------------------------------------------------------
 // Hack that should go away, probably
 #define CR_UP()                                                  \
@@ -361,14 +370,6 @@ static void dp83902a_poll(struct eth_drv
 #define DP_TSR_CDH    0x40   // Collision Detect Heartbeat
 #define DP_TSR_OWC    0x80   // Collision outside normal window
 
-// Page (buffer) allocation
-// FIXME: Driver should use more RX and (in particular) TX buffers,
-// limit these on variants where required (CF Low Power)
-#define DP_TX_BUF1    0x40
-#define DP_TX_BUF2    0x48
-#define DP_RX_START   0x50
-#define DP_RX_STOP    0x80
-
 #define IEEE_8023_MAX_FRAME         1518    // Largest possible ethernet frame
 #define IEEE_8023_MIN_FRAME           64    // Smallest possible ethernet frame
 
--- a/packages/devs/eth/ns/dp83902a/current/src/if_dp83902a.c
+++ b/packages/devs/eth/ns/dp83902a/current/src/if_dp83902a.c
@@ -77,6 +77,7 @@
 #include CYGDAT_DEVS_ETH_NS_DP83902A_INL
 #undef __WANT_DEVS
 
+#ifdef CYGPKG_NET
 // This ISR is called when the ethernet interrupt occurs
 static cyg_uint32
 dp83902a_isr(cyg_vector_t vector, cyg_addrword_t data)
@@ -112,7 +113,7 @@ dp83902a_dsr(cyg_vector_t vector, cyg_uc
 # endif
 #endif
 }
-
+#endif // CYGPKG_NET
 
 // The deliver function (ex-DSR)  handles the ethernet [logical] processing
 static void
@@ -133,15 +134,19 @@ dp83902a_init(struct cyg_netdevtab_entry
 {
     struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance;
     dp83902a_priv_data_t *dp = (dp83902a_priv_data_t *)sc->driver_private;
-    cyg_uint8* base = dp->base;
+    cyg_uint8* base;
     int i;
 
     DEBUG_FUNCTION();
 
+    CYGHWR_NS_DP83902A_PLF_INIT(dp);
+    base = dp->base;
+    if (!base) return false;  // No device found
+
     dp->tab = tab;
     dp->cr_lock = 0;
 
-    CYGHWR_NS_DP83902A_PLF_RESET(base);
+    CYGHWR_NS_DP83902A_PLF_RESET(dp);
 
     DEBUG_LINE();
 
@@ -167,6 +172,7 @@ dp83902a_init(struct cyg_netdevtab_entry
                 dp->esa[4],
                 dp->esa[5] );
 
+#ifdef CYGPKG_NET
     cyg_drv_interrupt_create(
         dp->interrupt,
         0,                  // Priority - unused
@@ -178,6 +184,7 @@ dp83902a_init(struct cyg_netdevtab_entry
 
     cyg_drv_interrupt_attach(dp->interrupt_handle);
     cyg_drv_interrupt_unmask(dp->interrupt);
+#endif
 
     // Initialize upper level driver
     (sc->funs->eth_drv->init)(sc, dp->esa);
@@ -224,18 +231,18 @@ dp83902a_start(struct eth_drv_sc *sc, un
     DP_OUT(base, DP_RBCL, 0);
     DP_OUT(base, DP_RCR, DP_RCR_MON);     // Accept no packets
     DP_OUT(base, DP_TCR, DP_TCR_LOCAL);   // Transmitter [virtually] off
-    DP_OUT(base, DP_TPSR, DP_TX_BUF1);    // Transmitter start page
+    DP_OUT(base, DP_TPSR, dp->tx_buf1);    // Transmitter start page
     dp->tx1 = dp->tx2 = 0;
-    dp->tx_next = DP_TX_BUF1;
+    dp->tx_next = dp->tx_buf1;
     dp->tx_started = false;
-    DP_OUT(base, DP_PSTART, DP_RX_START); // Receive ring start page
-    DP_OUT(base, DP_BNDRY, DP_RX_STOP-1); // Receive ring boundary
-    DP_OUT(base, DP_PSTOP, DP_RX_STOP);   // Receive ring end page
-    dp->rx_next = DP_RX_START-1;
+    DP_OUT(base, DP_PSTART, dp->rx_buf_start); // Receive ring start page
+    DP_OUT(base, DP_BNDRY, dp->rx_buf_end-1); // Receive ring boundary
+    DP_OUT(base, DP_PSTOP, dp->rx_buf_end);   // Receive ring end page
+    dp->rx_next = dp->rx_buf_start-1;
     DP_OUT(base, DP_ISR, 0xFF);               // Clear any pending interrupts
     DP_OUT(base, DP_IMR, DP_IMR_All);     // Enable all interrupts
     DP_OUT(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE1);  // Select page 1
-    DP_OUT(base, DP_P1_CURP, DP_RX_START);   // Current page - next free page for Rx
+    DP_OUT(base, DP_P1_CURP, dp->rx_buf_start);   // Current page - next free page for Rx
     for (i = 0;  i < ETHER_ADDR_LEN;  i++) {
         DP_OUT(base, DP_P1_PAR0+i, enaddr[i]);
     }
@@ -337,16 +344,16 @@ dp83902a_send(struct eth_drv_sc *sc, str
 #endif
 
     start_page = dp->tx_next;
-    if (dp->tx_next == DP_TX_BUF1) {
+    if (dp->tx_next == dp->tx_buf1) {
         dp->tx1 = start_page;
         dp->tx1_len = pkt_len;
         dp->tx1_key = key;
-        dp->tx_next = DP_TX_BUF2;
+        dp->tx_next = dp->tx_buf2;
     } else {
         dp->tx2 = start_page;
         dp->tx2_len = pkt_len;
         dp->tx2_key = key;
-        dp->tx_next = DP_TX_BUF1;
+        dp->tx_next = dp->tx_buf1;
     }
     CR_UP();
 
@@ -493,7 +500,7 @@ dp83902a_RxEvent(struct eth_drv_sc *sc, 
             CR_DOWN();
             break;
         }
-        if (pkt == DP_RX_STOP) pkt = DP_RX_START;
+        if (pkt == dp->rx_buf_end) pkt = dp->rx_buf_start;
         DP_OUT(base, DP_RBCL, sizeof(rcv_hdr));
         DP_OUT(base, DP_RBCH, 0);
         DP_OUT(base, DP_RSAL, 0);
--- a/packages/devs/flash/arm/edb7xxx/current/ChangeLog
+++ b/packages/devs/flash/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/flash_edb7xxx.cdl: Move EP72xx flash into separate subcomponent.
+	Clarify package description strings.
 2001-06-11  Gary Thomas  <gthomas@redhat.com>
 
 	* src/edb7xxx_flash.c: Remove dependency on printf() via user functions.
--- a/packages/devs/flash/arm/edb7xxx/current/cdl/flash_edb7xxx.cdl
+++ b/packages/devs/flash/arm/edb7xxx/current/cdl/flash_edb7xxx.cdl
@@ -41,43 +41,49 @@
 # ====================================================================
 
 cdl_package CYGPKG_DEVS_FLASH_EDB7XXX {
-    display       "Cirrus Logic EDB7xxx FLASH memory support"
+    display       "FLASH support for Cirrus Logic EP7xxx based boards"
+    description   "FLASH memory device support for Cirrus Logic EP7xxx based 
+                   development boards"
 
     parent        CYGPKG_IO_FLASH
     active_if	  CYGPKG_IO_FLASH
     requires	  CYGPKG_HAL_ARM_EDB7XXX
-
-    implements    CYGHWR_IO_FLASH_DEVICE
-    implements    CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
-
-    include_dir   .
-    include_files ; # none _exported_ whatsoever
-    description   "FLASH memory device support for Cirrus Logic EDB7xxx boards"
-    compile       edb7xxx_flash.c
+    include_dir   cyg/io
 
-    make -priority 1 {
-        flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        echo " .globl flash_erase_block_end" >>flash_erase_block.s
-        echo "flash_erase_block_end:" >>flash_erase_block.s
-        $(CC) -c -o flash_erase_block.o flash_erase_block.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
-    }
-    make -priority 1 {
-        flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
-        echo " .globl flash_program_buf_end" >>flash_program_buf.s
-        echo "flash_program_buf_end:" >>flash_program_buf.s
-        $(CC) -c -o flash_program_buf.o flash_program_buf.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
-    }
-    make -priority 1 {
-        flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
-        echo " .globl flash_query_end" >>flash_query.s
-        echo "flash_query_end:" >>flash_query.s
-        $(CC) -c -o flash_query.o flash_query.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
+    cdl_component CYGPKG_DEVS_FLASH_EP72XX {
+        display       "Cirrus Logic EP72xx based boards"
+        description    "FLASH memory device support for EP72xx based boards
+                        specifically"
+        calculated    1
+        no_define
+        implements    CYGHWR_IO_FLASH_DEVICE
+        implements    CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
+    
+        compile       edb7xxx_flash.c
+    
+        make -priority 1 {
+            flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
+            $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
+            echo " .globl flash_erase_block_end" >>flash_erase_block.s
+            echo "flash_erase_block_end:" >>flash_erase_block.s
+            $(CC) -c -o flash_erase_block.o flash_erase_block.s
+            $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
+        }
+        make -priority 1 {
+            flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
+            $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
+            echo " .globl flash_program_buf_end" >>flash_program_buf.s
+            echo "flash_program_buf_end:" >>flash_program_buf.s
+            $(CC) -c -o flash_program_buf.o flash_program_buf.s
+            $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
+        }
+        make -priority 1 {
+            flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
+            $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -mcpu=strongarm -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
+            echo " .globl flash_query_end" >>flash_query.s
+            echo "flash_query_end:" >>flash_query.s
+            $(CC) -c -o flash_query.o flash_query.s
+            $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
+        }
     }
 }
-
--- a/packages/devs/flash/intel/28fxxx/current/ChangeLog
+++ b/packages/devs/flash/intel/28fxxx/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-17  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/flash_28fxxx_parts.inl: Fix boot block start address.
+
 2001-08-15  Jesper Skov  <jskov@redhat.com>
 	[from branch]
 	* include/flash_28fxxx_parts.inl: Set correct bootblock sub-block
--- a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl
+++ b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx_parts.inl
@@ -59,7 +59,7 @@
         locking    : true,
         buffered_w : false,
         bootblock  : true,
-        bootblocks : { 0x3e0000 * CYGNUM_FLASH_INTERLEAVE,
+        bootblocks : { 0x3f0000 * CYGNUM_FLASH_INTERLEAVE,
                        0x002000 * CYGNUM_FLASH_INTERLEAVE,
                        0x002000 * CYGNUM_FLASH_INTERLEAVE,
                        0x002000 * CYGNUM_FLASH_INTERLEAVE,
new file mode 100644
--- /dev/null
+++ b/packages/devs/serial/arm/e7t/current/ChangeLog
@@ -0,0 +1,30 @@
+2001-10-19  Lars Lindqvist  <Lars.Lindqvist@combitechsystems.com>
+2001-10-19  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* New package.
+
+//===========================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+//===========================================================================
new file mode 100644
--- /dev/null
+++ b/packages/devs/serial/arm/e7t/current/cdl/ser_arm_e7t.cdl
@@ -0,0 +1,202 @@
+# ====================================================================
+#
+#      ser_arm_e7t.cdl
+#
+#      eCos serial ARM/AEB-2 (E7T) configuration data
+#
+# ====================================================================
+#####COPYRIGHTBEGIN####
+#                                                                          
+# -------------------------------------------                              
+# The contents of this file are subject to the Red Hat eCos Public License 
+# Version 1.1 (the "License"); you may not use this file except in         
+# compliance with the License.  You may obtain a copy of the License at    
+# http://www.redhat.com/                                                   
+#                                                                          
+# Software distributed under the License is distributed on an "AS IS"      
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+# License for the specific language governing rights and limitations under 
+# the License.                                                             
+#                                                                          
+# The Original Code is eCos - Embedded Configurable Operating System,      
+# released September 30, 1998.                                             
+#                                                                          
+# The Initial Developer of the Original Code is Red Hat.                   
+# Portions created by Red Hat are                                          
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+# All Rights Reserved.                                                     
+# -------------------------------------------                              
+#                                                                          
+#####COPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      Lars.Lindqvist@combitechsystems.com
+# Contributors:   jlarmour
+# Date:           2001-10-19
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+
+cdl_package CYGPKG_IO_SERIAL_ARM_E7T {
+    display       "ARM E7T serial device drivers"
+
+    parent        CYGPKG_IO_SERIAL_DEVICES
+    active_if     CYGPKG_IO_SERIAL
+    active_if     CYGPKG_HAL_ARM_E7T
+
+    requires      CYGPKG_ERROR
+    include_dir   cyg/io
+    include_files ; # none _exported_ whatsoever
+    description   "
+           This package contains serial device drivers for the
+           ARM AEB-2 (E7T)."
+    doc           redirect/ecos-device-drivers.html
+
+    compile       -library=libextras.a   e7t_serial.c
+
+    define_proc {
+        puts $::cdl_system_header "/***** serial driver proc output start *****/"
+        puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER <pkgconf/io_serial_arm_e7t.h>"
+        puts $::cdl_system_header "/*****  serial driver proc output end  *****/"
+    }
+
+cdl_component CYGPKG_IO_SERIAL_ARM_E7T_SERIAL0 {
+    display       "ARM E7T serial port 0 driver"
+    flavor        bool
+    default_value 1
+    description   "
+        This option includes the serial device driver for the ARM E7T 
+        port 0."
+
+    cdl_option CYGDAT_IO_SERIAL_ARM_E7T_SERIAL0_NAME {
+        display       "Deviccce name for the ARM E7T serial port 0 driver"
+        flavor        data
+        default_value {"\"/dev/ser0\""}
+        description   "
+            This option sets the name of the serial device for the ARM 
+            E7T port 0."
+    }
+
+    cdl_option CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BAUD {
+        display       "Baud rate for the ARM E7T serial port 0 driver"
+        flavor        data
+        legal_values  { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600
+                      4800 7200 9600 14400 19200 38400 57600 115200 230400
+        }
+        default_value 38400
+        description   "
+            This option specifies the default baud rate (speed) for the 
+            ARM E7T port 0."
+    }
+
+    cdl_option CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BUFSIZE {
+        display       "Buffer size for the ARM E7T serial port 0 driver"
+        flavor        data
+        legal_values  0 to 8192
+        default_value 128
+        description   "
+            This option specifies the size of the internal buffers used for
+            the ARM E7T port 0."
+    }
+}
+
+cdl_component CYGPKG_IO_SERIAL_ARM_E7T_SERIAL1 {
+    display       "ARM E7T serial port 1 driver"
+    flavor        bool
+    default_value 1
+    description   "
+        This option includes the serial device driver for the ARM 
+        E7T port 1."
+
+    cdl_option CYGDAT_IO_SERIAL_ARM_E7T_SERIAL1_NAME {
+        display       "Device name for the ARM E7T serial port 1 driver"
+        flavor        data
+        default_value {"\"/dev/ser1\""}
+        description   "
+            This option specifies the name of serial device for the 
+            ARM E7T port 1."
+    }
+
+    cdl_option CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BAUD {
+        display       "Baud rate for the ARM E7T serial port 1 driver"
+        flavor        data
+        legal_values  { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600
+                      4800 7200 9600 14400 19200 38400 57600 115200 230400
+        }
+        default_value 38400
+        description   "
+            This option specifies the default baud rate (speed) for the 
+            ARM E7T port 1."
+    }
+
+    cdl_option CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BUFSIZE {
+        display       "Buffer size for the ARM E7T serial port 1 driver"
+        flavor        data
+        legal_values  0 to 8192
+        default_value 128
+        description   "
+            This option specifies the size of the internal buffers used 
+            for the ARM E7T port 1."
+    }
+}
+
+    cdl_component CYGPKG_IO_SERIAL_ARM_E7T_OPTIONS {
+        display "Serial device driver build options"
+        flavor  none
+        description   "
+	    Package specific build options including control over
+	    compiler flags used only in building this package,
+	    and details of which tests are built."
+
+
+        cdl_option CYGPKG_IO_SERIAL_ARM_E7T_CFLAGS_ADD {
+            display "Additional compiler flags"
+            flavor  data
+            no_define
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building these serial device drivers. These flags are used in addition
+                to the set of global flags."
+        }
+
+        cdl_option CYGPKG_IO_SERIAL_ARM_E7T_CFLAGS_REMOVE {
+            display "Suppressed compiler flags"
+            flavor  data
+            no_define
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building these serial device drivers. These flags are removed from
+                the set of global flags if present."
+        }
+    }
+
+    cdl_component CYGPKG_IO_SERIAL_ARM_E7T_TESTING {
+        display    "Testing parameters"
+        flavor     bool
+        calculated 1
+        active_if  CYGPKG_IO_SERIAL_ARM_E7T_SERIAL1
+
+        implements CYGINT_IO_SERIAL_TEST_SKIP_38400
+        implements CYGINT_IO_SERIAL_TEST_SKIP_57600
+        implements CYGINT_IO_SERIAL_TEST_SKIP_115200
+        implements CYGINT_IO_SERIAL_TEST_SKIP_PARITY_EVEN
+
+        cdl_option CYGPRI_SER_TEST_SER_DEV {
+            display       "Serial device used for testing"
+            flavor        data
+            default_value { CYGDAT_IO_SERIAL_ARM_E7T_SERIAL1_NAME }
+        }
+
+        define_proc {
+            puts $::cdl_header "#define CYGPRI_SER_TEST_CRASH_ID \"arme7t\""
+            puts $::cdl_header "#define CYGPRI_SER_TEST_TTY_DEV  \"/dev/tty1\""
+        }
+    }
+}
+
+# EOF ser_arm_e7t.cdl
new file mode 100644
--- /dev/null
+++ b/packages/devs/serial/arm/e7t/current/src/e7t_serial.c
@@ -0,0 +1,365 @@
+//==========================================================================
+//
+//      io/serial/arm/e7t_serial.c
+//
+//      ARM AEB-2 Serial I/O Interface Module (interrupt driven)
+//
+//==========================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+// ====================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    Lars.Lindqvist@combitechsystems.com
+// Contributors: jlarmour
+// Date:         2001-10-19
+// Purpose:      ARM AEB-2 Serial I/O Interface Module (interrupt driven)
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+// ====================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/io_serial.h>
+#include <pkgconf/io.h>
+#include <cyg/io/io.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/io/devtab.h>
+#include <cyg/io/serial.h>
+#include <cyg/io/serialio.h>
+#include <cyg/infra/diag.h>
+
+#ifdef CYGPKG_IO_SERIAL_ARM_E7T
+
+#include "e7t_serial.h"
+
+typedef struct e7t_serial_info {
+    CYG_ADDRWORD   base;
+    CYG_WORD       tx_int_num;
+    CYG_WORD       rx_int_num;
+    cyg_interrupt  serial_tx_interrupt;
+    cyg_interrupt  serial_rx_interrupt;
+    cyg_handle_t   serial_tx_interrupt_handle;
+    cyg_handle_t   serial_rx_interrupt_handle;
+    bool           tx_enabled;
+} e7t_serial_info;
+
+static bool e7t_serial_init(struct cyg_devtab_entry *tab);
+static bool e7t_serial_putc(serial_channel *chan, unsigned char c);
+static Cyg_ErrNo e7t_serial_lookup(struct cyg_devtab_entry **tab, 
+                                   struct cyg_devtab_entry *sub_tab,
+                                   const char *name);
+static unsigned char e7t_serial_getc(serial_channel *chan);
+static Cyg_ErrNo e7t_serial_set_config(serial_channel *chan, 
+                                       cyg_uint32 key,
+                                       const void *xbuf, cyg_uint32 *len);
+static void e7t_serial_start_xmit(serial_channel *chan);
+static void e7t_serial_stop_xmit(serial_channel *chan);
+
+static cyg_uint32 e7t_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data);
+static void       e7t_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);
+static cyg_uint32 e7t_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data);
+static void       e7t_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);
+
+static SERIAL_FUNS(e7t_serial_funs, 
+                   e7t_serial_putc, 
+                   e7t_serial_getc,
+                   e7t_serial_set_config,
+                   e7t_serial_start_xmit,
+                   e7t_serial_stop_xmit
+    );
+
+#ifdef CYGPKG_IO_SERIAL_ARM_E7T_SERIAL0
+static e7t_serial_info e7t_serial_info0 = {0x07FFd000, 
+                                           CYGNUM_HAL_INTERRUPT_UART0_TX,
+                                           CYGNUM_HAL_INTERRUPT_UART0_RX};
+#if CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BUFSIZE > 0
+static unsigned char e7t_serial_out_buf0[CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BUFSIZE];
+static unsigned char e7t_serial_in_buf0[CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BUFSIZE];
+
+static SERIAL_CHANNEL_USING_INTERRUPTS(e7t_serial_channel0,
+                                       e7t_serial_funs, 
+                                       e7t_serial_info0,
+                                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BAUD),
+                                       CYG_SERIAL_STOP_DEFAULT,
+                                       CYG_SERIAL_PARITY_DEFAULT,
+                                       CYG_SERIAL_WORD_LENGTH_DEFAULT,
+                                       CYG_SERIAL_FLAGS_DEFAULT,
+                                       &e7t_serial_out_buf0[0], sizeof(e7t_serial_out_buf0),
+                                       &e7t_serial_in_buf0[0], sizeof(e7t_serial_in_buf0)
+    );
+#else                                           CYGNUM_HAL_INTERRUPT_UART0_TX
+static SERIAL_CHANNEL(e7t_serial_channel0,
+                      e7t_serial_funs, 
+                      e7t_serial_info0,
+                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_E7T_SERIAL0_BAUD),
+                      CYG_SERIAL_STOP_DEFAULT,
+                      CYG_SERIAL_PARITY_DEFAULT,
+                      CYG_SERIAL_WORD_LENGTH_DEFAULT,
+                      CYG_SERIAL_FLAGS_DEFAULT
+    );
+#endif
+
+DEVTAB_ENTRY(e7t_serial_io0, 
+             CYGDAT_IO_SERIAL_ARM_E7T_SERIAL0_NAME,
+             0,                     // Does not depend on a lower level interface
+             &cyg_io_serial_devio, 
+             e7t_serial_init, 
+             e7t_serial_lookup,     // Serial driver may need initializing
+             &e7t_serial_channel0
+    );
+#endif //  CYGPKG_IO_SERIAL_ARM_E7T_SERIAL0
+
+#ifdef CYGPKG_IO_SERIAL_ARM_E7T_SERIAL1
+static e7t_serial_info e7t_serial_info1 = {0x07FFe000,
+                                           CYGNUM_HAL_INTERRUPT_UART1_TX,
+                                           CYGNUM_HAL_INTERRUPT_UART1_RX};
+#if CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BUFSIZE > 0
+static unsigned char e7t_serial_out_buf1[CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BUFSIZE];
+static unsigned char e7t_serial_in_buf1[CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BUFSIZE];
+
+static SERIAL_CHANNEL_USING_INTERRUPTS(e7t_serial_channel1,
+                                       e7t_serial_funs, 
+                                       e7t_serial_info1,
+                                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BAUD),
+                                       CYG_SERIAL_STOP_DEFAULT,
+                                       CYG_SERIAL_PARITY_DEFAULT,
+                                       CYG_SERIAL_WORD_LENGTH_DEFAULT,
+                                       CYG_SERIAL_FLAGS_DEFAULT,
+                                       &e7t_serial_out_buf1[0], sizeof(e7t_serial_out_buf1),
+                                       &e7t_serial_in_buf1[0], sizeof(e7t_serial_in_buf1)
+    );
+#else
+static SERIAL_CHANNEL(e7t_serial_channel1,
+                      e7t_serial_funs, 
+                      e7t_serial_info1,
+                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_E7T_SERIAL1_BAUD),
+                      CYG_SERIAL_STOP_DEFAULT,
+                      CYG_SERIAL_PARITY_DEFAULT,
+                      CYG_SERIAL_WORD_LENGTH_DEFAULT,
+                      CYG_SERIAL_FLAGS_DEFAULT
+    );
+#endif
+
+DEVTAB_ENTRY(e7t_serial_io1, 
+             CYGDAT_IO_SERIAL_ARM_E7T_SERIAL1_NAME,
+             0,                     // Does not depend on a lower level interface
+             &cyg_io_serial_devio, 
+             e7t_serial_init, 
+             e7t_serial_lookup,     // Serial driver may need initializing
+             &e7t_serial_channel1
+    );
+#endif //  CYGPKG_IO_SERIAL_ARM_E7T_SERIAL1
+
+// Internal function to actually configure the hardware to desired baud rate, etc.
+static bool
+e7t_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init)
+{
+  e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+  volatile struct serial_port *port = (volatile struct serial_port *)e7t_chan->base;
+  cyg_uint32 word_length = select_word_length[(new_config->word_length)-CYGNUM_SERIAL_WORD_LENGTH_5];
+  cyg_uint32 stop_bits = select_stop_bits[(new_config->stop)-CYGNUM_SERIAL_STOP_1];
+  cyg_uint32 parity_mode = select_parity[(new_config->parity)-CYGNUM_SERIAL_PARITY_NONE];
+  cyg_uint32 baud_divisor = select_baud[(new_config->baud)-CYGNUM_SERIAL_BAUD_50];
+  cyg_uint32 res = word_length | stop_bits | parity_mode | ULCON_SCI | ULCON_IROFF;
+  if ((word_length|stop_bits|parity_mode|baud_divisor) == U_NOT_SUPP) {
+    return false;
+  };
+  port->REG_ULCON = res;
+  port->REG_UCON = UCON_RXMINT | UCON_RXSIOFF | UCON_TXMINT | UCON_DSROFF | UCON_SBKOFF | UCON_LPBOFF;
+  port->REG_UBRDIV = baud_divisor;
+  if (new_config != &chan->config) {
+    chan->config = *new_config;
+  };
+  return true;
+}
+
+// Function to initialize the device.  Called at bootstrap time.
+static bool 
+e7t_serial_init(struct cyg_devtab_entry *tab)
+{
+    serial_channel *chan = (serial_channel *)tab->priv;
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+#ifdef CYGDBG_IO_INIT
+    diag_printf("E7T SERIAL init - dev: %x.%d.%d\n", e7t_chan->base, e7t_chan->tx_int_num, e7t_chan->rx_int_num);
+#endif
+    (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
+    if (chan->out_cbuf.len != 0) {         // If bufferlength > 0 then interrupts are used for tx
+        cyg_drv_interrupt_create(e7t_chan->tx_int_num,
+                                 99,                     // Priority - unused
+                                 (cyg_addrword_t)chan,   //  Data item passed to interrupt handler
+                                 e7t_serial_tx_ISR,
+                                 e7t_serial_tx_DSR,
+                                 &e7t_chan->serial_tx_interrupt_handle,
+                                 &e7t_chan->serial_tx_interrupt);
+        cyg_drv_interrupt_attach(e7t_chan->serial_tx_interrupt_handle);
+        cyg_drv_interrupt_mask(e7t_chan->tx_int_num);
+        e7t_chan->tx_enabled = false;
+    }
+    if (chan->in_cbuf.len != 0) {         // If bufferlength > 0 then interrupts are used for rx
+        cyg_drv_interrupt_create(e7t_chan->rx_int_num,
+                                 99,                     // Priority - unused
+                                 (cyg_addrword_t)chan,   //  Data item passed to interrupt handler
+                                 e7t_serial_rx_ISR,
+                                 e7t_serial_rx_DSR,
+                                 &e7t_chan->serial_rx_interrupt_handle,
+                                 &e7t_chan->serial_rx_interrupt);
+        cyg_drv_interrupt_attach(e7t_chan->serial_rx_interrupt_handle);
+        cyg_drv_interrupt_unmask(e7t_chan->rx_int_num);
+    }
+    e7t_serial_config_port(chan, &chan->config, true);
+    return true;
+}
+
+// This routine is called when the device is "looked" up (i.e. attached)
+static Cyg_ErrNo 
+e7t_serial_lookup(struct cyg_devtab_entry **tab, 
+                  struct cyg_devtab_entry *sub_tab,
+                  const char *name)
+{
+    serial_channel *chan = (serial_channel *)(*tab)->priv;
+    (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
+    return ENOERR;
+}
+
+// Send a character to the device output buffer.
+// Return 'true' if character is sent to device
+static bool
+e7t_serial_putc(serial_channel *chan, unsigned char c)
+{
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)e7t_chan->base;
+
+    if (port->REG_USTAT & USTAT_TBE) {
+      // Transmit buffer is empty
+      port->REG_UTXBUF = c;
+      return true;
+    } else {
+      // No space
+      return false;
+    }
+}
+
+// Fetch a character from the device input buffer, waiting if necessary
+static unsigned char 
+e7t_serial_getc(serial_channel *chan)
+{
+    unsigned char c;
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)e7t_chan->base;
+    while ((port->REG_USTAT & USTAT_RDR) == 0) ;   // Wait for char
+    c = port->REG_URXBUF;
+    return c;
+}
+
+// Set up the device characteristics; baud rate, etc.
+static Cyg_ErrNo
+e7t_serial_set_config(serial_channel *chan, cyg_uint32 key,
+                      const void *xbuf, cyg_uint32 *len)
+{
+    switch (key) {
+    case CYG_IO_SET_CONFIG_SERIAL_INFO:
+      {
+        cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf;
+        if ( *len < sizeof(cyg_serial_info_t) ) {
+            return -EINVAL;
+        }
+        *len = sizeof(cyg_serial_info_t);
+        if ( true != e7t_serial_config_port(chan, config, false) )
+            return -EINVAL;
+      }
+      break;
+    default:
+        return -EINVAL;
+    }
+    return ENOERR;
+}
+
+// Enable the transmitter on the device
+static void
+e7t_serial_start_xmit(serial_channel *chan)
+{
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    e7t_chan->tx_enabled = true;
+    cyg_drv_interrupt_unmask(e7t_chan->tx_int_num);
+}
+
+// Disable the transmitter on the device
+static void 
+e7t_serial_stop_xmit(serial_channel *chan)
+{
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    cyg_drv_interrupt_mask(e7t_chan->tx_int_num);
+    e7t_chan->tx_enabled = false;
+}
+
+// Serial I/O - low level tx interrupt handler (ISR)
+static cyg_uint32 
+e7t_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data)
+{
+    serial_channel *chan = (serial_channel *)data;
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    cyg_drv_interrupt_mask(e7t_chan->tx_int_num);
+    cyg_drv_interrupt_acknowledge(e7t_chan->tx_int_num);
+    return CYG_ISR_CALL_DSR;  // Cause DSR to be run
+}
+
+// Serial I/O - high level tx interrupt handler (DSR)
+static void       
+e7t_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
+{
+    serial_channel *chan = (serial_channel *)data;
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    (chan->callbacks->xmt_char)(chan);
+    if (e7t_chan->tx_enabled) {
+        cyg_drv_interrupt_unmask(e7t_chan->tx_int_num);
+    }
+}
+
+// Serial I/O - low level rx interrupt handler (ISR)
+static cyg_uint32 
+e7t_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data)
+{
+    serial_channel *chan = (serial_channel *)data;
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    cyg_drv_interrupt_mask(e7t_chan->rx_int_num);
+    cyg_drv_interrupt_acknowledge(e7t_chan->rx_int_num);
+    return CYG_ISR_CALL_DSR;  // Cause DSR to be run
+}
+
+// Serial I/O - high level rx interrupt handler (DSR)
+static void       
+e7t_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
+{
+    serial_channel *chan = (serial_channel *)data;
+    e7t_serial_info *e7t_chan = (e7t_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)e7t_chan->base;
+    (chan->callbacks->rcv_char)(chan, port->REG_URXBUF);
+    cyg_drv_interrupt_unmask(e7t_chan->rx_int_num);
+}
+
+#endif // CYGPKG_IO_SERIAL_ARM_E7T
+
+// EOF e7t_serial.c
new file mode 100644
--- /dev/null
+++ b/packages/devs/serial/arm/e7t/current/src/e7t_serial.h
@@ -0,0 +1,188 @@
+#ifndef CYGONCE_ARM_E7T_SERIAL_H
+#define CYGONCE_ARM_E7T_SERIAL_H
+// ====================================================================
+//
+//      e7t_serial.h
+//
+//      Device I/O - Description of ARM AEB-2 serial hardware
+//
+// ====================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+// ====================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    Lars.Lindqvist@combitechsystems.com
+// Contributors: jlarmour
+// Date:         2001-10-19
+// Purpose:      Internal interfaces for serial I/O drivers
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+// ====================================================================
+
+#include <pkgconf/hal.h>        // Value CYGNUM_HAL_ARM_E7T_CLOCK_SPEED needed
+#include <cyg/infra/cyg_type.h> // base types
+
+// Description of serial ports on ARM AEB-2
+
+struct serial_port {
+    cyg_uint32 _reg[8];
+};
+
+#define REG(n) _reg[n]
+
+// Misc values
+#define U_NOT_SUPP    (0xFFFFFFFF)  // Used to indicate unsupported parameter values
+
+// Registers
+#define REG_ULCON  REG(0)    // Line control registers
+#define REG_UCON   REG(1)    // Control registers
+#define REG_USTAT  REG(2)    // Status registers
+#define REG_UTXBUF REG(3)    // Transmit buffer registers
+#define REG_URXBUF REG(4)    // Receive buffer registers
+#define REG_UBRDIV REG(5)    // Baud rate divisor registers
+
+// Line Control Register Values
+#define ULCON_WL5     (0x00000000 << 0)  // Word length 5
+#define ULCON_WL6     (0x00000001 << 0)  // Word length 6
+#define ULCON_WL7     (0x00000002 << 0)  // Word length 7
+#define ULCON_WL8     (0x00000003 << 0)  // Word length 8
+#define ULCON_STB1    (0x00000000 << 2)  // One stop bit
+#define ULCON_STB2    (0x00000001 << 2)  // Two stop bits
+#define ULCON_PMDOFF  (0x00000000 << 3)  // No parity
+#define ULCON_PMDODD  (0x00000004 << 3)  // Odd parity
+#define ULCON_PMDEVEN (0x00000005 << 3)  // Even parity
+#define ULCON_PMDFC1  (0x00000006 << 3)  // Parity forced/checked as 1
+#define ULCON_PMDFC0  (0x00000007 << 3)  // Parity forced/checked as 0
+#define ULCON_SCI     (0x00000000 << 6)  // Internal clock
+#define ULCON_SCE     (0x00000001 << 6)  // External clock
+#define ULCON_IROFF   (0x00000000 << 7)  // Normal mode
+#define ULCON_IRON    (0x00000001 << 7)  // IR mode
+
+// Control Register Values
+#define UCON_RXMOFF   (0x00000000 << 0)  // Disable Rx mode
+#define UCON_RXMINT   (0x00000001 << 0)  // Interrupt request Rx mode
+#define UCON_RXMDMA0  (0x00000002 << 0)  // GDMA channel 0 request Rx mode
+#define UCON_RXMDMA1  (0x00000003 << 0)  // GDMA channel 1 request Rx mode
+#define UCON_RXSIOFF  (0x00000000 << 2)  // Rx status interrupt disabled
+#define UCON_RXSION   (0x00000001 << 2)  // Rx status interrupt enabled
+#define UCON_TXMOFF   (0x00000000 << 3)  // Disable Tx mode
+#define UCON_TXMINT   (0x00000001 << 3)  // Interrupt request Tx mode
+#define UCON_TXMDMA0  (0x00000002 << 3)  // GDMA channel 0 request Tx mode
+#define UCON_TXMDMA1  (0x00000003 << 3)  // GDMA channel 1 request Tx mode
+#define UCON_DSROFF   (0x00000000 << 5)  // Data set ready output off
+#define UCON_DSRON    (0x00000001 << 5)  // Data set ready output on
+#define UCON_SBKOFF   (0x00000000 << 6)  // No break sent
+#define UCON_SBKON    (0x00000001 << 6)  // Break sent
+#define UCON_LPBOFF   (0x00000000 << 7)  // Loop back mode off
+#define UCON_LPBON    (0x00000001 << 7)  // Loop back mode on
+
+// Status Register Values
+#define USTAT_OV      (0x00000001 << 0)  // Overrun error
+#define USTAT_PE      (0x00000001 << 1)  // Parity error
+#define USTAT_FE      (0x00000001 << 2)  // Frame error
+
+#define USTAT_BKD     (0x00000001 << 3)  // Break detect
+#define USTAT_DTR     (0x00000001 << 4)  // Data terminal ready
+#define USTAT_RDR     (0x00000001 << 5)  // Receive data ready
+#define USTAT_TBE     (0x00000001 << 6)  // Transmit buffer register empty
+#define USTAT_TC      (0x00000001 << 7)  // Transmit complete
+
+// Baud rate divisor registers
+#define UBRDIV_50     ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/16/50)-1)<<4)|1)
+#define UBRDIV_75     ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/16/75)-1)<<4)|1)
+#define UBRDIV_110    ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/16/110)-1)<<4)|1)
+#define UBRDIV_134_5  ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/8/269)-1)<<4)|1)
+#define UBRDIV_150    ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/16/150)-1)<<4)|1)
+#define UBRDIV_200    ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/16/200)-1)<<4)|1)
+#define UBRDIV_300    ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/16/16/300)-1)<<4)|1)
+#define UBRDIV_600    ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/600)-1)<<4)|0)
+#define UBRDIV_1200   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/1200)-1)<<4)|0)
+#define UBRDIV_1800   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/1800)-1)<<4)|0)
+#define UBRDIV_2400   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/2400)-1)<<4)|0)
+#define UBRDIV_3600   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/3600)-1)<<4)|0)
+#define UBRDIV_4800   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/4800)-1)<<4)|0)
+#define UBRDIV_7200   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/7200)-1)<<4)|0)
+#define UBRDIV_9600   ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/9600)-1)<<4)|0)
+#define UBRDIV_14400  ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/14400)-1)<<4)|0)
+#define UBRDIV_19200  ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/19200)-1)<<4)|0)
+#define UBRDIV_38400  ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/38400)-1)<<4)|0)
+#define UBRDIV_57600  ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/57600)-1)<<4)|0)
+#define UBRDIV_115200 ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/115200)-1)<<4)|0)
+#define UBRDIV_230400 ((((CYGNUM_HAL_ARM_E7T_CLOCK_SPEED/2/1/16/230400)-1)<<4)|0)
+
+
+// Arrays used for conversion of eCos serial driver
+// configuration parameters to parameters for E7T
+
+static cyg_uint32 select_word_length[] = {
+    ULCON_WL5,    // 5 bits / word (char)
+    ULCON_WL6,
+    ULCON_WL7,
+    ULCON_WL8
+};
+
+static cyg_uint32 select_stop_bits[] = {
+    ULCON_STB1,    // 1 stop bit
+    U_NOT_SUPP,    // 1.5 stop bit not supported
+    ULCON_STB2     // 2 stop bits
+};
+
+static cyg_uint32 select_parity[] = {
+    ULCON_PMDOFF,     // No parity
+    ULCON_PMDEVEN,    // Even parity
+    ULCON_PMDODD,     // Odd parity
+    ULCON_PMDFC1,     // Mark parity
+    ULCON_PMDFC0,     // Space parity
+};
+
+static cyg_uint32 select_baud[] = {
+     UBRDIV_50,     // 50
+     UBRDIV_75,     // 75
+     UBRDIV_110,    // 110
+     UBRDIV_134_5,  // 134.5
+     UBRDIV_150,    // 150
+     UBRDIV_200,    // 200
+     UBRDIV_300,    // 300
+     UBRDIV_600,    // 600
+     UBRDIV_1200,   // 1200
+     UBRDIV_1800,   // 1800
+     UBRDIV_2400,   // 2400
+     UBRDIV_3600,   // 3600
+     UBRDIV_4800,   // 4800
+     UBRDIV_7200,   // 7200
+     UBRDIV_9600,   // 9600
+     UBRDIV_14400,  // 14400
+     UBRDIV_19200,  // 19200
+     UBRDIV_38400,  // 38400
+     UBRDIV_57600,  // 57600
+     UBRDIV_115200, // 115200
+     UBRDIV_230400, // 230400
+};
+
+#endif // CYGONCE_ARM_E7T_SERIAL_H
+
+// EOF e7t_serial.h
--- a/packages/devs/serial/arm/edb7xxx/current/ChangeLog
+++ b/packages/devs/serial/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/ser_arm_edb7xxx.cdl: Clarify package description strings.
+
 2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
 
         * cdl/ser_arm_edb7xxx.cdl:        
--- a/packages/devs/serial/arm/edb7xxx/current/cdl/ser_arm_edb7xxx.cdl
+++ b/packages/devs/serial/arm/edb7xxx/current/cdl/ser_arm_edb7xxx.cdl
@@ -42,7 +42,7 @@
 
 
 cdl_package CYGPKG_IO_SERIAL_ARM_EDB7XXX {
-    display       "ARM EDB7XXX serial device drivers"
+    display       "Cirrus Logic ARM based boards serial device drivers"
 
     parent        CYGPKG_IO_SERIAL_DEVICES
     active_if     CYGPKG_IO_SERIAL
@@ -53,7 +53,7 @@ cdl_package CYGPKG_IO_SERIAL_ARM_EDB7XXX
     include_files ; # none _exported_ whatsoever
     description   "
            This option enables the serial device drivers for the
-           Cirrus Logic EDB7XXX."
+           Cirrus Logic ARM based development boards."
     doc           redirect/ecos-device-drivers.html
 
     compile       -library=libextras.a   edb7xxx_serial.c
--- a/packages/devs/serial/arm/sa11x0/current/ChangeLog
+++ b/packages/devs/serial/arm/sa11x0/current/ChangeLog
@@ -1,6 +1,12 @@
+2001-10-09  Hugo Tyson  <hmt@redhat.com>
+
+	* src/sa11x0_serial.c (sa11x0_serial_DSR): Acknowledge the
+	interrupts for start or end of a line break, otherwise messing
+	with the wiring can cause an interrupt loop and hang the target.
+
 2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
 
-        * cdl/ser_arm_sa11x0.cdl:        
+	* cdl/ser_arm_sa11x0.cdl:        
         Fix 234000->230400 typo.
 
 2000-10-12  Jesper Skov  <jskov@redhat.com>
--- a/packages/devs/serial/arm/sa11x0/current/src/sa11x0_serial.c
+++ b/packages/devs/serial/arm/sa11x0/current/src/sa11x0_serial.c
@@ -334,6 +334,13 @@ sa11x0_serial_DSR(cyg_vector_t vector, c
         }
         port->stat0 = SA11X0_UART_RX_IDLE;  // Need to clear this manually
     }
+    if (stat0 & (SA11X0_UART_RX_BEGIN_OF_BREAK |
+                 SA11X0_UART_RX_END_OF_BREAK ) ) {
+        // Need to clear any of these manually also or noise
+        // from plugging in can cause an interrupt loop!
+        port->stat0 = stat0 & (SA11X0_UART_RX_BEGIN_OF_BREAK |
+                               SA11X0_UART_RX_END_OF_BREAK );
+    }
     cyg_drv_interrupt_unmask(vector);
 }
 #endif
--- a/packages/ecos.db
+++ b/packages/ecos.db
@@ -213,13 +213,13 @@ package CYGPKG_DEVS_FLASH_SA1100MM {
 }
 
 package CYGPKG_DEVS_FLASH_EDB7XXX {
-	alias 		{ "FLASH memory support for Cirrus Logic EDB7xxx" flash_edb7xxx }
+	alias 		{ "FLASH support for Cirrus Logic EP7xxx based boards" flash_edb7xxx }
 	directory	devs/flash/arm/edb7xxx
 	script		flash_edb7xxx.cdl
 	hardware
         description "
            This package contains hardware support for FLASH memory
-	   on the Cirrus Logic EDB7xxx platform(s)."
+	   on the Cirrus Logic EP7xxx based platform(s)."
 }
 
 package CYGPKG_DEVS_FLASH_AT91 {
@@ -406,12 +406,13 @@ package CYGPKG_IO_SERIAL_ARM_AEB {
 }
 
 package CYGPKG_IO_SERIAL_ARM_EDB7XXX {
-    alias             { "ARM EDB7XXX serial device drivers"
+    alias             { "Cirrus Logic ARM based board serial device drivers"
                         devs_serial_arm_edb7xxx edb7xxx_serial_driver }
     hardware
     directory	      devs/serial/arm/edb7xxx
     script	      ser_arm_edb7xxx.cdl	
-    description       "ARM EDB7XXX serial device drivers"
+    description       "Cirrus Logic ARM based development board serial
+                       device drivers"
 }
 
 package CYGPKG_IO_SERIAL_ARM_CMA230 {
@@ -423,6 +424,15 @@ package CYGPKG_IO_SERIAL_ARM_CMA230 {
     description       "Cogent ARM/CMA230 serial device drivers"
 }
 
+package CYGPKG_IO_SERIAL_ARM_E7T {
+    alias             { "ARM AEB-2 (E7T) serial device drivers"
+                        devs_serial_arm_e7t e7t_serial_driver }
+    hardware
+    directory         devs/serial/arm/e7t
+    script            ser_arm_e7t.cdl   
+    description       "ARM AEB-2 (E7T) serial device drivers"
+}
+
 package CYGPKG_IO_SERIAL_ARM_AT91 {
     alias 	      { "Atmel AT91 evaluation board (EB40)"
                         devs_serial_arm_at91 at91_serial_driver }
@@ -669,11 +679,12 @@ package CYGPKG_SNMPAGENT {
 }
 
 package CYGPKG_DEVS_ETH_ARM_EDB7XXX {
-	alias 		{ "Cirrus Logic ethernet driver" edb7xxx_eth_driver }
+	alias 		{ "Cirrus Logic ethernet driver for EP7xxx boards" edb7xxx_eth_driver }
 	hardware
 	directory	devs/eth/arm/edb7xxx
 	script		edb7xxx_eth_drivers.cdl
-        description     "Ethernet driver for Cirrus Logic EDB7xxx development boards."
+        description     "Ethernet driver for Cirrus Logic EP7xxx based
+                         development boards."
 }
 
 package CYGPKG_DEVS_ETH_AMD_PCNET {
@@ -1288,12 +1299,12 @@ package CYGPKG_HAL_ARM_SA11X0_SA1100MM {
 }
 
 package CYGPKG_HAL_ARM_EDB7XXX {
-	alias		{ "Cirrus Logic development board" hal_arm_edb7xxx arm_edb7xxx_hal }
+	alias		{ "Cirrus Logic ARM7 based development boards" hal_arm_edb7xxx arm_edb7xxx_hal }
 	directory	hal/arm/edb7xxx
 	script		hal_arm_edb7xxx.cdl
 	hardware
         description "
-The EDB7XXX HAL package provides the support needed to run eCos on Cirrus Logic development boards."
+The EDB7XXX HAL package provides the support needed to run eCos on Cirrus Logic CL-PS7111 and EP7xxx based development boards."
 }
 
 package CYGPKG_HAL_ARM_CMA230 {
@@ -1911,6 +1922,7 @@ target e7t {
 	alias { "ARM Evaluator7T board (AEB-2)" aeb2 }
 	packages { CYGPKG_HAL_ARM
                    CYGPKG_HAL_ARM_E7T
+	           CYGPKG_IO_SERIAL_ARM_E7T
         }
         description "
 The aeb target provides the packages needed to run eCos on an ARM
--- a/packages/fs/rom/current/ChangeLog
+++ b/packages/fs/rom/current/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-17  Drew Moseley  <dmoseley@redhat.com>
+2001-10-17  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* support/mk_romfs.c: Open input files in binary mode (for cygwin).
+	* cdl/romfs.cdl: Work around cygwin path problems by copying files
+	into build tree.
+
 2001-07-20  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* tests/fileio1.c (main): Get this to actually pass! Remove
--- a/packages/fs/rom/current/cdl/romfs.cdl
+++ b/packages/fs/rom/current/cdl/romfs.cdl
@@ -78,7 +78,11 @@ cdl_package CYGPKG_FS_ROM {
             <PREFIX>/include/cyg/romfs/testromfs.h : $(PREFIX)/bin/mk_romfs <PACKAGE>/support/file2c.tcl
             $(PREFIX)/bin/mk_romfs $(REPOSITORY)/$(PACKAGE)/tests/testromfs testromfs.bin
             @mkdir -p "$(dir $@)"
-            sh $(REPOSITORY)/$(PACKAGE)/support/file2c.tcl testromfs.bin $@
+            # work around cygwin path problems by copying to build dir
+            @cp $(REPOSITORY)/$(PACKAGE)/support/file2c.tcl .
+            sh file2c.tcl testromfs.bin testromfs.h
+            @rm -f $@ file2c.tcl
+            @cp testromfs.h $@
         }
     
     
--- a/packages/fs/rom/current/support/mk_romfs.c
+++ b/packages/fs/rom/current/support/mk_romfs.c
@@ -542,6 +542,10 @@ static void WriteNodeTable( int fd ) {
     }
 }
 
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 static void WriteData( int fd, node *np ) {
     char newpath[1024];
     int ffd;
@@ -562,7 +566,7 @@ static void WriteData( int fd, node *np 
 	return;
     }
     
-    if ( (ffd=open(np->path, O_RDONLY)) < 0 )
+    if ( (ffd=open(np->path, O_RDONLY | O_BINARY )) < 0 )
 	fatal_error(EXIT_FILESYS, "Error opening \"%s\": %s\n", np->path, strerror(errno) );
 
     if ( dowrite && lseek( fd, np->offset, SEEK_SET ) != np->offset )
--- a/packages/hal/arm/arch/current/ChangeLog
+++ b/packages/hal/arm/arch/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-11  Fabrice Gautier  <Fabrice_Gautier@sdesigns.com>
+
+	* include/hal_io.h: Add _STRING variants of I/O macros to allow
+	writing of consecutive items to the same registers.
+
 2001-10-02  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/hal_arch.h: Remove CYG_HAL_TABLE_BEGIN and CYG_HAL_TABLE_END
--- a/packages/hal/arm/arch/current/include/hal_io.h
+++ b/packages/hal/arm/arch/current/include/hal_io.h
@@ -26,7 +26,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -34,16 +34,16 @@
 //=============================================================================
 //#####DESCRIPTIONBEGIN####
 //
-// Author(s):   nickg, gthomas
-// Contributors:        nickg, gthomas
-// Date:        1998-09-11
-// Purpose:     Define IO register support
-// Description: The macros defined here provide the HAL APIs for handling
-//              device IO control registers.
+// Author(s):    nickg, gthomas
+// Contributors: Fabrice Gautier
+// Date:         1998-09-11
+// Purpose:      Define IO register support
+// Description:  The macros defined here provide the HAL APIs for handling
+//               device IO control registers.
 //              
 // Usage:
-//              #include <cyg/hal/hal_io.h>
-//              ...
+//               #include <cyg/hal/hal_io.h>
+//               ...
 //              
 //
 //####DESCRIPTIONEND####
@@ -89,6 +89,20 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_];        \
     CYG_MACRO_END
 
+#define HAL_READ_UINT8_STRING( _register_, _buf_, _count_ )             \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_));             \
+    CYG_MACRO_END
+
+#define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ )            \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        ((volatile CYG_BYTE *)(_register_)) = (_buf_)[_i_];             \
+    CYG_MACRO_END
+
 #else // Big-endian version
 
 #define HAL_READ_UINT8( _register_, _value_ ) \
@@ -113,6 +127,22 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         _r_[_j_] = (_buf_)[_i_];                                        \
     CYG_MACRO_END
 
+#define HAL_READ_UINT8_STRING( _register_, _buf_, _count_ )             \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)^3);            \
+    for( _i_ = 0; _i_ < (_count_); _i_++;                               \
+        (_buf_)[_i_] = _r_;                                             \
+    CYG_MACRO_END
+
+#define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ )            \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)^3);            \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        _r_ = (_buf_)[_i_];                                             \
+    CYG_MACRO_END
+
 #endif // Big-endian
 
 //-----------------------------------------------------------------------------
@@ -142,6 +172,21 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_];      \
     CYG_MACRO_END
 
+#define HAL_READ_UINT16_STRING( _register_, _buf_, _count_)             \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_));           \
+    CYG_MACRO_END
+
+#define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_)            \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        ((volatile CYG_WORD16 *)(_register_)) = (_buf_)[_i_];           \
+    CYG_MACRO_END
+
+
 #else // Big-endian version
 
 #define HAL_READ_UINT16( _register_, _value_ ) \
@@ -166,6 +211,23 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         _r_[_j_] = (_buf_)[_i_];                                        \
     CYG_MACRO_END
 
+#define HAL_READ_UINT16_STRING( _register_, _buf_, _count_)             \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)^3);          \
+    for( _i_ = 0 = 0; _i_ < (_count_); _i_++)                           \
+        (_buf_)[_i_] = _r_;                                             \
+    CYG_MACRO_END
+
+#define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_)            \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)^3);          \
+    for( _i_ = 0 = 0; _i_ < (_count_); _i_++)                           \
+        _r_ = (_buf_)[_i_];                                             \
+    CYG_MACRO_END
+
+
 #endif // Big-endian
 
 //-----------------------------------------------------------------------------
@@ -194,6 +256,20 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_];      \
     CYG_MACRO_END
 
+#define HAL_READ_UINT32_STRING( _register_, _buf_, _count_)             \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_));           \
+    CYG_MACRO_END
+
+#define HAL_WRITE_UINT32_STRING( _register_, _buf_, _count_)            \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        ((volatile CYG_WORD32 *)(_register_)) = (_buf_)[_i_];           \
+    CYG_MACRO_END
+
 // Enforce a flow "barrier" to prevent optimizing compiler from reordering 
 // operations.
 #define HAL_IO_BARRIER()
--- a/packages/hal/arm/edb7xxx/current/ChangeLog
+++ b/packages/hal/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_arm_edb7xxx.cdl: Clarify package description strings.
+
 2001-09-26  Gary Thomas  <gthomas@redhat.com
 
 	* cdl/hal_arm_edb7xxx.cdl: Implement CYGINT_HAL_SUPPORTS_MMU_TABLES
--- a/packages/hal/arm/edb7xxx/current/cdl/hal_arm_edb7xxx.cdl
+++ b/packages/hal/arm/edb7xxx/current/cdl/hal_arm_edb7xxx.cdl
@@ -41,14 +41,14 @@
 # ====================================================================
 
 cdl_package CYGPKG_HAL_ARM_EDB7XXX {
-    display       "Cirrus Logic EDB7xxx development board"
+    display       "Cirrus Logic ARM7 based development boards"
     parent        CYGPKG_HAL_ARM
     include_dir   cyg/hal
     hardware
     define_header hal_arm_edb7xxx.h
     description   "
-        The EDB7XXX HAL package provides the support needed to run
-        eCos on a Cirrus Logic EDB7xxx development board."
+The EDB7XXX HAL package provides the support needed to run eCos on Cirrus Logic
+CL-PS7111 and EP7xxx based development boards."
 
     compile       hal_diag.c edb7xxx_misc.c
 
--- a/packages/hal/arm/sa11x0/nano/current/ChangeLog
+++ b/packages/hal/arm/sa11x0/nano/current/ChangeLog
@@ -140,7 +140,7 @@ 2001-02-14  Hugo Tyson  <hmt@redhat.com>
 
 2001-02-14  Hugo Tyson  <hmt@redhat.com>
 
-	* hal/arm/sa11x0/nano: New package, based on Assabet
+	* hal/arm/sa11x0/nano: New package, based on Assabet 
 	HAL.  This is the nanoEngine from Bright Star Engineering; an
 	SA1110 CPU + 2x i82559 ethernets.
 
--- a/packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h
+++ b/packages/hal/arm/sa11x0/nano/current/include/hal_platform_setup.h
@@ -263,14 +263,13 @@ 10:     ldr     r3,[r1],#4
 
         // Enable DRAM controller
         ldr     r1,=SA11X0_DRAM_CONFIGURATION
-        ldr     r2,=0x00007255 // read from nanoEngine; plc2 => 0x0000a257
+        ldr     r2,=0x00007255 // read from nanoEngine
         str     r2,[r1]
 
         b       19f
         
 // DRAM controller initialization        
 dram_table:
-#if 1
         // Data extracted from the setup of the nanoEngine
         .word   SA11X0_DRAM0_CAS_0,           0xAAAAAA7F
         .word   SA11X0_DRAM0_CAS_1,           0xAAAAAAAA
@@ -286,23 +285,6 @@ dram_table:
         .word   SA11X0_SMROM_CONFIGURATION,   0xf070c040
         .word   SA11X0_DRAM_CONFIGURATION,    0x72547254        // Disabled
         .word   0, 0
-#else
-        // Original data for the plc2
-        .word   SA11X0_DRAM0_CAS_0,           0xAAAAAA7F
-        .word   SA11X0_DRAM0_CAS_1,           0xAAAAAAAA
-        .word   SA11X0_DRAM0_CAS_2,           0xAAAAAAAA
-        .word   SA11X0_STATIC_CONTROL_0,      0xbdf6fffc
-        .word   SA11X0_STATIC_CONTROL_1,      0xd9caebeb
-        .word   SA11X0_EXP_BUS_CONFIGURATION, 0x00000421
-        .word   SA11X0_REFRESH_CONFIGURATION, 0x00300321
-        .word   SA11X0_DRAM2_CAS_0,           0xAAAAAA7F
-        .word   SA11X0_DRAM2_CAS_1,           0xAAAAAAAA
-        .word   SA11X0_DRAM2_CAS_2,           0xAAAAAAAA
-        .word   SA11X0_STATIC_CONTROL_2,      0x1466f135
-        .word   SA11X0_SMROM_CONFIGURATION,   0x00000000
-        .word   SA11X0_DRAM_CONFIGURATION,    0x72547254        // Disabled
-        .word   0, 0
-#endif
 19:
 
         // Release peripheral hold (set by RESET)
--- a/packages/hal/arm/sa11x0/var/current/ChangeLog
+++ b/packages/hal/arm/sa11x0/var/current/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-09  Hugo Tyson  <hmt@redhat.com>
+
+	* src/hal_diag.c (cyg_hal_plf_serial_isr): As well as the sticky
+	Rx Idle bit, clear the sticky bits for interrupts for start or end
+	of a line break, otherwise messing with the wiring can cause an
+	interrupt loop and hang the target.
+
 2001-08-22  Gary Thomas  <gthomas@redhat.com>
 
 	* src/redboot_linux_exec.c: 
--- a/packages/hal/arm/sa11x0/var/current/src/hal_diag.c
+++ b/packages/hal/arm/sa11x0/var/current/src/hal_diag.c
@@ -299,9 +299,12 @@ cyg_hal_plf_serial_isr(void *__ch_data, 
     // interrupt loop
     c = (char)chan->base->utdr;
 
-    //Clear receiver idle status bit, to allow another interrupt to
-    //occur in the case where the receive fifo is almost empty.
-    chan->base->utsr0 = SA11X0_UART_RX_IDLE;
+    // Clear receiver idle status bit, to allow another interrupt to
+    // occur in the case where the receive fifo is almost empty.
+    // Also for a break interrupt; these are sticky and nonmaskable.
+    chan->base->utsr0 = (SA11X0_UART_RX_IDLE |
+                         SA11X0_UART_RX_BEGIN_OF_BREAK |
+                         SA11X0_UART_RX_END_OF_BREAK      );
 
     cyg_drv_interrupt_acknowledge(chan->isr_vector);
 
--- a/packages/hal/common/current/ChangeLog
+++ b/packages/hal/common/current/ChangeLog
@@ -1,3 +1,63 @@
+2001-10-18  Gary Thomas  <gthomas@redhat.com>
+
+	* src/hal_if.c (cyg_hal_diag_mangler_gdb_putc): 
+	* cdl/debugging.cdl: CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES is now
+	defined as CDL 'data' flavor (tested via #if vs. #ifdef)
+
+2001-10-17  Jesper Skov  <jskov@redhat.com>
+
+	* src/generic-stub.c: Prefixed local version of memcpy and memset
+	with _.
+
+2001-10-17  Gary Thomas  <gthomas@redhat.com>
+
+	* cdl/debugging.cdl: 
+	* src/hal_if.c (cyg_hal_diag_mangler_gdb_putc): Make retry/abort optional,
+	only attemped if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES is configured to
+	be non-zero (default now 0).
+
+2001-10-16  Jesper Skov  <jskov@redhat.com>
+
+	* include/hal_stub.h: Allow ISOINFRA/LIBC to provide string
+	functions.
+
+2001-10-16  Gary Thomas  <gthomas@redhat.com>
+
+	* include/generic-stub.h: Add prototypes for breakpoint_list functions.
+
+2001-10-15  David Howells  <dhowells@redhat.com>
+
+	* include/hal_stub.h: put semicolon between goto-label and close curly.
+
+2001-10-12  Mark Salter  <msalter@redhat.com>
+
+	* src/thread-packets.c: Don't specify array sizes in extern decls.
+
+	* src/hal_stub.c: Use HAL_STUB_REGISTERS_SIZE to set number of elements
+	in register save areas. Default to NUMREGS if not defined by HAL.
+	Allow HALs to provide specialized get_register()/put_register().
+
+	* src/generic-stub.c (stub_format_registers): Support 'p' packet.
+	(__process_packet): Rearrange ifdefs so error is sent for unsupported
+	Z packet types.
+	(process_query): Add hook for HAL specific queries.
+	(process_set): Add hook for HAL specific sets.
+
+	* include/generic-stub.h: Add extern decls to quiet compiler warnings.
+
+2001-10-11  Gary Thomas  <gthomas@redhat.com>
+
+	* include/generic-stub.h: 
+	* src/generic-stub.c: Improve error handling more.  Make sure that
+	packets are consumed, even if they are going to be tossed (overflow).
+	This keeps TCP based connections going, even when the data is bad.
+	(getpacket): Only send NAK in case of overflow.
+
+2001-10-09  Jesper Skov  <jskov@redhat.com>
+
+	* src/hal_if.c (flash_config_op): Protect with
+	CYGARC_HAL_SAVE_GP.
+
 2001-10-04  Jesper Skov  <jskov@redhat.com>
 
 	* include/hal_endian.h: Added.
--- a/packages/hal/common/current/cdl/debugging.cdl
+++ b/packages/hal/common/current/cdl/debugging.cdl
@@ -119,15 +119,21 @@ cdl_option CYGDBG_HAL_DEBUG_GDB_THREAD_S
 
 cdl_option CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES {
     display       "Number of times to retry sending a \$O packet"
-    default_value 3
+    default_value 0
+    flavor        data
     description   "
         This option controls the number of attempts that eCos programs
-        will make to send a \$O packet to a host GDB process."
+        will make to send a \$O packet to a host GDB process.  If it is
+        set non-zero, then the target process will attempt to resend the
+        \$O packet data up to this number of retries.  Caution: use of
+        this option is not recommended as it can thoroughly confuse the
+        host GDB process."
 }
 
 cdl_option CYGNUM_HAL_DEBUG_GDB_PROTOCOL_TIMEOUT {
     display       "Timeout period for GDB packets"
     default_value 500
+    flavor        data
     description   "
         This option controls the time (in milliseconds) that eCos programs
         will wait for a response when sending packets to a host GDB process.
--- a/packages/hal/common/current/include/generic-stub.h
+++ b/packages/hal/common/current/include/generic-stub.h
@@ -84,11 +84,15 @@ struct gdb_packet
    *  3 = looking for second byte of checksum (indicating end of packet)
    */
   char state;
+  char err;  // This is set if the packet should be tossed because of overflow
 };
 
 /* Return the currently-saved value corresponding to register REG. */
 extern target_register_t get_register (regnames_t reg);
 
+/* Write the contents of register WHICH into VALUE as raw bytes */
+extern int get_register_as_bytes (regnames_t which, char *value);
+
 #ifdef CYGHWR_REGISTER_VALIDITY_CHECKING
 // Return the validity of register REG.
 extern int get_register_valid (regnames_t reg);
@@ -97,6 +101,8 @@ extern int get_register_valid (regnames_
 /* Store VALUE in the register corresponding to WHICH. */
 extern void put_register (regnames_t which, target_register_t value);
 
+extern int put_register_as_bytes (regnames_t which, char *value);
+
 /* Set the next instruction to be executed when the user program resumes
    execution to PC. */
 #if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc)
@@ -321,6 +327,13 @@ extern void __putDebugStr (char *str);
 #define MAX_BP_NUM 64 /* Maximum allowed # of breakpoints */
 #endif
 
+extern int hal_syscall_handler(void);
+extern int __is_bsp_syscall(void);
+
+extern void __install_breakpoint_list (void);
+extern void __clear_breakpoint_list (void);
+extern int __display_breakpoint_list (void (*print_func)(target_register_t));
+
 #endif /* ASM */
 
 #ifdef __cplusplus
--- a/packages/hal/common/current/include/hal_stub.h
+++ b/packages/hal/common/current/include/hal_stub.h
@@ -234,7 +234,7 @@ do {                                    
 do {                                                                          \
     cyg_hal_gdb_remove_break( (target_register_t)&&cyg_hal_gdb_break_place ); \
     HAL_RESTORE_INTERRUPTS(_old_);                                            \
-cyg_hal_gdb_break_place:                                                      \
+cyg_hal_gdb_break_place:;                                                     \
 } while ( 0 )
 
 #else // use __builtin_return_address instead.
@@ -257,10 +257,14 @@ do {                                    
 
 // so define these just to do interrupts:
 #define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ )   \
-    HAL_DISABLE_INTERRUPTS(_old_)
+do {                                                    \
+    HAL_DISABLE_INTERRUPTS(_old_);                      \
+} while (0);
 
 #define CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION( _old_ )   \
-    HAL_RESTORE_INTERRUPTS(_old_)
+do {                                                    \
+    HAL_RESTORE_INTERRUPTS(_old_);                      \
+} while (0);
 
 #endif
 
@@ -275,8 +279,14 @@ extern HAL_SavedRegisters *_hal_register
 
 extern int cyg_hal_gdb_break;
 
-//---------------------------------------------------------------------------
-// Local strcpy/strlen functions removes libc dependency.
+#ifdef CYGPKG_ISOINFRA
+# include <pkgconf/isoinfra.h>
+#endif
+#ifdef CYGINT_ISO_STRING_STRFUNCS
+# include <string.h>
+#else
+//-----------------------------------------------------------------------------
+// String helpers. These really should come from ISOINFRA
 static inline char *strcpy( char *s, const char *t)
 {
     char *r = s;
@@ -295,6 +305,7 @@ static inline size_t strlen( const char 
     while( *s++ ) r++;
     return r;
 }
+#endif
 
 //-----------------------------------------------------------------------------
 // Repeat the cache definitions here to avoid too much hackery in 
--- a/packages/hal/common/current/src/generic-stub.c
+++ b/packages/hal/common/current/src/generic-stub.c
@@ -112,7 +112,7 @@ char GDB_stubs_version[] CYGBLD_ATTRIB_W
 // We cannot share memcpy and memset with the rest of the system since
 // the user may want to step through it.
 static inline void*
-memcpy(void* dest, void* src, int size)
+_memcpy(void* dest, void* src, int size)
 {
     unsigned char* __d = (unsigned char*) dest;
     unsigned char* __s = (unsigned char*) src;
@@ -124,7 +124,7 @@ memcpy(void* dest, void* src, int size)
 }
 
 static inline void*
-memset(void* s, int c, int size)
+_memset(void* s, int c, int size)
 {
     unsigned char* __s = (unsigned char*) s;
     unsigned char __c = (unsigned char) c;
@@ -138,6 +138,8 @@ memset(void* s, int c, int size)
 #else
 #include <string.h>
 #include <signal.h>
+#define _memcpy memcpy
+#define _memset memset
 #endif // __ECOS__
 
 /************************************************************************/
@@ -227,10 +229,13 @@ getpacket (buffer)
 
     packet.state = 0;
     packet.contents = buffer;
+    packet.err = 0;
     while ((res = __add_char_to_packet (readDebugChar () & 0xff, &packet)) != 1) {
         if (res == -2) {
-            putDebugChar ('+'); // Pretend we took the packet
-            __putpacket("E01"); // ... but didn't process it
+            putDebugChar ('-'); // Tell host packet was not processed
+            // Reset for the next packet
+            packet.state = 0;
+            packet.err = 0;
         }
     }
 }
@@ -262,11 +267,12 @@ int
       else
         {
           if (packet->length == BUFMAX) {
-            packet->state = 0;
-            return -2;
+              packet->state = 0;
+              packet->err = 1;
+          } else {
+              packet->checksum += ch;
+              packet->contents[packet->length++] = ch;
           }
-          packet->checksum += ch;
-          packet->contents[packet->length++] = ch;
         }
       return 0;
     }
@@ -281,6 +287,10 @@ int
   if (packet->state == 3)
     {
       packet->xmitcsum |= stubhex (ch);
+      if (packet->err) {
+          // Packet was too long - just tell the consumer
+          return -2;
+      }
       if ((packet->checksum & 255) != packet->xmitcsum)
         {
           putDebugChar ('-');   /* failed checksum */
@@ -994,11 +1004,29 @@ void
 int   (*_get_trace_register_hook) (regnames_t, target_register_t *);
 
 void
-stub_format_registers(char *ptr)
+stub_format_registers(char *packet, char *ptr)
 {
     int regnum;
+    int sr = 0, er = NUMREGS_GDB;
 
-    for (regnum = 0; regnum < NUMREGS_GDB; regnum++) {
+    if (packet[0] == 'p')
+      {
+	 target_register_t regno;
+         char *p = &packet[1];
+	 if (__hexToInt (&p, &regno))
+	   {
+	     sr = regno;
+	     er = regno + 1;
+	   }
+	 else
+	   {
+	     strcpy (ptr, "INVALID");
+	     return;
+	   }
+      }
+
+    for (regnum = sr; regnum < er; regnum++)
+      {
         /* We need to compensate for the value offset within the
            register. */
         char dummyDat[32];
@@ -1046,11 +1074,11 @@ stub_format_registers(char *ptr)
 #if defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
                 for (x = 0; x < off; x++)
                     dummyDat[x + sizeof(addr)] = extend_val;
-                memcpy (dummyDat, &addr, sizeof (addr));
+                _memcpy (dummyDat, &addr, sizeof (addr));
 #else
                 for (x = 0; x < off; x++)
                     dummyDat[x] = extend_val;
-                memcpy (dummyDat + off, &addr, sizeof (addr));
+                _memcpy (dummyDat + off, &addr, sizeof (addr));
 #endif
                 vptr = dummyDat;
             }
@@ -1061,7 +1089,7 @@ stub_format_registers(char *ptr)
             /* Trace component returned a failure code.
                This means that the register value is not available.
                We'll fill it with 'x's, and GDB will understand.  */
-            memset (ptr, 'x', 2 * REGSIZE (regnum));
+            _memset (ptr, 'x', 2 * REGSIZE (regnum));
             ptr += 2 * REGSIZE (regnum);
         }
     }
@@ -1164,10 +1192,10 @@ int
       process_set (&packet[1]);
       break;
 
+    case 'p':		/* return the value of  a single CPU register */
     case 'g':           /* return the value of the CPU registers */
       {
-        char *ptr = remcomOutBuffer;
-        stub_format_registers(ptr);
+        stub_format_registers(&packet[0], remcomOutBuffer);
         break;
       }
 
@@ -1500,28 +1528,26 @@ int
 		      else
 			strcpy (remcomOutBuffer, "E02");
 		      break;
-#ifdef HAL_STUB_HW_BREAKPOINT
 		    case 1:
 		      /* hw breakpoint */
+#ifdef HAL_STUB_HW_BREAKPOINT
 		      if (!HAL_STUB_HW_BREAKPOINT(is_Z, (void *)addr, length))
 			strcpy (remcomOutBuffer, "OK");
 		      else
+#endif
 			strcpy (remcomOutBuffer, "E02");
 		      break;
-#endif
-#ifdef HAL_STUB_HW_WATCHPOINT
 		    case 2:
 		    case 3:
 		    case 4:
-			{
 		      /* hw watchpoint */
+#ifdef HAL_STUB_HW_WATCHPOINT
 		      if (!HAL_STUB_HW_WATCHPOINT(is_Z, (void *)addr, length, ztype))
 			strcpy (remcomOutBuffer, "OK");
 		      else
+#endif
 			strcpy (remcomOutBuffer, "E02");
-			}
 		      break;
-#endif
 		  }
 	      }
 	  }
@@ -1808,7 +1834,7 @@ void
           if (s == NULL)
             return;
 
-          memcpy (s, argv[x], len);
+          _memcpy (s, argv[x], len);
         }
     }
 }
@@ -1915,6 +1941,10 @@ process_query (char *pkt)
         }
       return;
     }
+#ifdef CYG_HAL_STUB_PROCESS_QUERY
+  else if (CYG_HAL_STUB_PROCESS_QUERY (pkt, remcomOutBuffer, sizeof(remcomOutBuffer)))
+    return;
+#endif
   else
     {
       char ch ;
@@ -1945,8 +1975,13 @@ static void
 process_set (char *pkt)
 {
   char ch ;
+  
+#ifdef CYG_HAL_STUB_PROCESS_SET
+  if (CYG_HAL_STUB_PROCESS_SET (pkt, remcomOutBuffer, sizeof(remcomOutBuffer)))
+    return;
+#endif
+
   ch = *pkt ;
-  
   switch (ch)
     {
     case 'p' : /* Set current process or thread */
--- a/packages/hal/common/current/src/hal_if.c
+++ b/packages/hal/common/current/src/hal_if.c
@@ -83,15 +83,22 @@ static __call_if_flash_cfg_op_fn_t flash
 static cyg_bool
 flash_config_op( int op, char * key, void *val, int type)
 {
+    cyg_bool res = false;
+
+    CYGARC_HAL_SAVE_GP();
+
     switch ( op ) {
     case CYGNUM_CALL_IF_FLASH_CFG_GET:
-        return flash_get_config( key, val, type );
+        res = flash_get_config( key, val, type );
+        break;
     default:
         // nothing else supported yet - though it is expected that "set"
         // will fit the same set of arguments, potentially.
         break;
     }
-    return 0;
+
+    CYGARC_HAL_RESTORE_GP();
+    return res;
 }
 #endif
 
@@ -391,7 +398,9 @@ cyg_hal_diag_mangler_gdb_putc(void* __ch
 {
     static char line[100];
     static int pos = 0;
+#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0
     int tries = CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES;
+#endif
 
     // No need to send CRs
     if( c == '\r' ) return;
@@ -416,8 +425,10 @@ cyg_hal_diag_mangler_gdb_putc(void* __ch
         CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old);
 #endif
         
+#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0
         // Only wait 500ms for data to arrive - avoid "stuck" connections
         CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, CYGNUM_HAL_DEBUG_GDB_PROTOCOL_TIMEOUT);
+#endif
 
         while(1)
         {
@@ -443,10 +454,14 @@ cyg_hal_diag_mangler_gdb_putc(void* __ch
             CYGACC_COMM_IF_PUTC(*__chan, hex[csum&0xF]);
 
         nak:
+#if CYGNUM_HAL_DEBUG_GDB_PROTOCOL_RETRIES != 0
             if (CYGACC_COMM_IF_GETC_TIMEOUT(*__chan, &c1) == 0) {
                 c1 = '-';
-                if (--tries == 0) c1 = '+';
+                if (tries && (--tries == 0)) c1 = '+';
             }
+#else
+            c1 = CYGACC_COMM_IF_GETC(*__chan);
+#endif
 
             if( c1 == '+' ) break;
 
--- a/packages/hal/common/current/src/hal_stub.c
+++ b/packages/hal/common/current/src/hal_stub.c
@@ -75,12 +75,20 @@
 //-----------------------------------------------------------------------------
 // Extra eCos data.
 
+// Some architectures use registers of different sizes, so NUMREGS
+// alone is not suffucient to size the register save area. For those
+// architectures, HAL_STUB_REGISTERS_SIZE is defined as the number
+// of target_register_t sized elements in the register save area.
+#ifndef HAL_STUB_REGISTERS_SIZE
+#define HAL_STUB_REGISTERS_SIZE NUMREGS
+#endif
+
 // Saved registers.
 HAL_SavedRegisters *_hal_registers;
-target_register_t registers[NUMREGS];
-target_register_t alt_registers[NUMREGS] ;  // Thread or saved process state
-target_register_t * _registers = registers; // Pointer to current set of registers
-target_register_t orig_registers[NUMREGS];  // Registers to get back to original state
+target_register_t registers[HAL_STUB_REGISTERS_SIZE];
+target_register_t alt_registers[HAL_STUB_REGISTERS_SIZE] ;  // Thread or saved process state
+target_register_t * _registers = registers;                 // Pointer to current set of registers
+target_register_t orig_registers[HAL_STUB_REGISTERS_SIZE];  // Registers to get back to original state
 
 #if defined(HAL_STUB_HW_WATCHPOINT) || defined(HAL_STUB_HW_BREAKPOINT)
 static int  _hw_stop_reason;   // Reason we were stopped by hw.
@@ -116,6 +124,7 @@ static volatile __PFI __interruptible_co
 //-----------------------------------------------------------------------------
 // Register access
 
+#ifndef CYGARC_STUB_REGISTER_ACCESS_DEFINED
 // Return the currently-saved value corresponding to register REG of
 // the exception context.
 target_register_t 
@@ -123,6 +132,7 @@ get_register (regnames_t reg)
 {
     return _registers[reg];
 }
+#endif
 
 #ifdef CYGHWR_REGISTER_VALIDITY_CHECKING
 // Return the validity of register REG.
@@ -133,6 +143,7 @@ get_register_valid (regnames_t reg)
 }
 #endif
 
+#ifndef CYGARC_STUB_REGISTER_ACCESS_DEFINED
 // Store VALUE in the register corresponding to WHICH in the exception
 // context.
 void 
@@ -152,6 +163,7 @@ put_register (regnames_t which, target_r
 #endif    
     _registers[which] = value;
 }
+#endif // CYGARC_STUB_REGISTER_ACCESS_DEFINED
 
 //-----------------------------------------------------------------------------
 // Serial stuff
--- a/packages/hal/common/current/src/thread-packets.c
+++ b/packages/hal/common/current/src/thread-packets.c
@@ -23,7 +23,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -115,8 +115,8 @@ void output_threadid(char * title,thread
 
 extern target_register_t * _registers ;
     /* A pointer to the current set of registers */
-extern target_register_t registers[NUMREGS]; /* The current saved registers */
-extern target_register_t alt_registers[NUMREGS] ;
+extern target_register_t registers[]; /* The current saved registers */
+extern target_register_t alt_registers[] ;
     /* Thread or saved process state */
 
 
--- a/packages/hal/i386/arch/current/ChangeLog
+++ b/packages/hal/i386/arch/current/ChangeLog
@@ -1,3 +1,39 @@
+2001-10-15  Mark Salter  <msalter@redhat.com>
+
+	* src/i386_stub.c (hal_get_gdb_registers): Save idt/gdt in GDB regs.
+	({put,get}_register_as_bytes): Support idt/gdt.
+
+2001-10-12  Mark Salter  <msalter@redhat.com>
+
+	* include/i386_stub.h: Add support for FPU and other regs.
+	* src/i386_stub.c: Ditto.
+
+	* src/vectors.S: Add SSE support.
+	* include/i386.inc: Ditto.
+	* include/arch.inc: Ditto.
+	* include/hal_arch.h: Add SSE state to HAL_FPU_Context.
+	* cdl/hal_i386.cdl: Add CYGHWR_HAL_I386_PENTIUM and
+	CYGHWR_HAL_I386_PENTIUM_SSE.
+	* cdl/hal_i386.cdl: Add CYGHWR_HAL_I386_PENTIUM_GDB_REGS.
+
+2001-10-08  Ian Campbell  <icampbell@arcom.co.uk>
+
+	* cdl/hal_i386.cdl: move CYGBLD_BUILD_I386_ROMBOOT and
+	CYGBLD_BUILD_REDBOOT_BIN_ROM to pc package.
+	* src/romboot.S: Moved to pc package
+	* src/romboot.ld: Moved to pc package
+
+2001-10-11  Fabrice Gautier  <Fabrice_Gautier@sdesigns.com>
+
+	* include/hal_io.h: Add _STRING variants of I/O macros to allow
+	writing of consecutive items to the same registers.
+
+2001-10-10  Fabrice Gautier  <Fabrice_Gautier@sdesigns.com>
+2001-10-10  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/vectors.S: Don't use apostrophes in comments as it can confuse
+	preprocessors sometimes.
+
 2001-10-05  Mark Salter  <msalter@redhat.com>
 
 	* src/vectors.S: Support separate stub stack.
--- a/packages/hal/i386/arch/current/cdl/hal_i386.cdl
+++ b/packages/hal/i386/arch/current/cdl/hal_i386.cdl
@@ -73,45 +73,6 @@ cdl_package CYGPKG_HAL_I386 {
     }
 
         
-    cdl_option CYGBLD_BUILD_I386_ROMBOOT {
-	display       "Build ROM bootstrap code"
-	calculated    { CYG_HAL_STARTUP == "ROM" }
-
-	make {
-	    <PREFIX>/lib/romboot.ld: <PACKAGE>/src/romboot.ld
-	    cp $< $@
-	}
-	
-	make {
-	    <PREFIX>/bin/romboot.elf : <PACKAGE>/src/romboot.S
-	    @sh -c "mkdir -p $(dir $@)"
-	    $(CC) -Wp,-MD,romboot.tmp $(INCLUDE_PATH) -nostdlib -Wl,-static -T$(PREFIX)/lib/romboot.ld -o $@ $<
-	    @echo $@ ": \\" > $(notdir $@).deps
-	    @tail +2 romboot.tmp >> $(notdir $@).deps
-	    @echo >> $(notdir $@).deps
-	    @rm romboot.tmp
-	}
-    }
-
-    cdl_option CYGBLD_BUILD_REDBOOT_BIN_ROM {
-	display       "Build Redboot ROM binary image"
-	active_if     CYGBLD_BUILD_REDBOOT
-	active_if     { CYG_HAL_STARTUP == "ROM" }
-	default_value { CYG_HAL_STARTUP == "ROM" }
-	no_define
-	description "This option enables the conversion of the Redboot ELF
-	image to a binary image suitable for ROM programming."
-    
-	make -priority 325 {
-	    <PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
-	    $(OBJCOPY) -O binary $< $(@:.bin=.img)
-	    $(OBJCOPY) -O binary $(PREFIX)/bin/romboot.elf $(PREFIX)/bin/romboot.img
-	    dd if=/dev/zero of=$@ bs=1024 count=64 conv=sync
-	    dd if=$(@:.bin=.img) of=$@ bs=512 conv=notrunc,sync
-	    dd if=$(PREFIX)/bin/romboot.img of=$@ bs=256 count=1 seek=255 conv=notrunc
-	}
-    }
-    
     cdl_component CYGHWR_HAL_I386_FPU {
 	display       "Enable I386 FPU support"
 	default_value 1
@@ -139,6 +100,38 @@ cdl_package CYGPKG_HAL_I386 {
 	}
     }
     
+    cdl_component CYGHWR_HAL_I386_PENTIUM {
+	display       "Enable Pentium class CPU features"
+	default_value 0
+	description   "This component enables support for various
+	              features of Pentium class CPUs."
+
+	cdl_option CYGHWR_HAL_I386_PENTIUM_SSE {
+	    display       "Save/Restore SSE registers on context switch"
+	    flavor        bool
+	    default_value 0
+
+	    description "
+	                This option enables SSE state switching. The default
+                        behaviour for eCos is to ignore the SSE registers.
+                        Enabling this option adds SSE state information to
+                        every thread context."
+	}
+
+	cdl_option CYGHWR_HAL_I386_PENTIUM_GDB_REGS {
+	    display       "Support extra Pentium registers in GDB stub"
+	    flavor        bool
+	    default_value 0
+
+	    description "
+	                This option enables support for extra Pentium registers
+			in the GDB stub. These are registers such as CR0-CR4, and
+                        all MSRs. Not all GDBs support these registers, so the
+                        default behaviour for eCos is to not include them in the
+			GDB stub support code."
+	}
+    }
+    
     cdl_option CYGBLD_LINKER_SCRIPT {
         display "Linker script"
         flavor data
--- a/packages/hal/i386/arch/current/include/arch.inc
+++ b/packages/hal/i386/arch/current/include/arch.inc
@@ -25,7 +25,7 @@
 #                                                                          
 # The Initial Developer of the Original Code is Red Hat.                   
 # Portions created by Red Hat are                                          
-# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 # All Rights Reserved.                                                     
 # -------------------------------------------                              
 #                                                                          
@@ -91,7 +91,7 @@
 #------------------------------------------------------------------------------
 # Stack switching macros
 
-#ifndef CYG_HAL_PPC_INTSTACK_MACROS_DEFINED
+#ifndef CYG_HAL_I386_INTSTACK_MACROS_DEFINED
 
 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
 
@@ -126,7 +126,7 @@ 2:
 	popl	%esp				# pop old SP from stack
 	.endm
 
-#define CYG_HAL_PPC_INTSTACK_MACROS_DEFINED
+#define CYG_HAL_I386_INTSTACK_MACROS_DEFINED
 
 
 #else // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
@@ -146,11 +146,11 @@ 2:
 	.macro	hal_from_intstack
 	.endm
 
-#define CYG_HAL_PPC_INTSTACK_MACROS_DEFINED
+#define CYG_HAL_I386_INTSTACK_MACROS_DEFINED
 
 #endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
 
-#endif // CYG_HAL_PPC_INTSTACK_MACROS_DEFINED
+#endif // CYG_HAL_I386_INTSTACK_MACROS_DEFINED
 	
 #------------------------------------------------------------------------------
 # FPU macros.
@@ -185,6 +185,28 @@ 2:
         fldcw	0(%esp)		# reload
 	addl	$4,%esp		# pop value
 
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+        # set CR4.OSFXSR to safely use stmxcsr/ldmxcsr
+        movl	%cr4, %eax
+        orl	$0x200, %eax
+        movl	%eax, %cr4
+
+        ## Enable SIMD exceptions. Bit mask:
+        ## 0x0080 - invalid operation
+        ## 0x0100 - denormalized operand
+        ## 0x0200 - zero divide
+        ## 0x0400 - overflow
+        ## 0x0800 - underflow
+        ## 0x1000 - precision
+        pushl   $0              # space for MXCSR
+        stmxcsr 0(%esp)         # store MXCSR to stack	
+        movl    0(%esp),%eax    # get into EAX
+        andw    $(~0x0200),%ax  # allow only zero divide exceptions
+        movl    %eax,0(%esp)    # put back into memory
+        ldmxcsr 0(%esp)         # reload
+        addl    $4,%esp         # pop value
+#endif
+
 #ifdef CYGHWR_HAL_I386_FPU_SWITCH_LAZY
 	# Tell the CPU to generate an FPU unavailable exception
 	# when the FPU is first used.
@@ -230,6 +252,28 @@ 2:
         fldcw	0(%esp)		# reload
 	addl	$4,%esp		# pop value
 
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+        # set CR4.OSFXSR to safely use stmxcsr/ldmxcsr
+        movl	%cr4, %eax
+        orl	$0x200, %eax
+        movl	%eax, %cr4
+
+        ## Enable SIMD exceptions. Bit mask:
+        ## 0x0080 - invalid operation
+        ## 0x0100 - denormalized operand
+        ## 0x0200 - zero divide
+        ## 0x0400 - overflow
+        ## 0x0800 - underflow
+        ## 0x1000 - precision
+        pushl   $0              # space for MXCSR
+        stmxcsr 0(%esp)         # store MXCSR to stack	
+        movl    0(%esp),%eax    # get into EAX
+        andw    $(~0x0200),%ax  # allow only zero divide exceptions
+        movl    %eax,0(%esp)    # put back into memory
+        ldmxcsr 0(%esp)         # reload
+        addl    $4,%esp         # pop value
+#endif
+
 #ifdef CYGHWR_HAL_I386_FPU_SWITCH_LAZY
 	# Tell the CPU to generate an FPU unavailable exception
 	# when the FPU is first used.
@@ -259,6 +303,23 @@ 2:
 	.macro	hal_fpu_push_ctx
 	subl	$i386reg_fpstate_size,%esp	# make space
 	fsave	i386reg_fpstate(%esp)		# save FPU state
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# Save SIMD state.
+
+	# FIXME. This is awfully inefficient. Need to use FXSAVE to
+	# save FPU and SIMD at same time. FXSAVE requires a 16 byte
+	# alignment and does not have an implicit finit as does FSAVE.
+
+	stmxcsr	i386reg_simd_mxcsr(%esp)
+	movups	%xmm0,i386reg_simd_xmm0(%esp)
+	movups	%xmm1,i386reg_simd_xmm1(%esp)
+	movups	%xmm2,i386reg_simd_xmm2(%esp)
+	movups	%xmm3,i386reg_simd_xmm3(%esp)
+	movups	%xmm4,i386reg_simd_xmm4(%esp)
+	movups	%xmm5,i386reg_simd_xmm5(%esp)
+	movups	%xmm6,i386reg_simd_xmm6(%esp)
+	movups	%xmm7,i386reg_simd_xmm7(%esp)
+#endif
 	movl	$1,i386reg_fpstate_valid(%esp)	# indicate it is valid
 	.endm
 
@@ -266,9 +327,29 @@ 2:
 	btl	$0,i386reg_fpstate_valid(%esp)	# check ls bit of valid flag
 	jc	1f				# if set, restore state
 	finit					# otherwise init FPU
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# FIXME. Anything needed here?
+#endif
 	jmp	2f				# and skip restore
 1:
 	frstor  i386reg_fpstate(%esp)		# restore FPU state
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# Restore SIMD state.
+
+	# FIXME. This is awfully inefficient. Need to use FXRSTOR to
+	# restore FPU and SIMD at same time. FXRSTOR requires a 16 byte
+	# alignment.
+
+	movups	i386reg_simd_xmm0(%esp),%xmm0
+	movups	i386reg_simd_xmm1(%esp),%xmm1
+	movups	i386reg_simd_xmm2(%esp),%xmm2
+	movups	i386reg_simd_xmm3(%esp),%xmm3
+	movups	i386reg_simd_xmm4(%esp),%xmm4
+	movups	i386reg_simd_xmm5(%esp),%xmm5
+	movups	i386reg_simd_xmm6(%esp),%xmm6
+	movups	i386reg_simd_xmm7(%esp),%xmm7
+	ldmxcsr	i386reg_simd_mxcsr(%esp)
+#endif
 2:
 	addl	$i386reg_fpstate_size,%esp	# pop space used
 	.endm
@@ -414,6 +495,23 @@ 1:
 	cmpl	$0,%eax				# test it
 	je	1f				# skip if zero
 	fsave	i386reg_fpucontext_state(%eax)	# save state
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# Save SIMD state.
+
+	# FIXME. This is awfully inefficient. Need to use FXSAVE to
+	# save FPU and SIMD at same time. FXSAVE requires a 16 byte
+	# alignment and does not have an implicit finit as does FSAVE.
+
+	stmxcsr	i386reg_simd_mxcsr(%eax)
+	movups	%xmm0,i386reg_simd_xmm0(%eax)
+	movups	%xmm1,i386reg_simd_xmm1(%eax)
+	movups	%xmm2,i386reg_simd_xmm2(%eax)
+	movups	%xmm3,i386reg_simd_xmm3(%eax)
+	movups	%xmm4,i386reg_simd_xmm4(%eax)
+	movups	%xmm5,i386reg_simd_xmm5(%eax)
+	movups	%xmm6,i386reg_simd_xmm6(%eax)
+	movups	%xmm7,i386reg_simd_xmm7(%eax)
+#endif
 	movl	$1,i386reg_fpucontext_valid(%eax) # set valid
 	movl	$0,0(%ecx,%ebx,4)		# zero owner pointer
 1:
--- a/packages/hal/i386/arch/current/include/hal_arch.h
+++ b/packages/hal/i386/arch/current/include/hal_arch.h
@@ -26,7 +26,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -59,6 +59,17 @@ typedef struct
 {
     cyg_uint32  fpstate_valid;
     cyg_uint32  fpstate[108/sizeof(cyg_uint32)];
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+    cyg_uint32  xmm0[4];
+    cyg_uint32  xmm1[4];
+    cyg_uint32  xmm2[4];
+    cyg_uint32  xmm3[4];
+    cyg_uint32  xmm4[4];
+    cyg_uint32  xmm5[4];
+    cyg_uint32  xmm6[4];
+    cyg_uint32  xmm7[4];
+    cyg_uint32  mxcsr;
+#endif
 } HAL_FPU_Context;
 
 #endif
--- a/packages/hal/i386/arch/current/include/hal_io.h
+++ b/packages/hal/i386/arch/current/include/hal_io.h
@@ -26,7 +26,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -34,16 +34,16 @@
 //=============================================================================
 //#####DESCRIPTIONBEGIN####
 //
-// Author(s):   nickg
-// Contributors:nickg
-// Date:        1998-02-17
-// Purpose:     Define IO register support
-// Description: The macros defined here provide the HAL APIs for handling
-//              device IO control registers.
+// Author(s):    nickg
+// Contributors: Fabrice Gautier
+// Date:         1998-02-17
+// Purpose:      Define IO register support
+// Description:  The macros defined here provide the HAL APIs for handling
+//               device IO control registers.
 //              
 // Usage:
-//              #include <cyg/hal/hal_io.h>
-//              ...
+//               #include <cyg/hal/hal_io.h>
+//               ...
 //
 //####DESCRIPTIONEND####
 //
@@ -69,8 +69,8 @@ CYG_MACRO_START                         
 {                                               \
     asm volatile ( "xor %%eax,%%eax ;"          \
                    "inb %%dx, %%al"             \
-                   : "=a" (_value_)           \
-                   :  "d"(_register_)         \
+                   : "=a" (_value_)             \
+                   :  "d"(_register_)           \
         );                                      \
 }                                               \
 CYG_MACRO_END
@@ -86,14 +86,30 @@ CYG_MACRO_START                         
 CYG_MACRO_END
 
 #define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ )     \
-    CYG_MACRO_START                                                     \
-    ! Not supported MACRO !						\
-    CYG_MACRO_END
+CYG_MACRO_START                                                         \
+    ! Not supported MACRO !                                             \
+CYG_MACRO_END
 
 #define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ )    \
-    CYG_MACRO_START                                                     \
-    ! Not supported MACRO !						\
-    CYG_MACRO_END
+CYG_MACRO_START                                                         \
+    ! Not supported MACRO !                                             \
+CYG_MACRO_END
+
+#define HAL_READ_UINT8_STRING( _register_, _buf_, _count_)      \
+CYG_MACRO_START                                                 \
+    asm volatile ( "insb"                                       \
+                   :                                            \
+                   : "c" (_count_), "d"(_register_), "D"(_buf_) \
+        );                                                      \
+CYG_MACRO_END
+
+#define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_)     \
+CYG_MACRO_START                                                 \
+    asm volatile ( "outsb"                                      \
+                   :                                            \
+                   : "c" (_count_), "d"(_register_), "S"(_buf_) \
+        );                                                      \
+CYG_MACRO_END
 
 
 //-----------------------------------------------------------------------------
@@ -105,8 +121,8 @@ CYG_MACRO_START                         
 {                                               \
     asm volatile ( "xor %%eax,%%eax ;"          \
                    "inw %%dx, %%ax"             \
-                   : "=a" (_value_)           \
-                   :  "d"(_register_)         \
+                   : "=a" (_value_)             \
+                   :  "d"(_register_)           \
         );                                      \
 }                                               \
 CYG_MACRO_END
@@ -121,17 +137,35 @@ CYG_MACRO_START                         
 }                                                       \
 CYG_MACRO_END
 
-
 #define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ )    \
     CYG_MACRO_START                                                     \
-    ! Not supported MACRO !						\
+    ! Not supported MACRO !                                             \
     CYG_MACRO_END
 
+
 #define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ )   \
     CYG_MACRO_START                                                     \
-    ! Not supported MACRO !						\
+    ! Not supported MACRO !                                             \
+    CYG_MACRO_END
+
+#define HAL_READ_UINT16_STRING( _register_, _buf_, _count_)             \
+    CYG_MACRO_START                                                     \
+    asm volatile ( "insw"                                               \
+                   :                                                    \
+                   : "c" (_count_), "d"(_register_), "D"(_buf_)         \
+        );                                                              \
     CYG_MACRO_END
 
+#define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_)            \
+    CYG_MACRO_START                                                     \
+    asm volatile ( "outsw"                                              \
+                   :                                                    \
+                   : "c" (_count_), "d"(_register_), "S"(_buf_)         \
+        );                                                              \
+    CYG_MACRO_END
+
+
+
 //-----------------------------------------------------------------------------
 // 32 bit access.
 // Individual and vectorized access to 32 bit registers.
@@ -140,8 +174,8 @@ CYG_MACRO_END
 CYG_MACRO_START                                 \
 {                                               \
     asm volatile ( "inl %%dx, %%eax"            \
-                   : "=a" (_value_)           \
-                   :  "d"(_register_)         \
+                   : "=a" (_value_)             \
+                   :  "d"(_register_)           \
         );                                      \
 }                                               \
 CYG_MACRO_END
@@ -151,21 +185,38 @@ CYG_MACRO_START                         
 {                                                       \
     asm volatile ( "outl %%eax,%%dx"                    \
                    :                                    \
-                   : "a" (_value_), "d"(_register_) \
+                   : "a" (_value_), "d"(_register_)     \
         );                                              \
 }                                                       \
 CYG_MACRO_END
 
 #define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ )    \
     CYG_MACRO_START                                                     \
-    ! Not supported MACRO !						\
+    ! Not supported MACRO !                                             \
     CYG_MACRO_END
 
 #define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ )   \
     CYG_MACRO_START                                                     \
-    ! Not supported MACRO !						\
+    ! Not supported MACRO !                                             \
+    CYG_MACRO_END
+
+#define HAL_READ_UINT32_STRING( _register_, _buf_, _count_)             \
+    CYG_MACRO_START                                                     \
+    asm volatile ( "insl"                                               \
+                   :                                                    \
+                   : "c" (_count_), "d"(_register_), "D"(_buf_)         \
+        );                                                              \
     CYG_MACRO_END
 
+#define HAL_WRITE_UINT32_STRING( _register_, _buf_, _count_)            \
+    CYG_MACRO_START                                                     \
+    asm volatile ( "outsl"                                              \
+                   :                                                    \
+                   : "c" (_count_), "d"(_register_), "S"(_buf_)         \
+        );                                                              \
+    CYG_MACRO_END
+
+
 //-----------------------------------------------------------------------------
 
 // Macros for acessing shared memory structures
--- a/packages/hal/i386/arch/current/include/i386.inc
+++ b/packages/hal/i386/arch/current/include/i386.inc
@@ -23,7 +23,7 @@
 #                                                                          
 # The Initial Developer of the Original Code is Red Hat.                   
 # Portions created by Red Hat are                                          
-# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 # All Rights Reserved.                                                     
 # -------------------------------------------                              
 #                                                                          
@@ -63,12 +63,25 @@
 #else
 	.equ	i386reg_fpstate_valid,	0
 	.equ	i386reg_fpstate,	i386reg_fpstate_valid+4
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	.equ	i386reg_simd_xmm0,	i386reg_fpstate+108
+	.equ	i386reg_simd_xmm1,	i386reg_simd_xmm0+16
+	.equ	i386reg_simd_xmm2,	i386reg_simd_xmm1+16
+	.equ	i386reg_simd_xmm3,	i386reg_simd_xmm2+16
+	.equ	i386reg_simd_xmm4,	i386reg_simd_xmm3+16
+	.equ	i386reg_simd_xmm5,	i386reg_simd_xmm4+16
+	.equ	i386reg_simd_xmm6,	i386reg_simd_xmm5+16
+	.equ	i386reg_simd_xmm7,	i386reg_simd_xmm6+16
+	.equ	i386reg_simd_mxcsr,	i386reg_simd_xmm7+16
+	.equ	i386reg_fpstate_size,	i386reg_simd_mxcsr+4
+#else
 	.equ	i386reg_fpstate_size,	i386reg_fpstate+108
+#endif
 	.equ	i386reg_edi,		i386reg_fpstate_size
 #endif
 #else
 	.equ	i386reg_edi,		0
-#endif
+# endif
 	.equ	i386reg_esi,		i386reg_edi+4
 	.equ	i386reg_ebp,		i386reg_esi+4
 	.equ	i386reg_esp,		i386reg_ebp+4
@@ -86,8 +99,21 @@
 #if defined(CYGHWR_HAL_I386_FPU) && defined(CYGHWR_HAL_I386_FPU_SWITCH_LAZY)
 	.equ	i386reg_fpucontext_valid,	0
 	.equ	i386reg_fpucontext_state,	i386reg_fpucontext_valid+4
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	.equ	i386reg_simd_xmm0,		i386reg_fpucontext_state+108
+	.equ	i386reg_simd_xmm1,		i386reg_simd_xmm0+16
+	.equ	i386reg_simd_xmm2,		i386reg_simd_xmm1+16
+	.equ	i386reg_simd_xmm3,		i386reg_simd_xmm2+16
+	.equ	i386reg_simd_xmm4,		i386reg_simd_xmm3+16
+	.equ	i386reg_simd_xmm5,		i386reg_simd_xmm4+16
+	.equ	i386reg_simd_xmm6,		i386reg_simd_xmm5+16
+	.equ	i386reg_simd_xmm7,		i386reg_simd_xmm6+16
+	.equ	i386reg_simd_mxcsr,		i386reg_simd_xmm7+16
+	.equ	i386reg_fpucontext_size,	i386reg_simd_mxcsr+4
+#else
 	.equ	i386reg_fpucontext_size,	i386reg_fpucontext_state+108
 #endif
+#endif
 
 #------------------------------------------------------------------------------
 # end of i386.inc
--- a/packages/hal/i386/arch/current/include/i386_stub.h
+++ b/packages/hal/i386/arch/current/include/i386_stub.h
@@ -25,7 +25,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -49,27 +49,135 @@
 //==========================================================================
 
 
-#define NUMREGS 				(16)
-#define REGSIZE(x)				(((x) < CS)? 4 : 2)
+#ifndef CYGHWR_HAL_I386_FPU
+#define NUMREGS     16
+#else
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+#define NUMREGS     41
+#else
+#define NUMREGS     32
+#endif
+#endif
 
+// Size of a given register.
+#define REGSIZE(X)  (((X) >= REG_FST0  && (X) <= REG_FST7) ? 10 :              \
+                    (((X) >= REG_MMX0  && (X) <= REG_MMX7) ? 10 :              \
+                    (((X) == REG_GDT || (X) == REG_IDT) ? 6 :                  \
+                    (((X) == REG_MSR || (X) == REG_LDT || (X) == REG_TR) ? 8 : \
+                    (((X) >= REG_XMM0  && (X) <= REG_XMM7) ? 16 : 4)))))
 
 enum regnames
-{	EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
-	PC /* also known as eip */,
-	PS /* also known as eflags */,
-	CS, SS, DS, ES, FS, GS
+{
+    // General regs (0 - 15)
+    EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
+    PC /* also known as eip */,
+    PS /* also known as eflags */,
+    CS, SS, DS, ES, FS, GS,
+
+    // FPU regs. (16 - 31)
+    REG_FST0, REG_FST1, REG_FST2, REG_FST3,
+    REG_FST4, REG_FST5, REG_FST6, REG_FST7,
+    REG_FCTRL, REG_FSTAT, REG_FTAG,
+    REG_FISEG, REG_FIOFF,
+    REG_FOSEG, REG_FOOFF,
+    REG_FOP,
+
+    // SSE regs (32 - 40)
+    REG_XMM0, REG_XMM1, REG_XMM2, REG_XMM3,
+    REG_XMM4, REG_XMM5, REG_XMM6, REG_XMM7,
+    REG_MXCSR,
+
+    // Registers below this point are _not_ part of the g/G packet
+    // so they play no part in defining NUMREGS. GDB accesses these
+    // individually with p/P packets.
+
+    // MMX regs (41 - 48)
+    // These are here as placeholders for register numbering purposes.
+    // GDB never asks for these directly as their values are stored
+    // in FSTn registers.
+    REG_MMX0, REG_MMX1, REG_MMX2, REG_MMX3,
+    REG_MMX4, REG_MMX5, REG_MMX6, REG_MMX7,
+
+    // Misc pentium regs (49 - 56)
+    REG_CR0, REG_CR2, REG_CR3, REG_CR4,
+    REG_GDT, REG_IDT, REG_LDT, REG_TR,
+
+    // Pseudo reg used by gdb to access other regs (57)
+    REG_MSR
 };
 
 typedef enum regnames regnames_t ;
 typedef unsigned long target_register_t ;
 
+typedef struct
+{
+    target_register_t eax;
+    target_register_t ecx;
+    target_register_t edx;
+    target_register_t ebx;
+    target_register_t esp;
+    target_register_t ebp;
+    target_register_t esi;
+    target_register_t edi;
+    target_register_t pc;
+    target_register_t ps;
+    target_register_t cs;
+    target_register_t ss;
+    target_register_t ds;
+    target_register_t es;
+    target_register_t fs;
+    target_register_t gs;
+#ifdef CYGHWR_HAL_I386_FPU
+    target_register_t fcw;
+    target_register_t fsw;
+    target_register_t ftw;
+    target_register_t ipoff;
+    target_register_t cssel;
+    target_register_t dataoff;
+    target_register_t opsel;
+    unsigned char     st0[10];
+    unsigned char     st1[10];
+    unsigned char     st2[10];
+    unsigned char     st3[10];
+    unsigned char     st4[10];
+    unsigned char     st5[10];
+    unsigned char     st6[10];
+    unsigned char     st7[10];
+#endif
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+    unsigned char     xmm0[16];
+    unsigned char     xmm1[16];
+    unsigned char     xmm2[16];
+    unsigned char     xmm3[16];
+    unsigned char     xmm4[16];
+    unsigned char     xmm5[16];
+    unsigned char     xmm6[16];
+    unsigned char     xmm7[16];
+    target_register_t mxcsr;
+#endif
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+    target_register_t cr0;
+    target_register_t cr2;
+    target_register_t cr3;
+    target_register_t cr4;
+
+    unsigned char     gdtr[6];
+    unsigned char     idtr[6];
+    target_register_t ldt;
+    target_register_t tr;
+#endif
+} GDB_SavedRegisters;
+
+#define HAL_STUB_REGISTERS_SIZE \
+ ((sizeof(GDB_SavedRegisters) + sizeof(target_register_t) - 1) / sizeof(target_register_t))
+
 #define PS_C			0x00000001
 #define PS_Z			0x00000040
 #define PS_V			0x00000080
 #define PS_T			0x00000100
 
-#define SP				(ESP)
-#define EIP				(PC)
+#define SP			(ESP)
+#define EIP			(PC)
 
 // We have to rewind the PC only in case of a breakpoint
 // set by a user interrupt (ie: a Ctrl-C)
@@ -84,6 +192,27 @@ typedef unsigned long target_register_t 
     CYG_MACRO_END
 #endif //CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
 
+// I386 stub has special needs for register handling, so special
+// put_register and get_register are provided.
+#define CYGARC_STUB_REGISTER_ACCESS_DEFINED 1
+
+// The x86 has float (and other) registers that are larger than it can
+// hold in a target_register_t.
+#define TARGET_HAS_LARGE_REGISTERS
+
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+// Handle arch-specific query packets.
+extern int cyg_hal_stub_process_query (char *p, char *b, int n);
+#define CYG_HAL_STUB_PROCESS_QUERY(__pkt__, __buf__, __bufsz__) \
+  cyg_hal_stub_process_query ((__pkt__), (__buf__), (__bufsz__))
+
+// These masks are used to protect the user from writing to reserved bits
+// of the control registers.
+#define REG_CR4_MASK    0x000007FF
+#define REG_CR3_MASK    0xFFFFF018
+#define REG_CR2_MASK    0xFFFFFFFF
+#define REG_CR0_MASK    0xE005003F
+#endif
 
 /* Find out what our last trap was. */
 extern int __get_trap_number(void) ;
--- a/packages/hal/i386/arch/current/src/i386_stub.c
+++ b/packages/hal/i386/arch/current/src/i386_stub.c
@@ -44,6 +44,20 @@
 #include <cyg/hal/dbg-threads-api.h>    // dbg_currthread_id
 #endif
 
+// We need a local memcpy so we don't rely on libc.
+static inline void*
+memcpy(void* dest, void* src, int size)
+{
+    unsigned char* __d = (unsigned char*) dest;
+    unsigned char* __s = (unsigned char*) src;
+    
+    while(size--)
+        *__d++ = *__s++;
+
+    return dest;
+}
+
+
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
 
 /* Given a trap value TRAP, return the corresponding signal. */
@@ -123,6 +137,337 @@ void set_pc (target_register_t pc)
     put_register (PC, pc);
 }
 
+static target_register_t
+reg_offset(regnames_t reg)
+{
+    switch(reg) {
+      case EAX ... GS:
+	return reg * 4;
+#ifdef CYGHWR_HAL_I386_FPU
+      case REG_FST0 ... REG_FST7:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->st0[0]
+	    + ((reg - REG_FST0) * 10);
+      case REG_FCTRL:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->fcw;
+      case REG_FSTAT:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->fsw;
+      case REG_FTAG:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->ftw;
+      case REG_FISEG:
+      case REG_FOP:
+	// REG_FISEG is lsw, REG_FOP is msw
+	return (target_register_t)&((GDB_SavedRegisters *)0)->cssel;
+      case REG_FIOFF:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->ipoff;
+      case REG_FOSEG:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->opsel;
+      case REG_FOOFF:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->dataoff;
+#endif
+#if 0  // GDB never asks for MMX regs directly, but it did...
+      case REG_MMX0 ... REG_MMX7:
+	  {
+	      target_register_t tos = (get_register (REG_FSTAT) >> 11) & 7;
+	      return reg_offset((((8 - tos) + reg - REG_MMX0) & 7) + REG_FST0);
+	  }
+#endif
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+      case REG_XMM0 ... REG_XMM7:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->xmm0[0]
+	    + ((reg - REG_XMM0) * 16);
+      case REG_MXCSR:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->mxcsr;
+#endif
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+      case REG_CR0 ... REG_CR4:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->cr0
+	    + ((reg - REG_CR0) * 4);
+      case REG_GDT:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->gdtr[0];
+      case REG_IDT:
+	return (target_register_t)&((GDB_SavedRegisters *)0)->idtr[0];
+#endif
+      default:
+	return -1;
+    }
+    return -1;
+}
+
+
+// Return the currently-saved value corresponding to register REG of
+// the exception context.
+target_register_t 
+get_register (regnames_t reg)
+{
+    target_register_t val;
+    target_register_t offset = reg_offset(reg);
+
+    if (REGSIZE(reg) > sizeof(target_register_t) || offset == -1)
+	return -1;
+
+    val = _registers[offset/sizeof(target_register_t)];
+
+#ifdef CYGHWR_HAL_I386_FPU
+    if (reg == REG_FISEG)
+        val &= 0xffff;
+    else if (reg == REG_FOP)
+        val = (val >> 16) & 0xffff;
+#endif
+
+    return val;
+}
+
+// Store VALUE in the register corresponding to WHICH in the exception
+// context.
+void 
+put_register (regnames_t which, target_register_t value)
+{
+    target_register_t index;
+    target_register_t offset = reg_offset(which);
+
+    if (REGSIZE(which) > sizeof(target_register_t) || offset == -1)
+	return;
+
+    index = offset / sizeof(target_register_t);
+
+    switch (which) {
+#ifdef CYGHWR_HAL_I386_FPU
+      case REG_FISEG:
+	value = (_registers[index] & 0xffff0000) | (value & 0xffff);
+	break;
+      case REG_FOP:
+	value = (_registers[index] & 0x0000ffff) | (value << 16);
+	break;
+#endif
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+      case REG_CR0:
+	value &= REG_CR0_MASK;
+	break;
+      case REG_CR2:
+	value &= REG_CR2_MASK;
+	break;
+      case REG_CR3:
+	value &= REG_CR3_MASK;
+	break;
+      case REG_CR4:
+	value &= REG_CR4_MASK;
+	break;
+#endif
+      default:
+	break;
+    }
+    _registers[index] = value;
+}
+
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+// Handle the Model Specific Registers
+static target_register_t _msrval[2];
+static int _which_msr = 0;
+
+static void
+__do_read_msr (void)
+{
+    asm volatile ("movl %2,%%ecx\n"
+		  "rdmsr\n"
+		  "movl %%edx,%1\n"
+		  "movl %%eax,%0\n"
+		  : "=m" (_msrval[0]), "=m" (_msrval[1])
+		  : "m" (_which_msr)
+		  : "ecx", "ebx", "edx", "eax", "memory");
+}
+
+static void
+__do_write_msr (void)
+{
+    asm volatile ("movl %1,%%edx\n"
+		  "movl %0,%%eax\n"
+		  "movl %2,%%ecx\n"
+		  "wrmsr\n"
+		  : /* no outputs */
+		  : "m" (_msrval[0]), "m" (_msrval[1]), "m" (_which_msr)
+		  : "ecx", "ebx", "edx", "eax", "memory");
+}
+
+static int
+rdmsr (int msrnum, target_register_t *msrval)
+{
+    _which_msr = msrnum;
+    __set_mem_fault_trap (__do_read_msr);
+    if (__mem_fault)
+	return 0;
+
+    msrval[0] = _msrval[0];
+    msrval[1] = _msrval[1];
+    return 1;
+}
+
+static int
+wrmsr (int msrnum, target_register_t *msrval)
+{
+    _which_msr = msrnum;
+    _msrval[0] = msrval[0];
+    _msrval[1] = msrval[1];
+
+    __set_mem_fault_trap (__do_write_msr);
+    if (__mem_fault)
+	return 0;
+
+    return 1;
+}
+
+int
+cyg_hal_stub_process_query (char *pkt, char *buf, int bufsize)
+{
+    unsigned long val1, val2, val3, val4;
+    int i = 0, max_input = 0;
+
+    if ('C' == pkt[0] &&
+	'P' == pkt[1] &&
+	'U' == pkt[2] &&
+	'I' == pkt[3] &&
+	'D' == pkt[4]) {
+
+	for (i = 0; i <= max_input; i++) {
+
+	    asm volatile ("movl %4,%%eax\n"
+			  "cpuid\n"
+			  "movl %%eax,%0\n"
+			  "movl %%ebx,%1\n"
+			  "movl %%ecx,%2\n"
+			  "movl %%edx,%3\n"
+			  : "=m" (val1), "=m" (val2), "=m" (val3), "=m" (val4)
+			  : "m" (i)
+			  : "eax", "ebx", "ecx", "edx", "memory");
+
+	    /*
+	     * get the max value to use to get all the CPUID info.
+	     */
+	    if (i == 0)
+		max_input = val1;
+
+	    /*
+	     * Swap the bytes around to handle endianness conversion:
+	     * ie 12345678 --> 78563412
+	     */
+	    val1 = (((val1 & 0x000000ff) << 24) | ((val1 & 0x0000ff00) <<  8) |
+		    ((val1 & 0x00ff0000) >>  8) | ((val1 & 0xff000000) >> 24));
+	    val2 = (((val2 & 0x000000ff) << 24) | ((val2 & 0x0000ff00) <<  8) |
+		    ((val2 & 0x00ff0000) >>  8) | ((val2 & 0xff000000) >> 24));
+	    val3 = (((val3 & 0x000000ff) << 24) | ((val3 & 0x0000ff00) <<  8) |
+		    ((val3 & 0x00ff0000) >>  8) | ((val3 & 0xff000000) >> 24));
+	    val4 = (((val4 & 0x000000ff) << 24) | ((val4 & 0x0000ff00) <<  8) |
+		    ((val4 & 0x00ff0000) >>  8) | ((val4 & 0xff000000) >> 24));
+
+	    /*
+	     * Generate the packet
+	     */
+	    __mem2hex ((char *)&val1, buf, 8, 0);  buf[8] = ',';  buf += 9;
+	    __mem2hex ((char *)&val2, buf, 8, 0);  buf[8] = ',';  buf += 9;
+	    __mem2hex ((char *)&val3, buf, 8, 0);  buf[8] = ',';  buf += 9;
+	    __mem2hex ((char *)&val4, buf, 8, 0);  buf[8] = ';';  buf += 9;
+        }
+
+	/*
+	 * The packet is complete.  buf points just past the final semicolon.
+	 * Remove that semicolon and properly terminate the packet.
+	 */
+	*(buf - 1) = '\0';
+
+	return 1;
+    }
+
+    if ('M' == pkt[0] &&
+	'S' == pkt[1] &&
+	'R' == pkt[2]) {
+
+	pkt += 4;
+	if (__hexToInt (&pkt, &val1)) {
+	    target_register_t msrval[2];
+
+	    // rdmsr implicitly sets _which_msr for subsequent REG_MSR read/write.
+	    if (rdmsr(val1, msrval))
+		__mem2hex ((char*)msrval, buf, 8, 0);
+	    else
+		memcpy (buf, "INVALID", 8);
+        }
+	return 1;
+    }
+
+    return 0;
+}
+#endif // CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+
+// Write the contents of register WHICH into VALUE as raw bytes. We
+// only support this for the MMX, FPU, and SSE registers.
+// Return true if it is a valid register.
+int
+get_register_as_bytes (regnames_t which, char *value)
+{
+    target_register_t offset;
+
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+    // Read the currently selected MSR
+    if (which == REG_MSR) {
+	if (rdmsr(_which_msr, _msrval)) {
+	    memcpy (value, _msrval, REGSIZE(which));
+	    return 1;
+	}
+	return 0;
+    }
+    // We can't actually read the LDT or TR in software, so just return invalid.
+    if (which == REG_LDT || which == REG_TR)
+	return 0;
+
+    if (which == REG_GDT || which == REG_IDT) {
+        // GDB requires these to be sent base first though the CPU stores them
+	// limit first in 6 bytes. Weird.
+        offset = reg_offset(which);
+        memcpy (value, (char *)_registers + offset + 2, 4);
+        memcpy (value + 4, (char *)_registers + offset, 2);
+        return 1;
+    }
+#endif
+
+    offset = reg_offset(which);
+    if (offset != -1) {
+	memcpy (value, (char *)_registers + offset, REGSIZE(which));
+	return 1;
+    }
+    return 0;
+}
+
+// Alter the contents of saved register WHICH to contain VALUE.  We only
+// support this for the MMX, FPU, and SSE registers.
+int
+put_register_as_bytes (regnames_t which, char *value)
+{
+    target_register_t offset;
+
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+    // Write the currently selected MSR
+    if (which == REG_MSR)
+	return wrmsr(_which_msr, (target_register_t*)value);
+
+    // We can't actually write the LDT OR TR in software, so just return invalid.
+    if (which == REG_LDT || which == REG_TR)
+	return 0;
+    if (which == REG_GDT || which == REG_IDT) {
+        // GDB sends these base first, though the CPU stores them
+	// limit first. Weird.
+        offset = reg_offset(which);
+        memcpy ((char *)_registers + offset + 2, value, 4);
+        memcpy ((char *)_registers + offset, value + 4, 2);
+        return 1;
+    }
+#endif
+
+    offset = reg_offset(which);
+    if (offset != -1) {
+	memcpy ((char *)_registers + offset, value, REGSIZE(which));
+	return 1;
+    }
+    return 0;
+}
 
 /*----------------------------------------------------------------------
  * Single-step support
@@ -184,34 +529,113 @@ void __skipinst (void)
 // We apparently need these function even when no stubinclude
 // for Thread Debug purposes
 
-void hal_get_gdb_registers(CYG_ADDRWORD * d, HAL_SavedRegisters * s)
+
+void hal_get_gdb_registers(CYG_ADDRWORD *dest, HAL_SavedRegisters * s)
 {
-	d[ESP] = s->esp ;
-	d[EBP] = s->ebp ;
-	d[ESI] = s->esi ;
-	d[EDI] = s->edi ;
-	d[EAX] = s->eax ;
-	d[EBX] = s->ebx ;
-	d[ECX] = s->ecx ;
-	d[EDX] = s->edx ;
-	d[PC]  = s->pc ;
-	d[CS]  = s->cs ;
-	d[PS]  = s->eflags ;
+    GDB_SavedRegisters *d = (GDB_SavedRegisters *)dest;
+
+    d->eax = s->eax;
+    d->ebx = s->ebx;
+    d->ecx = s->ecx;
+    d->edx = s->edx;
+    d->ebp = s->ebp;
+    d->esp = s->esp;
+    d->edi = s->edi;
+    d->esi = s->esi;
+    d->pc = s->pc;
+    d->cs = s->cs;
+    d->ps = s->eflags;
+
+    d->ss = 0;
+    asm volatile ("movw %%ss,%0\n" :"=m" (d->ss));
+    d->ds = 0;
+    asm volatile ("movw %%ds,%0\n" :"=m" (d->ds));
+    d->es = 0;
+    asm volatile ("movw %%es,%0\n" :"=m" (d->es));
+    d->fs = 0;
+    asm volatile ("movw %%fs,%0\n" :"=m" (d->fs));
+    d->gs = 0;
+    asm volatile ("movw %%gs,%0\n" :"=m" (d->gs));
+
+#ifdef CYGHWR_HAL_I386_FPU
+#ifdef CYGHWR_HAL_I386_FPU_SWITCH_LAZY
+    asm volatile ("fnop\n");  // force state save
+    memcpy(&d->fcw, &s->fpucontext->fpstate[0], sizeof(s->fpucontext->fpstate));
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+    memcpy(&d->xmm0[0], &s->fpucontext->xmm0[0], (16 * 8) + 4);
+#endif
+#else
+    memcpy(&d->fcw, &s->fpucontext.fpstate[0], sizeof(s->fpucontext.fpstate));
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+    memcpy(&d->xmm0[0], &s->fpucontext.xmm0[0], (16 * 8) + 4);
+#endif
+#endif
+#endif
+
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+    {
+	unsigned long val;
+
+	asm volatile ("movl %%cr0,%0\n"
+		      "movl %0,%1\n"
+		      : "=r" (val), "=m" (d->cr0));
+	asm volatile ("movl %%cr2,%0\n"
+		      "movl %0,%1\n"
+		      : "=r" (val), "=m" (d->cr2));
+	asm volatile ("movl %%cr3,%0\n"
+		      "movl %0,%1\n"
+		      : "=r" (val), "=m" (d->cr3));
+	asm volatile ("movl %%cr4,%0\n"
+		      "movl %0,%1\n"
+		      : "=r" (val), "=m" (d->cr4));
+	asm volatile ("sgdt %0\n" :"=m" (d->gdtr));
+	asm volatile ("sidt %0\n" :"=m" (d->idtr));
+    }
+#endif // CYGHWR_HAL_I386_PENTIUM_GDB_REGS
 }
 
-void hal_set_gdb_registers(HAL_SavedRegisters * d, CYG_ADDRWORD * s)
+void hal_set_gdb_registers(HAL_SavedRegisters * d, CYG_ADDRWORD * src)
 {
-	d->esp    = s[ESP] ;
-	d->ebp    = s[EBP] ;
-	d->eax    = s[EAX] ;
-	d->ebx    = s[EBX] ;
-	d->ecx    = s[ECX] ;
-	d->edx    = s[EDX] ;
-	d->esi    = s[ESI] ;
-	d->edi    = s[EDI] ;
-	d->pc     = s[PC] ;
-	d->cs     = s[CS] ;
-	d->eflags = s[PS] ;
+    GDB_SavedRegisters *s = (GDB_SavedRegisters *)src;
+
+    d->eax = s->eax;
+    d->ebx = s->ebx;
+    d->ecx = s->ecx;
+    d->edx = s->edx;
+    d->ebp = s->ebp;
+    d->esp = s->esp;
+    d->edi = s->edi;
+    d->esi = s->esi;
+    d->pc = s->pc;
+    d->cs = s->cs;
+    d->eflags = s->ps;
+#ifdef CYGHWR_HAL_I386_FPU
+#ifdef CYGHWR_HAL_I386_FPU_SWITCH_LAZY
+    memcpy(&d->fpucontext->fpstate[0], &s->fcw, sizeof(d->fpucontext->fpstate));
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+    memcpy(&d->fpucontext->xmm0[0], &s->xmm0[0], (16 * 8) + 4);
+#endif
+#else
+    memcpy(&d->fpucontext.fpstate[0], &s->fcw, sizeof(d->fpucontext.fpstate));
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+    memcpy(&d->fpucontext.xmm0[0], &s->xmm0[0], (16 * 8) + 4);
+#endif
+#endif
+#endif
+#ifdef CYGHWR_HAL_I386_PENTIUM_GDB_REGS
+    {
+	unsigned long val;
+
+	val = s->cr0;
+	asm volatile ("movl %0,%%cr0\n" : : "r" (val));
+	val = s->cr2;
+	asm volatile ("movl %0,%%cr2\n" : : "r" (val));
+	val = s->cr3;
+	asm volatile ("movl %0,%%cr3\n" : : "r" (val));
+	val = s->cr4;
+	asm volatile ("movl %0,%%cr4\n" : : "r" (val));
+    }
+#endif // CYGHWR_HAL_I386_PENTIUM_GDB_REGS
 }
 
 
deleted file mode 100644
--- a/packages/hal/i386/arch/current/src/romboot.S
+++ /dev/null
@@ -1,186 +0,0 @@
-##=============================================================================
-##
-##      romboot.S
-##
-##      x86 romboot
-##
-##=============================================================================
-#####COPYRIGHTBEGIN####
-#                                                                          
-# -------------------------------------------                              
-# The contents of this file are subject to the Red Hat eCos Public License 
-# Version 1.1 (the "License"); you may not use this file except in         
-# compliance with the License.  You may obtain a copy of the License at    
-# http://www.redhat.com/                                                   
-#                                                                          
-# Software distributed under the License is distributed on an "AS IS"      
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
-# License for the specific language governing rights and limitations under 
-# the License.                                                             
-#                                                                          
-# The Original Code is eCos - Embedded Configurable Operating System,      
-# released September 30, 1998.                                             
-#                                                                          
-# The Initial Developer of the Original Code is Red Hat.                   
-# Portions created by Red Hat are                                          
-# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
-# All Rights Reserved.                                                     
-# -------------------------------------------                              
-#                                                                          
-#####COPYRIGHTEND####
-##=============================================================================
-#######DESCRIPTIONBEGIN####
-##
-## Author(s):   jskov
-## Contributors:jskov
-## Date:        1999-01-07
-## Purpose:     x86 romboot
-## Description: When booting from ROM we need to run a short sequence of real
-##		mode code before jumping into 32 bit protected mode. There are
-##              problems in GAS with mixing all this code together, and it is
-##              easier to just move this bit of code out to a separate file.
-##              
-##
-######DESCRIPTIONEND####
-##
-##=============================================================================
-
-
-#include <pkgconf/system.h>
-#include <pkgconf/hal.h>
-
-#include <cyg/hal/arch.inc>
-
-#==============================================================================
-
-    .file   "romboot.S"
-
-#------------------------------------------------------------------------------
-
-	.code16
-
-romboot_start:			
-	/* Disable interrupt handling. */
-	cli
-
-	# Set DS == CS
-	movw	%cs,%ax
-	movw	%ax,%ds
-	# set ES == 0
-	movw	$0,%ax
-	movw	%ax,%es
-
-	# Call video bios to init display
-  	movw	$0xc000,%bx
-	movw  	%bx,%ds
-  	movw  	0x0000,%ax
-  	movw  	$0x0000,%bx
-  	movw  	%bx,%ds
-	cmpw  	$0xAA55,%ax
-  	jne  	1f
-	.byte	0x9a		# lcall
-	.word	0x0003		# offset
-	.word   0xc000		# segment
-1:
-	
-	movw	%cs,%ax
-	movw	%ax,%ds
-	# set ES == 0
-	movw	$0,%ax
-	movw	%ax,%es
-
-	# build a GDT descriptor in memory at location zero
-	movw	$(gdtEnd - gdtStart),%ax
-	movw	%ax,%es:0
-	lea	gdtStart,%ax
-	addw	$0xFF00,%ax
-	movw	%ax,%es:2
-	movw	$0x000F,%ax
-	movw	%ax,%es:4
-	
-	# load GDTR
-	lgdt	%es:0
-
-	# Switch to protected mode.
-	movl	%cr0,%eax
-	orb	$1, %al
-	movl	%eax,%cr0
-
-	# and do a jump to flush instruction prefetch
-	jmp	romboot_pm
-
-	hlt
-
-	.align	4, 0xCC
-gdtStart:
-	/* Selector 0x00 == invalid. */
-	.word	0x0000
-	.word	0x0000
-	.byte	0x00
-	.byte	0x00
-	.byte	0x00
-	.byte	0x00
-
-	/* Selector 0x08 == code. */
-	.word	0xFFFF
-	.word	0x0000
-	.byte	0x00
-	.byte	0x9B
-	.byte	0xCF
-	.byte	0x00
-
-	/* Selector 0x10 == data. */
-	.word	0xFFFF
-	.word	0x0000
-	.byte	0x00
-	.byte	0x93
-	.byte	0xCF
-	.byte	0x00
-
-	/* Selector 0x18 == shorter code: faults any code 
-         * access 0xF0000000-0xFFFFFFFF.
-         */
-	.word	0xFFFF
-	.word	0x0000
-	.byte	0x00
-	.byte	0x9B
-	.byte	0xC7
-	.byte	0x00
-
-	/* Selector 0x20 == data; faults any access 0xF0000000-0xFFFFFFFF. */
-	.word	0xFFFF
-	.word	0x0000
-	.byte	0x00
-	.byte	0x93
-	.byte	0xC7
-	.byte	0x00
-
-	.align	4, 0xCC
-gdtEnd:
-
-	# We arrive here in protected mode
-romboot_pm:	
-
-	# Load data selectors
-	movw	$0x10, %ax
-	movw	%ax, %ds
-	movw	%ax, %es
-	movw	%ax, %fs
-	movw	%ax, %gs
-	
-	# jump to start of ROM, where the PM code starts	
-#	ljmp	$8,$0xF0000
-	.byte	0x66,0xea	# opsize + ljmp opcode
-	.long	0x000F0000	# destination address
-	.word	0x0008		# code selector
-
-	.code16
-
-	.org	0xF0
-romboot_reset:		
-	jmp	romboot_start
-
-	.org	0x100
-	
-#------------------------------------------------------------------------------
-# end of romboot.S
deleted file mode 100644
--- a/packages/hal/i386/arch/current/src/romboot.ld
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-MEMORY
-{
-    rom : ORIGIN = 0x00000, LENGTH = 0x100
-}
-
-SECTIONS
-{
-	.text : { *(.text) *(.data) *(.bss) } > rom
-}
\ No newline at end of file
--- a/packages/hal/i386/arch/current/src/vectors.S
+++ b/packages/hal/i386/arch/current/src/vectors.S
@@ -240,7 +240,7 @@ 2:
 	pushl	36(%ebp)	# PC
 	mov	%ebp,%esp
 	popa
-	movl	-20(%esp),%esp	# popa doesn't restore %esp
+	movl	-20(%esp),%esp	# popa does not restore %esp
 	sub	$12,%esp	# adjust for EFLAGS, CS, and PC
 	iret	
 1:
@@ -466,15 +466,52 @@ cyg_hal_fpustate_current:
 	cmpl	$0,%eax				# is FPU even in use?
 	je	1f				# if not, skip save
 	fsave	i386reg_fpucontext_state(%eax)	# save FPU state
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# Save SIMD state.
+
+	# FIXME. This is awfully inefficient. Need to use FXSAVE to
+	# save FPU and SIMD at same time. FXSAVE requires a 16 byte
+	# alignment and does not have an implicit finit as does FSAVE.
+
+	stmxcsr	i386reg_simd_mxcsr(%eax)
+	movups	%xmm0,i386reg_simd_xmm0(%eax)
+	movups	%xmm1,i386reg_simd_xmm1(%eax)
+	movups	%xmm2,i386reg_simd_xmm2(%eax)
+	movups	%xmm3,i386reg_simd_xmm3(%eax)
+	movups	%xmm4,i386reg_simd_xmm4(%eax)
+	movups	%xmm5,i386reg_simd_xmm5(%eax)
+	movups	%xmm6,i386reg_simd_xmm6(%eax)
+	movups	%xmm7,i386reg_simd_xmm7(%eax)
+#endif
 	movl	$1,i386reg_fpucontext_valid(%eax) # mark valid
 1:
 	movl	%ebx,0(%esi)            	# Set new owner
 	btl	$0,i386reg_fpucontext_valid(%ebx) # Valid state?
 	jc	2f				# If yes, go to restore it
 	finit					# Otherwise init FPU
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# FIXME. Anything needed here?
+#endif
 	jmp	9f				# skip restore
 2:
 	frstor	i386reg_fpucontext_state(%ebx)	# restore FPU state
+#ifdef CYGHWR_HAL_I386_PENTIUM_SSE
+	# Restore SIMD state.
+
+	# FIXME. This is awfully inefficient. Need to use FXRSTOR to
+	# restore FPU and SIMD at same time. FXRSTOR requires a 16 byte
+	# alignment.
+
+	movups	i386reg_simd_xmm0(%ebx),%xmm0
+	movups	i386reg_simd_xmm1(%ebx),%xmm1
+	movups	i386reg_simd_xmm2(%ebx),%xmm2
+	movups	i386reg_simd_xmm3(%ebx),%xmm3
+	movups	i386reg_simd_xmm4(%ebx),%xmm4
+	movups	i386reg_simd_xmm5(%ebx),%xmm5
+	movups	i386reg_simd_xmm6(%ebx),%xmm6
+	movups	i386reg_simd_xmm7(%ebx),%xmm7
+	ldmxcsr	i386reg_simd_mxcsr(%ebx)
+#endif
 9:
 	popa					# restore all our registers.
 	addl	$4, %esp			# skip the vector number.
--- a/packages/hal/i386/pc/current/ChangeLog
+++ b/packages/hal/i386/pc/current/ChangeLog
@@ -1,3 +1,25 @@
+2001-10-16  Mark Salter  <msalter@redhat.com>
+
+	* misc/redboot_FLOPPY_D850GB.ecm: New file. RedBoot config for
+	Intel D850GB motherboard.
+
+	* src/hal_diag.c: Setup pc_ser_channels based on CDL.
+
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_i386_pc.cdl: Parent CYGBLD_BUILD_REDBOOT_BIN_ROM and
+	CYGBLD_BUILD_REDBOOT_BIN_FLOPPY under a CYGBLD_BUILD_REDBOOT_BIN_ROM
+	component for better cross-platform consistency.
+
+2001-10-08  Ian Campbell  <icampbell@arcom.co.uk>
+
+	* cdl/hal_i386_pc.cdl: CYGBLD_BUILD_I386_ROMBOOT and
+	CYGBLD_BUILD_REDBOOT_BIN_ROM moved here from hal_i386.cdl in the
+	arch package. Rename CYGBLD_BUILD_REDBOOT_BIN to
+	CYGBLD_BUILD_REDBOOT_BIN_FLOPPY for consistency.
+	* src/romboot.S: Moved from arch package.
+	* src/romboot.ld: Moved from arch package.
+
 2001-10-05  Mark Salter  <msalter@redhat.com>
 
 	* src/plf_stub.c (hal_pc_stubs_init): Install idt entry for GNUPro
--- a/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl
+++ b/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl
@@ -83,6 +83,26 @@ cdl_package CYGPKG_HAL_I386_PC {
             straight to a boot ROM/Flash). ROM startup is experimental
             at this time."
     }
+        
+    cdl_option CYGBLD_BUILD_I386_ROMBOOT {
+	display       "Build ROM bootstrap code"
+	calculated    { CYG_HAL_STARTUP == "ROM" }
+
+	make {
+	    <PREFIX>/lib/romboot.ld: <PACKAGE>/src/romboot.ld
+	    cp $< $@
+	}
+	
+	make {
+	    <PREFIX>/bin/romboot.elf : <PACKAGE>/src/romboot.S
+	    @sh -c "mkdir -p $(dir $@)"
+	    $(CC) -Wp,-MD,romboot.tmp $(INCLUDE_PATH) -nostdlib -Wl,-static -T$(PREFIX)/lib/romboot.ld -o $@ $<
+	    @echo $@ ": \\" > $(notdir $@).deps
+	    @tail +2 romboot.tmp >> $(notdir $@).deps
+	    @echo >> $(notdir $@).deps
+	    @rm romboot.tmp
+	}
+    }
 
     cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD {
         display       "Diagnostic serial port baud rate"
@@ -300,22 +320,49 @@ cdl_package CYGPKG_HAL_I386_PC {
             This option lists the target's requirements for a valid Redboot
             configuration."
     
-        cdl_option CYGBLD_BUILD_REDBOOT_BIN {
-            display       "Build Redboot ROM binary image"
-            active_if     CYGBLD_BUILD_REDBOOT
+        cdl_component CYGBLD_BUILD_REDBOOT_BIN {
+            display       "Build RedBoot binary image"
+            no_define
             default_value 1
-            no_define
-            description "This option enables the conversion of the Redboot ELF
-                         image to a binary image suitable for copying to a floppy
-	                 disk."
+
+            cdl_option CYGBLD_BUILD_REDBOOT_BIN_FLOPPY {
+                display       "Build Redboot FLOPPY binary image"
+                active_if     CYGBLD_BUILD_REDBOOT
+                active_if     { CYG_HAL_STARTUP == "FLOPPY" }
+                calculated    1
+                no_define
+                description "This option enables the conversion of the Redboot 
+                             ELF image to a binary image suitable for
+                             copying to a floppy disk."
+        
+                compile -library=libextras.a
+        
+                make -priority 325 {
+                    <PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
+                    $(OBJCOPY) -O binary $< $@
+                }
+            }
     
-            compile -library=libextras.a
-    
-            make -priority 325 {
-                <PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
-                $(OBJCOPY) -O binary $< $@
+            cdl_option CYGBLD_BUILD_REDBOOT_BIN_ROM {
+                display       "Build Redboot ROM binary image"
+                active_if     CYGBLD_BUILD_REDBOOT
+                active_if     { CYG_HAL_STARTUP == "ROM" }
+                calculated    1
+                no_define
+                description "This option enables the conversion of the Redboot
+                             ELF image to a binary image suitable for ROM
+                             programming."
+                
+                make -priority 325 {
+                    <PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
+                    $(OBJCOPY) -O binary $< $(@:.bin=.img)
+                    $(OBJCOPY) -O binary $(PREFIX)/bin/romboot.elf $(PREFIX)/bin/romboot.img
+                    dd if=/dev/zero of=$@ bs=1024 count=64 conv=sync
+                    dd if=$(@:.bin=.img) of=$@ bs=512 conv=notrunc,sync
+                    dd if=$(PREFIX)/bin/romboot.img of=$@ bs=256 count=1 seek=255 conv=notrunc
+                }
             }
-        }
-    }
-     
+        }            
+    }     
 }
+
new file mode 100644
--- /dev/null
+++ b/packages/hal/i386/pc/current/misc/redboot_FLOPPY_D850GB.ecm
@@ -0,0 +1,69 @@
+cdl_savefile_version 1;
+cdl_savefile_command cdl_savefile_version {};
+cdl_savefile_command cdl_savefile_command {};
+cdl_savefile_command cdl_configuration { description hardware template package };
+cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value };
+cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value };
+cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value };
+cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value };
+
+cdl_configuration eCos {
+#    package CYGPKG_IO_FLASH current ;
+    package CYGPKG_IO_ETH_DRIVERS current ;
+};
+
+cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT {
+    user_value 0
+};
+
+cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM {
+    user_value 0
+};
+
+cdl_option CYGSEM_HAL_ROM_MONITOR {
+    user_value 1
+};
+
+cdl_component CYG_HAL_STARTUP {
+    user_value FLOPPY
+};
+
+cdl_option CYGBLD_BUILD_REDBOOT {
+    user_value 1
+};
+
+cdl_option CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS {
+    user_value 0
+};
+
+#cdl_option CYGSEM_REDBOOT_FLASH_CONFIG {
+#    user_value 1
+#};
+#
+#cdl_option CYGBLD_REDBOOT_FLASH_BOOT_OFFSET {
+#  inferred_value 0x1C00000
+#};
+
+cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS {
+  user_value 1
+};
+
+cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS {
+    user_value 2
+};
+
+cdl_component CYGPKG_HAL_SMP_SUPPORT {
+    user_value 0
+};
+
+cdl_component CYGHWR_HAL_I386_PENTIUM {
+    user_value 1
+};
+
+cdl_option CYGHWR_HAL_I386_PENTIUM_SSE {
+    user_value 1
+};
+
+cdl_option CYGHWR_HAL_I386_PENTIUM_GDB_REGS {
+    user_value 1
+};
--- a/packages/hal/i386/pc/current/src/hal_diag.c
+++ b/packages/hal/i386/pc/current/src/hal_diag.c
@@ -23,7 +23,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -68,27 +68,44 @@
 #if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) \
     || defined(CYGPRI_HAL_IMPLEMENTS_IF_SERVICES)
 
-//FIXME: HardCode
-channel_data_t pc_ser_channels[3] = {
-    { 0x3F8, 1000, 36 },
-    { 0x2F8, 1000, 35 },
-    { 0x060, 1000, 33 }
-};
+channel_data_t pc_ser_channels[CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS];
 
 void
 cyg_hal_plf_comms_init(void)
 {
     static int initialized = 0;
+    int num_serial;
 
     if (initialized)
         return;
 
     initialized = 1;
 
+    num_serial = CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS;
+#ifdef CYGSEM_HAL_I386_PC_DIAG_SCREEN
+    --num_serial;
+#endif
+    if (num_serial > 0) {
+	// COM1
+	pc_ser_channels[0].base = 0x3F8;
+	pc_ser_channels[0].msec_timeout = 1000;
+	pc_ser_channels[0].isr_vector = 36;
+    }
+    if (num_serial > 1) {
+	// COM2
+	pc_ser_channels[1].base = 0x2F8;
+	pc_ser_channels[1].msec_timeout = 1000;
+	pc_ser_channels[1].isr_vector = 35;
+    }
+
     cyg_hal_plf_serial_init();
 
 #ifdef CYGSEM_HAL_I386_PC_DIAG_SCREEN
     
+    pc_ser_channels[num_serial].base = 0x060;
+    pc_ser_channels[num_serial].msec_timeout = 1000;
+    pc_ser_channels[num_serial].isr_vector = 33;
+
     cyg_hal_plf_screen_init();
 
 #endif    
new file mode 100644
--- /dev/null
+++ b/packages/hal/i386/pc/current/src/romboot.S
@@ -0,0 +1,186 @@
+##=============================================================================
+##
+##      romboot.S
+##
+##      x86 romboot
+##
+##=============================================================================
+#####COPYRIGHTBEGIN####
+#                                                                          
+# -------------------------------------------                              
+# The contents of this file are subject to the Red Hat eCos Public License 
+# Version 1.1 (the "License"); you may not use this file except in         
+# compliance with the License.  You may obtain a copy of the License at    
+# http://www.redhat.com/                                                   
+#                                                                          
+# Software distributed under the License is distributed on an "AS IS"      
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+# License for the specific language governing rights and limitations under 
+# the License.                                                             
+#                                                                          
+# The Original Code is eCos - Embedded Configurable Operating System,      
+# released September 30, 1998.                                             
+#                                                                          
+# The Initial Developer of the Original Code is Red Hat.                   
+# Portions created by Red Hat are                                          
+# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+# All Rights Reserved.                                                     
+# -------------------------------------------                              
+#                                                                          
+#####COPYRIGHTEND####
+##=============================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s):   jskov
+## Contributors:jskov
+## Date:        1999-01-07
+## Purpose:     x86 romboot
+## Description: When booting from ROM we need to run a short sequence of real
+##		mode code before jumping into 32 bit protected mode. There are
+##              problems in GAS with mixing all this code together, and it is
+##              easier to just move this bit of code out to a separate file.
+##              
+##
+######DESCRIPTIONEND####
+##
+##=============================================================================
+
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+
+#include <cyg/hal/arch.inc>
+
+#==============================================================================
+
+    .file   "romboot.S"
+
+#------------------------------------------------------------------------------
+
+	.code16
+
+romboot_start:			
+	/* Disable interrupt handling. */
+	cli
+
+	# Set DS == CS
+	movw	%cs,%ax
+	movw	%ax,%ds
+	# set ES == 0
+	movw	$0,%ax
+	movw	%ax,%es
+
+	# Call video bios to init display
+  	movw	$0xc000,%bx
+	movw  	%bx,%ds
+  	movw  	0x0000,%ax
+  	movw  	$0x0000,%bx
+  	movw  	%bx,%ds
+	cmpw  	$0xAA55,%ax
+  	jne  	1f
+	.byte	0x9a		# lcall
+	.word	0x0003		# offset
+	.word   0xc000		# segment
+1:
+	
+	movw	%cs,%ax
+	movw	%ax,%ds
+	# set ES == 0
+	movw	$0,%ax
+	movw	%ax,%es
+
+	# build a GDT descriptor in memory at location zero
+	movw	$(gdtEnd - gdtStart),%ax
+	movw	%ax,%es:0
+	lea	gdtStart,%ax
+	addw	$0xFF00,%ax
+	movw	%ax,%es:2
+	movw	$0x000F,%ax
+	movw	%ax,%es:4
+	
+	# load GDTR
+	lgdt	%es:0
+
+	# Switch to protected mode.
+	movl	%cr0,%eax
+	orb	$1, %al
+	movl	%eax,%cr0
+
+	# and do a jump to flush instruction prefetch
+	jmp	romboot_pm
+
+	hlt
+
+	.align	4, 0xCC
+gdtStart:
+	/* Selector 0x00 == invalid. */
+	.word	0x0000
+	.word	0x0000
+	.byte	0x00
+	.byte	0x00
+	.byte	0x00
+	.byte	0x00
+
+	/* Selector 0x08 == code. */
+	.word	0xFFFF
+	.word	0x0000
+	.byte	0x00
+	.byte	0x9B
+	.byte	0xCF
+	.byte	0x00
+
+	/* Selector 0x10 == data. */
+	.word	0xFFFF
+	.word	0x0000
+	.byte	0x00
+	.byte	0x93
+	.byte	0xCF
+	.byte	0x00
+
+	/* Selector 0x18 == shorter code: faults any code 
+         * access 0xF0000000-0xFFFFFFFF.
+         */
+	.word	0xFFFF
+	.word	0x0000
+	.byte	0x00
+	.byte	0x9B
+	.byte	0xC7
+	.byte	0x00
+
+	/* Selector 0x20 == data; faults any access 0xF0000000-0xFFFFFFFF. */
+	.word	0xFFFF
+	.word	0x0000
+	.byte	0x00
+	.byte	0x93
+	.byte	0xC7
+	.byte	0x00
+
+	.align	4, 0xCC
+gdtEnd:
+
+	# We arrive here in protected mode
+romboot_pm:	
+
+	# Load data selectors
+	movw	$0x10, %ax
+	movw	%ax, %ds
+	movw	%ax, %es
+	movw	%ax, %fs
+	movw	%ax, %gs
+	
+	# jump to start of ROM, where the PM code starts	
+#	ljmp	$8,$0xF0000
+	.byte	0x66,0xea	# opsize + ljmp opcode
+	.long	0x000F0000	# destination address
+	.word	0x0008		# code selector
+
+	.code16
+
+	.org	0xF0
+romboot_reset:		
+	jmp	romboot_start
+
+	.org	0x100
+	
+#------------------------------------------------------------------------------
+# end of romboot.S
new file mode 100644
--- /dev/null
+++ b/packages/hal/i386/pc/current/src/romboot.ld
@@ -0,0 +1,11 @@
+
+
+MEMORY
+{
+    rom : ORIGIN = 0x00000, LENGTH = 0x100
+}
+
+SECTIONS
+{
+	.text : { *(.text) *(.data) *(.bss) } > rom
+}
\ No newline at end of file
--- a/packages/hal/i386/pcmb/current/ChangeLog
+++ b/packages/hal/i386/pcmb/current/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-16  Mark Salter  <msalter@redhat.com>
+
+	* src/pcmb_serial.c (cyg_hal_plf_serial_init): Use CDL to determine
+	how many serial ports to support.
+	* src/pcmb_screen.c (cyg_hal_plf_screen_init): Use CDL to determine
+	channel number for keyboard/screen.
+
 2001-10-01  Ian Campbell  <icampbell@arcom.co.uk>
 
 	* include/pcmb_io.h: Include CYGBLD_HAL_PLATFORM_H rather than
--- a/packages/hal/i386/pcmb/current/src/pcmb_screen.c
+++ b/packages/hal/i386/pcmb/current/src/pcmb_screen.c
@@ -23,7 +23,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -57,6 +57,9 @@
 
 #include <cyg/hal/pcmb_serial.h>
 
+// Index into pc_ser_channels[] for screen entry.
+#define PCMB_PORT_INDEX (CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS - 1)
+
 //-----------------------------------------------------------------------------
 // Screen output definitions...
 
@@ -803,17 +806,17 @@ void cyg_hal_plf_screen_init(void)
     int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
 
     // Disable interrupts.
-    HAL_INTERRUPT_MASK(pc_ser_channels[2].isr_vector);
+    HAL_INTERRUPT_MASK(pc_ser_channels[PCMB_PORT_INDEX].isr_vector);
 
     // Init channels
-    cyg_hal_plf_screen_init_channel(&pc_ser_channels[2]);
+    cyg_hal_plf_screen_init_channel(&pc_ser_channels[PCMB_PORT_INDEX]);
 
     // Setup procs in the vector table
 
     // Set channel 2
-    CYGACC_CALL_IF_SET_CONSOLE_COMM(2);
+    CYGACC_CALL_IF_SET_CONSOLE_COMM(PCMB_PORT_INDEX);
     comm = CYGACC_CALL_IF_CONSOLE_PROCS();
-    CYGACC_COMM_IF_CH_DATA_SET(*comm, &pc_ser_channels[2]);
+    CYGACC_COMM_IF_CH_DATA_SET(*comm, &pc_ser_channels[PCMB_PORT_INDEX]);
     CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_screen_write);
     CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_screen_read);
     CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_screen_putc);
@@ -832,7 +835,7 @@ void cyg_hal_plf_screen_init(void)
 
 //-----------------------------------------------------------------------------
 
-#endif // CYGSEM_HAL_I386_PC_DIAG_SCREEN
+#endif // CYGINT_HAL_I386_PCMB_SCREEN_SUPPORT
 
 //-----------------------------------------------------------------------------
 // End of pcmb_screen.c
--- a/packages/hal/i386/pcmb/current/src/pcmb_serial.c
+++ b/packages/hal/i386/pcmb/current/src/pcmb_serial.c
@@ -23,7 +23,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -338,40 +338,33 @@ void cyg_hal_plf_serial_init(void)
 {
     hal_virtual_comm_table_t* comm;
     int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
+    int i, num_serial = CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS;
 
-    // Disable interrupts.
-    HAL_INTERRUPT_MASK(pc_ser_channels[0].isr_vector);
-    HAL_INTERRUPT_MASK(pc_ser_channels[1].isr_vector);
+#ifdef CYGSEM_HAL_I386_PC_DIAG_SCREEN
+    --num_serial;
+#endif
 
-    // Init channels
-    cyg_hal_plf_serial_init_channel(&pc_ser_channels[0]);
-    cyg_hal_plf_serial_init_channel(&pc_ser_channels[1]);
+    for (i = 0; i < num_serial; i++) {
+	// Disable interrupts.
+	HAL_INTERRUPT_MASK(pc_ser_channels[i].isr_vector);
 
-    // Setup procs in the vector table
+	// Init
+	cyg_hal_plf_serial_init_channel(&pc_ser_channels[i]);
 
-    // Set channel 0
-    CYGACC_CALL_IF_SET_CONSOLE_COMM(0);
-    comm = CYGACC_CALL_IF_CONSOLE_PROCS();
-    CYGACC_COMM_IF_CH_DATA_SET(*comm, &pc_ser_channels[0]);
-    CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
-    CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
-    CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
-    CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
-    CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
-    CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
-    CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
-    
-    CYGACC_CALL_IF_SET_CONSOLE_COMM(1);
-    comm = CYGACC_CALL_IF_CONSOLE_PROCS();
-    CYGACC_COMM_IF_CH_DATA_SET(*comm, &pc_ser_channels[1]);
-    CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
-    CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
-    CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
-    CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
-    CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
-    CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
-    CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
+	// Setup procs in the vector table
 
+	// Set channel 0
+	CYGACC_CALL_IF_SET_CONSOLE_COMM(i);
+	comm = CYGACC_CALL_IF_CONSOLE_PROCS();
+	CYGACC_COMM_IF_CH_DATA_SET(*comm, &pc_ser_channels[i]);
+	CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
+	CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
+	CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
+	CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
+	CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
+	CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
+	CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
+    }
     
     // Restore original console
     CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
--- a/packages/hal/mips/vr4300/current/ChangeLog
+++ b/packages/hal/mips/vr4300/current/ChangeLog
@@ -1,3 +1,11 @@
+2001-10-12  Nick Garnett  <nickg@redhat.com>
+
+	* src/mips_vr4300.ld (SECTION_rom_vectors): Updated this section
+	to make ROM startup work.
+	Note: this still does not fix all ROM startup problems, since the
+	ROM is still too slow to execute code from at anything like a
+	relistic speed.
+
 2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/hal_mips_vr4300.cdl: Define endianness in platform CDL instead.
--- a/packages/hal/mips/vr4300/current/src/mips_vr4300.ld
+++ b/packages/hal/mips/vr4300/current/src/mips_vr4300.ld
@@ -59,11 +59,15 @@ GROUP(libtarget.a libgcc.a)
 #elif defined(CYG_HAL_STARTUP_ROM)
 
 /* this version for ROM startup */
-#define SECTION_rom_vectors(_region_, _vma_, _lma_) \
-    .rom_vectors _vma_ : _lma_ \
-    { KEEP (*(.reset_vector)) \
-    . = ALIGN(0x100); KEEP (*(.utlb_vector)) \
-    . = ALIGN(0x80); KEEP(*(.other_vector)) \
+#define SECTION_rom_vectors(_region_, _vma_, _lma_)     \
+    .rom_vectors _vma_ : _lma_                          \
+    {                                                   \
+        KEEP (*(.reset_vector))                         \
+        . = ALIGN(0x200);                               \
+        KEEP (*(.utlb_vector))                          \
+        . = ALIGN(0x100);                               \
+        . = . + (0x80);                                 \
+        KEEP(*(.other_vector))                          \
     } > _region_
 
 #elif defined(CYG_HAL_STARTUP_ROMRAM)
--- a/packages/hal/mn10300/am31/current/ChangeLog
+++ b/packages/hal/mn10300/am31/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-15  Nick Garnett  <nickg@redhat.com>
+
+	* src/mn10300_am31.ld: Added test for __GNUC__ >= 3 so that
+	libsupc++.a can be included. Aparrently the mn10300 compiler is
+	now GCC3.
+
 2000-09-07  Nick Garnett  <nickg@cygnus.co.uk>
 
 	* include/variant.inc:
--- a/packages/hal/mn10300/am31/current/src/mn10300_am31.ld
+++ b/packages/hal/mn10300/am31/current/src/mn10300_am31.ld
@@ -35,7 +35,11 @@ ENTRY(reset_vector)
 #ifdef EXTRAS
 INPUT(extras.o)
 #endif
+#if (__GNUC__ >= 3)
+GROUP(libtarget.a libgcc.a libsupc++.a)
+#else
 GROUP(libtarget.a libgcc.a)
+#endif
 
 
 #define ALIGN_LMA 4
--- a/packages/hal/mn10300/am33/current/ChangeLog
+++ b/packages/hal/mn10300/am33/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-18  David Howells  <dhowells@redhat.com>
+
+	* include/variant.inc: Suppress as many interrupt sources as
+	possible whilst booting.
+
 2001-07-27  David Howells  <dhowells@redhat.com>
 
 	* cdl/hal_mn10300_am33.cdl: Added option for disabling caching
--- a/packages/hal/mn10300/am33/current/include/variant.inc
+++ b/packages/hal/mn10300/am33/current/include/variant.inc
@@ -72,6 +72,28 @@
 
 #define INIT_SDRAMCONFIG	0x0000002f
 
+#define SC0ICR			0xD4002004
+#define SC1ICR			0xD4002014
+#define SC2ICR			0xD4002024
+#define TM0MD			0xD4003000
+#define TM1MD			0xD4003001
+#define TM2MD			0xD4003002
+#define TM3MD			0xD4003003
+#define TM4MD			0xD4003080
+#define TM5MD			0xD4003082
+#define TM6MD			0xD4003084
+#define TM7MD			0xD4003086
+#define TM8MD			0xD4003088
+#define TM9MD			0xD400308A
+#define TM10MD			0xD400308C
+#define TM11MD			0xD400308E
+#define DM0CTR			0xD2000000
+#define DM1CTR			0xD2000100
+#define DM2CTR			0xD2000200
+#define DM3CTR			0xD2000300
+#define WDCTR			0xC0001002
+#define RTCRB			0xD860000B
+	
 #------------------------------------------------------------------------------
 # AM33 specific CPU initialization:
 
@@ -84,6 +106,44 @@
 	mov	reset_vector,a0		# set TBR to vector table
 	mov	a0,(TBR)
 #endif
+
+	# stop as many internal interrupt sources as possible
+	mov	0,d0
+	movhu	d0,(SC0ICR)
+	movhu	d0,(SC1ICR)
+	movhu	d0,(SC2ICR)
+	movbu	d0,(TM0MD)
+	movbu	d0,(TM1MD)
+	movbu	d0,(TM2MD)
+	movbu	d0,(TM3MD)
+	movbu	d0,(TM4MD)
+	movbu	d0,(TM5MD)
+	movhu	d0,(TM6MD)
+	movbu	d0,(TM7MD)
+	movbu	d0,(TM8MD)
+	movbu	d0,(TM9MD)
+	movbu	d0,(TM10MD)
+	movbu	d0,(TM11MD)
+	movhu	d0,(WDCTR)
+
+	movbu	(RTCRB),d0
+	and	0x8F,d0
+	movbu	d0,(RTCRB)
+
+	mov	0x80000000,d0
+	mov	d0,(DM0CTR)
+	mov	d0,(DM1CTR)
+	mov	d0,(DM2CTR)
+	mov	d0,(DM3CTR)
+	
+	# disable all interrupts
+	mov	_mn10300_interrupt_control,a0
+	mov	_mn10300_interrupt_control+(41*4),a1
+	mov	0x0010,d0
+1:	movhu	d0,(a0)
+	add	4,a0
+	cmp	a0,a1
+	bcc	1b
 	.endm
 
 #define CYGPKG_HAL_MN10300_CPU_INIT_DEFINED
@@ -249,8 +309,9 @@
 	hal_mon_init_vsr
 	.endm
 
-#if defined(CYG_HAL_STARTUP_ROM)
+#if defined(CYG_HAL_STARTUP_ROM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR)
 	.macro	hal_mon_init_vectors
+	# direct external interrupts
 	mov	_mn10300_interrupt_vectors,a0
 	mov	__hardware_vector_0,d0
 	movhu	d0,(0,a0)
--- a/packages/hal/mn10300/arch/current/ChangeLog
+++ b/packages/hal/mn10300/arch/current/ChangeLog
@@ -1,3 +1,21 @@
+2001-10-16  David Howells  <dhowells@redhat.com>
+
+	* src/hal_syscall.c: mustn't increment the return address by 4.
+
+2001-10-16  David Howells  <dhowells@redhat.com>
+
+	* src/vectors.S: conditionally call diagnostic macros on entry and
+	exit to default NMI handler and make inclusion of RedBoot header
+	file conditional.
+
+2001-10-15  David Howells  <dhowells@redhat.com>
+
+	* include/mn10300_stub.h: added syscall handling.
+	* src/hal_syscall.c: ditto
+	* src/mn10300_stub.c: ditto
+	* src/vectors.S: ditto
+	* cdl/hal_mn10300.cdl: added RTC configuration.
+
 2001-07-27  David Howells  <dhowells@redhat.com>
 
 	* include/mn10300_stub.h: set NUMREGS to be the correct value to
--- a/packages/hal/mn10300/arch/current/cdl/hal_mn10300.cdl
+++ b/packages/hal/mn10300/arch/current/cdl/hal_mn10300.cdl
@@ -67,7 +67,7 @@ cdl_package CYGPKG_HAL_MN10300 {
             control C handling."
     }
 
-    compile       hal_misc.c context.S mn10300_stub.c
+    compile       hal_misc.c hal_syscall.c context.S mn10300_stub.c
 
     make {
         <PREFIX>/lib/vectors.o : <PACKAGE>/src/vectors.S
--- a/packages/hal/mn10300/arch/current/include/mn10300_stub.h
+++ b/packages/hal/mn10300/arch/current/include/mn10300_stub.h
@@ -112,6 +112,10 @@ extern void __install_breakpoint_list (v
 
 extern void __clear_breakpoint_list (void);
 
+extern int __is_bsp_syscall(void);
+
+extern int hal_syscall_handler(void);
+
 #ifdef __cplusplus
 }   /* extern "C" */
 #endif
new file mode 100644
--- /dev/null
+++ b/packages/hal/mn10300/arch/current/src/hal_syscall.c
@@ -0,0 +1,102 @@
+//=============================================================================
+//
+//      hal_syscall.c
+//
+//      
+//
+//=============================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):   msalter
+// Contributors:msalter
+// Date:        2000-11-5
+// Purpose:     
+// Description: 
+//              
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+
+#ifdef CYGPKG_REDBOOT
+#include <pkgconf/redboot.h>
+#endif
+
+#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
+
+#include <cyg/hal/hal_stub.h>           // Our header
+#include <cyg/hal/hal_arch.h>           // HAL_BREAKINST
+#include <cyg/hal/hal_cache.h>          // HAL_xCACHE_x
+#include <cyg/hal/hal_intr.h>           // interrupt disable/restore
+
+#include <cyg/hal/hal_if.h>             // ROM calling interface
+#include <cyg/hal/hal_misc.h>           // Helper functions
+
+extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func,		// syscall function number
+			CYG_ADDRWORD arg1, CYG_ADDRWORD arg2,	// up to four args.
+			CYG_ADDRWORD arg3, CYG_ADDRWORD arg4,
+			CYG_ADDRWORD *retval);		// syscall return value
+
+#define	SYS_exit	1
+#define SYS_interrupt   1000
+
+int
+hal_syscall_handler(void)
+{
+    CYG_ADDRWORD func, arg1, arg2, arg3, arg4;
+    CYG_ADDRWORD err;
+
+    func = get_register(D0);
+    arg1 = get_register(D1);
+    arg2 = get_register(D2);
+    arg3 = get_register(D3);
+    arg4 = 0;
+ 
+    if (func == SYS_exit) {
+	// We want to stop in exit so that the user may poke around
+	//  to see why his app exited.
+        return SIGTRAP;
+    }
+
+    if (func == SYS_interrupt) {
+	//  A console interrupt landed us here.
+	//  Invoke the debug agent so as to cause a SIGINT.
+        return SIGINT;
+    }
+
+    if (__do_syscall(func, arg1, arg2, arg3, arg4, &err)) {
+        put_register(D0, err);
+	return 0;
+    }
+
+    return SIGTRAP;
+}
+
+#endif // CYGSEM_REDBOOT_BSP_SYSCALLS
--- a/packages/hal/mn10300/arch/current/src/mn10300_stub.c
+++ b/packages/hal/mn10300/arch/current/src/mn10300_stub.c
@@ -46,6 +46,10 @@
 
 #include <pkgconf/hal.h>
 
+#ifdef CYGPKG_REDBOOT
+#include <pkgconf/redboot.h>
+#endif
+
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
 
 #include <cyg/hal/hal_stub.h>
@@ -119,6 +123,13 @@ int __get_trap_number (void)
     return _hal_registers->vector;
 }
 
+#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
+int __is_bsp_syscall(void) 
+{
+    return __get_trap_number() == SIGSYS;
+}
+#endif
+
 /*--------------------------------------------------------------------*/
 /* Set the currently-saved pc register value to PC. This also updates NPC
    as needed. */
--- a/packages/hal/mn10300/arch/current/src/vectors.S
+++ b/packages/hal/mn10300/arch/current/src/vectors.S
@@ -46,6 +46,10 @@
 
 #include <pkgconf/hal.h>
 
+#ifdef CYGPKG_REDBOOT
+#include <pkgconf/redboot.h>
+#endif
+	
 #ifdef CYGPKG_KERNEL
 
 #include <pkgconf/kernel.h>
@@ -580,7 +584,9 @@ 2:
 	# We come here with all the registers saved
 	# on the stack.
 
+#ifdef CYG_HAL_DIAG_EXCPT_END
 	hal_diag_excpt_start
+#endif
 	
 	# Decode the cause of the NMI and cancel all the bits in all
 	# the registers. We need to clear any bits set in the ISR and
@@ -611,7 +617,7 @@ 2:
 
 	add	9,d1				# offset into exception number space
 	
-#ifdef CYGPKG_CYGMON
+#if defined(CYGPKG_CYGMON) || defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
 	# Check to see if this was a syscall.
 	# If so, set d1 appropriately
 #define TBR 0xC0000024
@@ -640,6 +646,10 @@ 0:
 
 	add	16,sp				# pop args
 
+#ifdef CYG_HAL_DIAG_EXCPT_END
+	hal_diag_excpt_end
+#endif
+
 	hal_cpu_load_all
 
 #ifdef CYGPKG_CYGMON
@@ -686,19 +696,31 @@ sp_save:
 	.globl	__default_trap_vsr
 __default_trap_vsr:
 
+#ifdef CYG_HAL_DIAG_EXCPT_END
+	hal_diag_excpt_start
+#endif
+
 	# We come here with all the registers saved
 	# on the stack.
+	mov	8,d1
+	mov	d1,(sp)				# set the VSR vector number
+	mov	sp,a1				# a1 = saved state
+	mov	a1,d0				# d0 = arg1 = saved state
 
-	add	-8,sp				# return link + arg
-	mov	3,d1				# 3 == TRAP trap
-	mov	d1,(0,sp)			# save in spare save slot
+	add	-16,sp				# return link + arg
+	mov	3,d1				# d1 = arg2 = ISR value (3 == TRAP trap)
 	calls	_cyg_hal_exception_handler	# call C code
-	add	8,sp				# pop args
+	add	16,sp				# pop args
+
+#ifdef CYG_HAL_DIAG_EXCPT_END
+	hal_diag_excpt_end
+#endif
 	hal_cpu_load_all
 #ifdef CYGPKG_CYGMON
 	hal_cygmon_restore_app_stack
+	add	4,sp
 #else
-	add	4,sp
+	add	8,sp
 #endif
 	rets
 
--- a/packages/hal/sh/arch/current/ChangeLog
+++ b/packages/hal/sh/arch/current/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-15  David Howells  <dhowells@redhat.com>
+
+	* cdl/hal_sh.cdl: improved the description on the RTC constants
+	component.
+
+2001-10-11  Jesper Skov  <jskov@redhat.com>
+
+	* src/hal_mk_defs.c (main): Fixed warning.
+
 2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/sh.ld: Make separate section for GOT and .eh_frame.
--- a/packages/hal/sh/arch/current/cdl/hal_sh.cdl
+++ b/packages/hal/sh/arch/current/cdl/hal_sh.cdl
@@ -147,7 +147,13 @@ cdl_package CYGPKG_HAL_SH {
     cdl_component CYGNUM_HAL_RTC_CONSTANTS {
         display       "Real-time clock constants."
         description   "
-            The HAL uses TMU counter 0 for driving the real-time
+            The NUMERATOR divided by the DENOMINATOR gives the number of
+            nanoseconds per tick. The PERIOD is the divider to be programmed
+            into a hardware timer that is driven from an appropriate hardware
+            clock, such that the timer overflows once per tick (normally
+            generating a CPU interrupt to mark the end of a tick). The tick
+            rate is typically 100Hz.
+            The SH HAL uses TMU counter 0 for driving the real-time
             clock."
         flavor        none
     
--- a/packages/hal/sh/arch/current/src/hal_mk_defs.c
+++ b/packages/hal/sh/arch/current/src/hal_mk_defs.c
@@ -103,6 +103,8 @@ main(void)
     DEFINE(CYGNUM_HAL_VSR_MAX, CYGNUM_HAL_VSR_MAX);
     DEFINE(CYGNUM_HAL_VSR_COUNT, CYGNUM_HAL_VSR_COUNT);
     DEFINE(CYGNUM_HAL_VSR_EXCEPTION_COUNT, CYGNUM_HAL_VSR_EXCEPTION_COUNT);
+
+    return 0;
 }
 
 //--------------------------------------------------------------------------
--- a/packages/hal/sh/sh3/current/ChangeLog
+++ b/packages/hal/sh/sh3/current/ChangeLog
@@ -1,3 +1,14 @@
+2001-10-15  Jesper Skov  <jskov@redhat.com>
+
+	* include/mod_7709r.h: Added. I don't know if the module content
+	is correct as I have no docs for the CPU.
+
+	* cdl/hal_sh_sh3.cdl: Added option for 7709r. 
+
+2001-10-11  Jesper Skov  <jskov@redhat.com>
+
+	* src/var_mk_defs.c (main): Fixed warning.
+
 2001-09-25  Jesper Skov  <jskov@redhat.com>
 
 	* include/var_intr.h: Default CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF
--- a/packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl
+++ b/packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl
@@ -128,6 +128,24 @@ cdl_package CYGPKG_HAL_SH_SH3 {
         }
     }
 
+    cdl_option CYGPKG_HAL_SH_7709R {
+        display       "SH 7709R microprocessor"
+        parent        CYGPKG_HAL_SH_CPU
+        implements    CYGINT_HAL_SH_VARIANT
+        implements    CYGINT_HAL_SH_CPG_T3
+        default_value 0
+        no_define
+        define        -file=system.h CYGPKG_HAL_SH_7709R
+        description "
+            The SH3 7709R microprocessor. This is an embedded part that in
+            addition to the SH3 processor core has built in peripherals
+            such as memory controllers, DMA controllers, A/D and D/A
+            converters, serial ports and timers/counters."               
+        define_proc {
+            puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H <cyg/hal/mod_7709r.h>"
+        }
+    }
+
     cdl_option CYGPKG_HAL_SH_7709S {
         display       "SH 7709S microprocessor"
         parent        CYGPKG_HAL_SH_CPU
new file mode 100644
--- /dev/null
+++ b/packages/hal/sh/sh3/current/include/mod_7709r.h
@@ -0,0 +1,83 @@
+#ifndef CYGONCE_HAL_MOD_77xx_H
+#define CYGONCE_HAL_MOD_77xx_H
+
+//=============================================================================
+//
+//      mod_7709r.h
+//
+//      List modules available on CPU
+//
+//=============================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):   jskov
+// Contributors:jskov
+// Date:        2001-10-15
+// Purpose:     Define modules (and versions) available on this CPU.
+// Usage:       Included from <cyg/hal/sh_regs.h>
+// Note:        This is guesswork. No documentation.
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Modules provided by the CPU
+
+#define CYGARC_SH_MOD_BCN  2
+#define CYGARC_SH_MOD_CPG  3
+#define CYGARC_SH_MOD_DMAC 1
+#define CYGARC_SH_MOD_INTC 2
+#define CYGARC_SH_MOD_IRDA 1
+#define CYGARC_SH_MOD_PFC  1
+#define CYGARC_SH_MOD_SCI  1
+#define CYGARC_SH_MOD_SCIF 1
+
+//-----------------------------------------------------------------------------
+// Extra details for Cache Module (CAC)
+
+// Cache dimenions - one unified cache
+#define CYGARC_SH_MOD_CAC_SIZE        16384 // Size of cache in bytes
+#define CYGARC_SH_MOD_CAC_LINE_SIZE   16    // Size of a cache line
+#define CYGARC_SH_MOD_CAC_WAYS        4     // Associativity of the cache
+
+// Cache addressing information
+// way:   bits 13 - 12
+// entry: bits 11 -  4
+#define CYGARC_SH_MOD_CAC_ADDRESS_BASE   0xf0000000
+#define CYGARC_SH_MOD_CAC_ADDRESS_TOP    0xf0004000
+#define CYGARC_SH_MOD_CAC_ADDRESS_STEP   0x00000010
+// U : bit 1
+// V : bit 0
+// Writing zero to both forces a flush of the line if it is dirty.
+#define CYGARC_SH_MOD_CAC_ADDRESS_FLUSH  0x00000000
+
+//-----------------------------------------------------------------------------
+// Extra details for interrupt handling
+#define CYGARC_SH_SOFTWARE_IP_UPDATE
+
+#endif // CYGONCE_HAL_MOD_77xx_H
--- a/packages/hal/sh/sh3/current/src/var_mk_defs.c
+++ b/packages/hal/sh/sh3/current/src/var_mk_defs.c
@@ -82,6 +82,8 @@ main(void)
     DEFINE(CYGNUM_HAL_ISR_MAX, CYGNUM_HAL_ISR_MAX);
     DEFINE(CYGNUM_HAL_INTERRUPT_RESERVED_3E0, CYGNUM_HAL_INTERRUPT_RESERVED_3E0);
 
+
+    return 0;
 }
 
 //--------------------------------------------------------------------------
--- a/packages/hal/sh/sh4/current/ChangeLog
+++ b/packages/hal/sh/sh4/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-17  Jesper Skov  <jskov@redhat.com>
+
+	* include/mod_regs_ubc.h (CYGARC_REG_BRCR_ONE_STEP): Added.
+
 2001-09-25  Jesper Skov  <jskov@redhat.com>
 
 	* include/var_intr.h: Default CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF
--- a/packages/hal/sh/sh4/current/include/mod_regs_ubc.h
+++ b/packages/hal/sh/sh4/current/include/mod_regs_ubc.h
@@ -61,6 +61,7 @@
 #define CYGARC_REG_BRCR_PCBB            0x0040 // post execute channel B
 #define CYGARC_REG_BRCR_SEQ             0x0008 // sequence condition select
 #define CYGARC_REG_BRCR_UBDE            0x0001 // User Break Debug Enable
+#define CYGARC_REG_BRCR_ONE_STEP        (CYGARC_REG_BRCR_PCBA)
 
 #if defined(CYGARC_SH_MOD_UBC) && (CYGARC_SH_MOD_UBC == 1)
 #define CYGARC_REG_BAMRA_BASMA          0x04   // BASRA masked
--- a/packages/io/eth/current/ChangeLog
+++ b/packages/io/eth/current/ChangeLog
@@ -1,3 +1,22 @@
+2001-10-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/eth_drivers.cdl: Rename CYGSEM_IO_ETH_DRIVERS_DEBUG to
+	CYGDBG_IO_ETH_DRIVERS_DEBUG and make it a common option.
+	Add separate CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY config.
+
+	* include/eth_drv.h: Don't claim BSD if it isn't.
+	* include/eth_drv_stats.h: Ditto.
+	* include/netdev.h: Ditto.
+	* src/net/eth_drv.c: Ditto.
+	Also use above CDL options to conditionalize debugging (and the
+	verbosity level).
+	* src/stand_alone/eth_drv.c: Use above renamed CDL options.
+
+2001-10-11  Gary Thomas  <gthomas@redhat.com>
+
+	* src/stand_alone/eth_drv.c (eth_drv_recv): 
+	Defensive programming - insure valid packet size.
+
 2001-10-05  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/net/eth_drv.c: Add default implementation of min().
--- a/packages/io/eth/current/cdl/eth_drivers.cdl
+++ b/packages/io/eth/current/cdl/eth_drivers.cdl
@@ -50,6 +50,29 @@ cdl_package CYGPKG_IO_ETH_DRIVERS {
 
     implements    CYGPKG_NET_DRIVER_FRAMEWORK
 
+
+    cdl_component CYGDBG_IO_ETH_DRIVERS_DEBUG {
+        display          "Support printing driver debug information"
+        flavor           bool
+        default_value    1
+        description      "
+           Selecting this option will include code to allow the driver to
+           print lots of information on diagnostic output such as full
+           packet dumps."
+
+        cdl_option    CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY {
+            display       "Driver debug output verbosity"
+            flavor        data
+            default_value 0
+            description   "
+                The value of this option indicates the default verbosity
+                level of debugging output. 0 means no debugging output
+                is made by default. Higher values indicate higher verbosity.
+                The verbosity level may also be changed at run time by
+                changing the variable cyg_io_eth_net_debug."
+        }
+    }
+
     cdl_component CYGPKG_IO_ETH_DRIVERS_NET {
         display       "Support for standard eCos TCP/IP stack."
         flavor        bool
@@ -155,17 +178,6 @@ cdl_package CYGPKG_IO_ETH_DRIVERS {
                to display warnings on the system console when incoming network
                packets are being discarded due to lack of buffer space."
         }
-
-        cdl_option CYGSEM_IO_ETH_DRIVERS_DEBUG {
-            display          "Print driver debug information"
-            active_if        CYGPKG_REDBOOT
-            flavor           booldata
-            default_value    { 0 != CYGPKG_REDBOOT ? 1 : 0}
-            description      "
-               Selecting this option will enable the stand-alone driver to print
-               lots of information.  Useful only when getting a low-level hardware
-               driver to work."
-        }
     }
 
     cdl_component CYGPKG_IO_ETH_DRIVERS_OPTIONS {
--- a/packages/io/eth/current/include/eth_drv.h
+++ b/packages/io/eth/current/include/eth_drv.h
@@ -28,16 +28,6 @@
 // -------------------------------------------                              
 //                                                                          
 //####COPYRIGHTEND####
-//####BSDCOPYRIGHTBEGIN####
-//
-// -------------------------------------------
-//
-// Portions of this software may have been derived from OpenBSD or other sources,
-// and are covered by the appropriate copyright disclaimers included herein.
-//
-// -------------------------------------------
-//
-//####BSDCOPYRIGHTEND####
 //==========================================================================
 //#####DESCRIPTIONBEGIN####
 //
--- a/packages/io/eth/current/include/eth_drv_stats.h
+++ b/packages/io/eth/current/include/eth_drv_stats.h
@@ -30,16 +30,6 @@
 // -------------------------------------------                              
 //                                                                          
 //####COPYRIGHTEND####
-//####BSDCOPYRIGHTBEGIN####
-//
-// -------------------------------------------
-//
-// Portions of this software may have been derived from OpenBSD or other sources,
-// and are covered by the appropriate copyright disclaimers included herein.
-//
-// -------------------------------------------
-//
-//####BSDCOPYRIGHTEND####
 //==========================================================================
 //#####DESCRIPTIONBEGIN####
 //
--- a/packages/io/eth/current/include/netdev.h
+++ b/packages/io/eth/current/include/netdev.h
@@ -30,16 +30,6 @@
 // -------------------------------------------                              
 //                                                                          
 //####COPYRIGHTEND####
-//####BSDCOPYRIGHTBEGIN####
-//
-// -------------------------------------------
-//
-// Portions of this software may have been derived from OpenBSD or other sources,
-// and are covered by the appropriate copyright disclaimers included herein.
-//
-// -------------------------------------------
-//
-//####BSDCOPYRIGHTEND####
 //==========================================================================
 //#####DESCRIPTIONBEGIN####
 //
--- a/packages/io/eth/current/src/net/eth_drv.c
+++ b/packages/io/eth/current/src/net/eth_drv.c
@@ -28,16 +28,6 @@
 // -------------------------------------------                              
 //                                                                          
 //####COPYRIGHTEND####
-//####BSDCOPYRIGHTBEGIN####
-//
-// -------------------------------------------
-//
-// Portions of this software may have been derived from OpenBSD or other sources,
-// and are covered by the appropriate copyright disclaimers included herein.
-//
-// -------------------------------------------
-//
-//####BSDCOPYRIGHTEND####
 //==========================================================================
 //#####DESCRIPTIONBEGIN####
 //
@@ -278,7 +268,9 @@ simulate_fail_corrupt_sglist( struct eth
 static int  eth_drv_ioctl(struct ifnet *, u_long, caddr_t);
 static void eth_drv_send(struct ifnet *);
 
-extern int net_debug;  // FIXME
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG 
+int cyg_io_eth_net_debug = CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY;
+#endif
 
 // Interfaces exported to drivers
 
@@ -536,8 +528,10 @@ eth_drv_send(struct ifnet *ifp)
         }
 #endif
 
-        if (net_debug)
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+        if (cyg_io_eth_net_debug)
             diag_printf("Sending %d bytes\n", m0->m_pkthdr.len);
+#endif
 
         /* We need to use m->m_pkthdr.len, so require the header */
         if ((m0->m_flags & M_PKTHDR) == 0)
@@ -559,11 +553,13 @@ eth_drv_send(struct ifnet *ifp)
             sg_list[sg_len].len = len;
             if ( len )
                 sg_len++;
-            if (net_debug) {
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+            if (cyg_io_eth_net_debug) {
                 diag_printf("xmit %d bytes at %x sg[%d]\n", len, data, sg_len);
-                if ( 1 & net_debug )
+                if ( cyg_io_eth_net_debug > 1)
                     diag_dump_buf(data, len);
             }
+#endif
             if ( MAX_ETH_DRV_SG < sg_len ) {
                 diag_printf("too many mbufs to tx, %d > %d\n", sg_len, MAX_ETH_DRV_SG );
                 sg_len = 0;
@@ -764,16 +760,17 @@ eth_drv_recv(struct eth_drv_sc *sc, int 
     }
 #endif
 
-    if (net_debug) {
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+    if (cyg_io_eth_net_debug) {
         for (i = 0;  i < sg_len;  i++) {
             if (sg_list[i].buf) {
                 diag_printf("rx %d bytes at %x sg[%d]\n", sg_list[i].len, sg_list[i].buf, i);
-                if ( 1 & net_debug )
+                if ( cyg_io_eth_net_debug > 1 )
                     diag_dump_buf((void *)sg_list[i].buf, sg_list[i].len);
             }
         }
     }
-
+#endif
     m = top;
     if (m == 0) {
         ifp->if_ierrors++;
--- a/packages/io/eth/current/src/stand_alone/eth_drv.c
+++ b/packages/io/eth/current/src/stand_alone/eth_drv.c
@@ -66,7 +66,9 @@ static void eth_drv_tx_done(struct eth_d
 
 struct eth_drv_funs eth_drv_funs = {eth_drv_init, eth_drv_recv, eth_drv_tx_done};
 
-int net_debug;  // FIXME
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+int cyg_io_eth_net_debug = CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY;
+#endif
 
 unsigned char      __local_enet_addr[ETHER_ADDR_LEN+2];
 struct eth_drv_sc *__local_enet_sc;
@@ -246,8 +248,8 @@ eth_drv_write(char *eth_hdr, char *buf, 
     sg_list[1].buf = (CYG_ADDRESS)buf;
     sg_list[1].len = len;
     packet_sent = 0;
-#ifdef CYGSEM_IO_ETH_DRIVERS_DEBUG
-    if (net_debug) {
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+    if (cyg_io_eth_net_debug) {
         int old_console;
         old_console = start_console();
         diag_printf("Ethernet send:\n");
@@ -296,9 +298,10 @@ eth_drv_tx_done(struct eth_drv_sc *sc, C
     } else {
         // It's possible that this acknowledgement is for a different
         // [logical] driver.  Try and pass it on.
-#if defined(CYGSEM_IO_ETH_DRIVERS_DEBUG) && (CYGSEM_IO_ETH_DRIVERS_DEBUG>=2)
+#if defined(CYGDBG_IO_ETH_DRIVERS_DEBUG) && \
+           (CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY >=2 )
         // Note: not normally enabled - too verbose
-        if (net_debug) {
+        if (cyg_io_eth_net_debug > 1) {
             int old_console;
             old_console = start_console();
             diag_printf("tx_done for other key: %x\n", key);
@@ -402,6 +405,15 @@ eth_drv_recv(struct eth_drv_sc *sc, int 
     unsigned char *buf;
     CYGARC_HAL_SAVE_GP();
 
+    if ((total_len > MAX_ETH_MSG) || (total_len < 0)) {        
+#ifdef CYGSEM_IO_ETH_DRIVERS_WARN
+        int old_console;
+        old_console = start_console();
+        diag_printf("%s: packet of %d bytes truncated\n", __FUNCTION__, total_len);
+        end_console(old_console);
+#endif
+        total_len = MAX_ETH_MSG;
+    }
     msg = eth_drv_msg_get(&eth_msg_free);
     if (msg) {
         buf = msg->data;
@@ -419,8 +431,8 @@ eth_drv_recv(struct eth_drv_sc *sc, int 
     sg_len = 1;
 
     (sc->funs->recv)(sc, sg_list, sg_len);
-#ifdef CYGSEM_IO_ETH_DRIVERS_DEBUG
-    if (net_debug) {
+#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+    if (cyg_io_eth_net_debug) {
         int old_console;
         old_console = start_console();
         diag_printf("Ethernet recv:\n");
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,16 @@
+2001-10-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/fio.h: Make cancellation point dependand on
+	CYGINT_ISO_PTHREAD_IMPL from <pkgconf/isoinfra.h> really.
+	* tests/select.c: Ditto.
+
+2001-10-09  Jesper Skov  <jskov@redhat.com>
+
+	* tests/select.c: Do NA check for posix threads.
+
+	* src/fio.h: Make cancellation point dependant on
+	CYGPKG_POSIX_PTHREAD as in the POSIX package.
+
 2001-07-26  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/fileio.cdl: Implements select().
--- a/packages/io/fileio/current/src/fio.h
+++ b/packages/io/fileio/current/src/fio.h
@@ -52,6 +52,7 @@
 #include <pkgconf/hal.h>
 #include <pkgconf/kernel.h>
 #include <pkgconf/io_fileio.h>
+#include <pkgconf/isoinfra.h>
 
 #include <cyg/infra/cyg_type.h>
 
@@ -129,15 +130,15 @@ CYG_MACRO_END
 // in the routines that are defined to contain them.
 // The macro CYG_CANCELLATION_POINT does this.
 
-#ifdef CYGPKG_POSIX
+#ifdef CYGINT_ISO_PTHREAD_IMPL
 
-#include <pthread.h>
+# include <pthread.h>
 
-#define CYG_CANCELLATION_POINT pthread_testcancel()
+# define CYG_CANCELLATION_POINT pthread_testcancel()
 
 #else
 
-#define CYG_CANCELLATION_POINT CYG_EMPTY_STATEMENT
+# define CYG_CANCELLATION_POINT CYG_EMPTY_STATEMENT
 
 #endif
 
--- a/packages/io/fileio/current/src/misc.cxx
+++ b/packages/io/fileio/current/src/misc.cxx
@@ -404,7 +404,7 @@ void cyg_fs_unlock( cyg_mtab_entry *mte,
     
     return (time_t) Cyg_WallClock::wallclock->get_current_time();
 
-#elif CYGINT_ISO_POSIX_TIMERS
+#elif defined(CYGINT_ISO_POSIX_TIMERS)
 
     // If POSIX is present, use the current value of the realtime
     // clock.
--- a/packages/io/fileio/current/tests/select.c
+++ b/packages/io/fileio/current/tests/select.c
@@ -45,9 +45,10 @@
 //==========================================================================
 
 #include <pkgconf/system.h>
+#include <pkgconf/isoinfra.h>
 
-#ifndef CYGPKG_POSIX
-# define NA_MSG "POSIX package needed to run test"
+#ifndef CYGINT_ISO_PTHREAD_IMPL
+# define NA_MSG "POSIX threads needed to run test"
 #endif
 
 #include <cyg/infra/testcase.h>
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,14 @@
+2001-10-16  Jesper Skov  <jskov@redhat.com>
+
+	* src/flash.c: Include string.h
+
+	* cdl/io_flash.cdl: Package requires ISOINFRA and string
+	functions.
+
+2001-10-15  David Howells  <dhowells@redhat.com>
+
+	* src/flash.c: Include string.h to get mem*() functions.
+
 2001-09-25  Gary Thomas  <gthomas@redhat.com>
 
 	* include/flash.h: Remove warning on printf() prototype.
--- a/packages/io/flash/current/cdl/io_flash.cdl
+++ b/packages/io/flash/current/cdl/io_flash.cdl
@@ -47,6 +47,8 @@ cdl_package CYGPKG_IO_FLASH {
         This option enables drivers for basic I/O services on
         flash devices."
     doc           redirect/ecos-device-drivers.html
+    requires CYGPKG_ISOINFRA
+    requires CYGINT_ISO_STRING_STRFUNCS
 
     compile       flash.c
  
--- a/packages/io/flash/current/src/flash.c
+++ b/packages/io/flash/current/src/flash.c
@@ -47,6 +47,7 @@
 #include <cyg/hal/hal_arch.h>
 #include <cyg/hal/hal_intr.h>
 #include <cyg/hal/hal_cache.h>
+#include <string.h>
 
 #define  _FLASH_PRIVATE_
 #include <cyg/io/flash.h>
--- a/packages/isoinfra/current/ChangeLog
+++ b/packages/isoinfra/current/ChangeLog
@@ -1,3 +1,21 @@
+2001-10-17  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/isoinfra.cdl: Changed string interfaces to flavor booldata.
+
+	* include/string.h: Changed feature checks to ifdef.
+
+2001-10-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/isoinfra.cdl: Make all CYGPKG_ISO_TIME interfaces be booldata.
+	Add config for POSIX clock types and implementations.
+	Make all CYGPKG_ISO_PTHREAD interfaces be booldata.
+	Add POSIX sleep() config.
+
+	* include/pthread.h: Reflect booldata interfaces.
+	* include/time.h: Ditto.
+	Also add default struct itimerspec and POSIX clock includes.
+	* include/unistd.h: Add sleep includes, with default proto.
+
 2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/isoinfra.cdl: Add netdb services and proto function support.
--- a/packages/isoinfra/current/cdl/isoinfra.cdl
+++ b/packages/isoinfra/current/cdl/isoinfra.cdl
@@ -447,6 +447,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_STRERROR {
             display       "Number of implementations of strerror() function"
             requires      { 1 >= CYGINT_ISO_STRERROR }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_STRERROR_HEADER {
@@ -470,6 +471,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_STRTOK_R {
             display       "Number of implementations of strtok_r() function"
             requires      { 1 >= CYGINT_ISO_STRTOK_R }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_STRTOK_R_HEADER {
@@ -485,6 +487,7 @@ cdl_package CYGPKG_ISOINFRA {
                 This covers locale-dependent string functions such as strcoll()
                 and strxfrm()."
             requires      { 1 >= CYGINT_ISO_STRING_LOCALE_FUNCS }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER {
@@ -500,6 +503,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_STRING_BSD_FUNCS {
             display       "Number of implementations of BSD string functions"
             requires      { 1 >= CYGINT_ISO_STRING_BSD_FUNCS }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER {
@@ -511,6 +515,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_STRING_MEMFUNCS {
             display       "Number of implementations of other mem*() functions"
             requires      { 1 >= CYGINT_ISO_STRING_MEMFUNCS }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER {
@@ -525,6 +530,7 @@ cdl_package CYGPKG_ISOINFRA {
             description   "
                 This covers the other str*() functions defined by ISO C."
             requires      { 1 >= CYGINT_ISO_STRING_STRFUNCS }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER {
@@ -565,6 +571,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_POSIX_TIMER_TYPES {
             display       "Number of implementations of POSIX timer types"
             requires      { 1 >= CYGINT_ISO_POSIX_TIMER_TYPES }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER {
@@ -573,9 +580,22 @@ cdl_package CYGPKG_ISOINFRA {
             default_value 0
         }
 
+        cdl_interface CYGINT_ISO_POSIX_CLOCK_TYPES {
+            display       "Number of implementations of POSIX clock types"
+            requires      { 1 >= CYGINT_ISO_POSIX_CLOCK_TYPES }
+            flavor        booldata
+        }
+    
+        cdl_option CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER {
+            display       "POSIX clock types implementation header"
+            flavor        booldata
+            default_value 0
+        }
+
         cdl_interface CYGINT_ISO_C_TIME_TYPES {
             display       "Number of implementations of ISO C types"
             requires      { 1 >= CYGINT_ISO_C_TIME_TYPES }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER {
@@ -587,12 +607,8 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_POSIX_TIMERS {
             display       "Number of implementations of POSIX timers"
             requires      { 1 >= CYGINT_ISO_POSIX_TIMERS }
-# FIXME  should use this:   define _POSIX_TIMERS        
-            define_proc {
-                puts $::cdl_header "#if CYGINT_ISO_POSIX_TIMERS"
-                puts $::cdl_header "# define _POSIX_TIMERS 1"
-                puts $::cdl_header "#endif"
-            }
+            define        _POSIX_TIMERS
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_POSIX_TIMERS_HEADER {
@@ -601,9 +617,22 @@ cdl_package CYGPKG_ISOINFRA {
             default_value 0
         }
 
+        cdl_interface CYGINT_ISO_POSIX_CLOCKS {
+            display       "Number of implementations of POSIX clocks"
+            requires      { 1 >= CYGINT_ISO_POSIX_CLOCKS }
+            flavor        booldata
+        }
+    
+        cdl_option CYGBLD_ISO_POSIX_CLOCKS_HEADER {
+            display       "POSIX clocks implementation header"
+            flavor        booldata
+            default_value 0
+        }
+
         cdl_interface CYGINT_ISO_C_CLOCK_FUNCS {
             display       "Number of implementations of ISO C clock functions"
             requires      { 1 >= CYGINT_ISO_C_CLOCK_FUNCS }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER {
@@ -615,6 +644,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_TZSET {
             display       "Number of implementations of tzset() function"
             requires      { 1 >= CYGINT_ISO_TZSET }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_TZSET_HEADER {
@@ -957,6 +987,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_PTHREAD_IMPL {
             display       "POSIX pthread implementations"
             requires      { 1 >= CYGINT_ISO_PTHREAD_IMPL }
+            flavor        booldata
         }
     
         cdl_option CYGBLD_ISO_PTHREAD_IMPL_HEADER {
@@ -968,6 +999,7 @@ cdl_package CYGPKG_ISOINFRA {
         cdl_interface CYGINT_ISO_PTHREAD_MUTEX {
             display       "POSIX mutex/cond var implementations"
             requires      { 1 >= CYGINT_ISO_PTHREAD_MUTEX }
+            flavor booldata
         }
     
         cdl_option CYGBLD_ISO_PTHREAD_MUTEX_HEADER {
@@ -1073,6 +1105,18 @@ cdl_package CYGPKG_ISOINFRA {
             flavor        booldata
             default_value 0
         }
+
+        cdl_interface CYGINT_ISO_POSIX_SLEEP {
+            display       "POSIX sleep() implementations"
+            flavor        booldata
+            requires      { 1 >= CYGINT_ISO_POSIX_SLEEP }
+        }
+    
+        cdl_option CYGBLD_ISO_POSIX_SLEEP_HEADER {
+            display       "POSIX sleep() implementation header"
+            flavor        booldata
+            default_value 0
+        }
     }
 
 # ====================================================================
--- a/packages/isoinfra/current/include/pthread.h
+++ b/packages/isoinfra/current/include/pthread.h
@@ -53,13 +53,13 @@
 
 /* INCLUDES */
 
-#if CYGINT_ISO_PTHREAD_IMPL
+#ifdef CYGINT_ISO_PTHREAD_IMPL
 # ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
 #  include CYGBLD_ISO_PTHREAD_IMPL_HEADER
 # endif
 #endif
 
-#if CYGINT_ISO_PTHREAD_MUTEX
+#ifdef CYGINT_ISO_PTHREAD_MUTEX
 # ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
 #  include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
 # endif
--- a/packages/isoinfra/current/include/string.h
+++ b/packages/isoinfra/current/include/string.h
@@ -62,7 +62,7 @@
 #define __need_size_t
 #include <stddef.h>
 
-#if CYGINT_ISO_STRERROR
+#ifdef CYGINT_ISO_STRERROR
 # include CYGBLD_ISO_STRERROR_HEADER
 #endif
 
@@ -96,23 +96,23 @@ memset( void *, int, size_t );
 
 #endif
 
-#if CYGINT_ISO_STRTOK_R
+#ifdef CYGINT_ISO_STRTOK_R
 # include CYGBLD_ISO_STRTOK_R_HEADER
 #endif
 
-#if CYGINT_ISO_STRING_LOCALE_FUNCS
+#ifdef CYGINT_ISO_STRING_LOCALE_FUNCS
 # include CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER
 #endif
 
-#if CYGINT_ISO_STRING_BSD_FUNCS
+#ifdef CYGINT_ISO_STRING_BSD_FUNCS
 # include CYGBLD_ISO_STRING_BSD_FUNCS_HEADER
 #endif
 
-#if CYGINT_ISO_STRING_MEMFUNCS
+#ifdef CYGINT_ISO_STRING_MEMFUNCS
 # include CYGBLD_ISO_STRING_MEMFUNCS_HEADER
 #endif
 
-#if CYGINT_ISO_STRING_STRFUNCS
+#ifdef CYGINT_ISO_STRING_STRFUNCS
 # include CYGBLD_ISO_STRING_STRFUNCS_HEADER
 #endif
 
--- a/packages/isoinfra/current/include/time.h
+++ b/packages/isoinfra/current/include/time.h
@@ -108,8 +108,8 @@ struct timeval {
 #endif
 
 
-#if CYGINT_ISO_POSIX_TIMER_TYPES
-# include CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER
+#ifdef CYGINT_ISO_POSIX_CLOCK_TYPES
+# include CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER
 #else
 
 /* Provide a default struct timespec. */
@@ -121,19 +121,36 @@ struct timespec
 };
 #endif
 
-#if CYGINT_ISO_C_TIME_TYPES
+#ifdef CYGINT_ISO_POSIX_TIMER_TYPES
+# include CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER
+#else
+
+/* Provide a default struct itimerspec. */
+struct itimerspec
+{
+    struct timespec     it_interval;
+    struct timespec     it_value;
+};
+
+#endif
+
+#ifdef CYGINT_ISO_C_TIME_TYPES
 # include CYGBLD_ISO_C_TIME_TYPES_HEADER
 #endif
 
-#if CYGINT_ISO_POSIX_TIMERS
+#ifdef CYGINT_ISO_POSIX_CLOCKS
+# include CYGBLD_ISO_POSIX_CLOCKS_HEADER
+#endif
+
+#ifdef CYGINT_ISO_POSIX_TIMERS
 # include CYGBLD_ISO_POSIX_TIMERS_HEADER
 #endif
 
-#if CYGINT_ISO_C_CLOCK_FUNCS
+#ifdef CYGINT_ISO_C_CLOCK_FUNCS
 # include CYGBLD_ISO_C_CLOCK_FUNCS_HEADER
 #endif
 
-#if CYGINT_ISO_TZSET
+#ifdef CYGINT_ISO_TZSET
 # include CYGBLD_ISO_TZSET_HEADER
 #endif
 
--- a/packages/isoinfra/current/include/unistd.h
+++ b/packages/isoinfra/current/include/unistd.h
@@ -74,14 +74,11 @@ extern "C" {
 #  endif
 
 extern unsigned int
-alarm( unsigned int __seconds );
+alarm( unsigned int /* seconds */ );
 
 extern int 
 pause( void );
 
-unsigned int
-sleep( unsigned int __seconds );
-
 #  ifdef __cplusplus
 }   /* extern "C" */
 #  endif
@@ -89,6 +86,23 @@ sleep( unsigned int __seconds );
 # endif
 #endif
 
+#ifdef CYGINT_ISO_POSIX_SLEEP
+# ifdef CYGBLD_ISO_POSIX_SLEEP_HEADER
+#  include CYGBLD_ISO_POSIX_SLEEP_HEADER
+# else
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+
+unsigned int
+sleep( unsigned int /* seconds */ );
+
+#  ifdef __cplusplus
+}   /* extern "C" */
+#  endif
+# endif
+#endif
+
 
 /* ------------------------------------------------------------------- */
 
--- a/packages/kernel/current/ChangeLog
+++ b/packages/kernel/current/ChangeLog
@@ -1,3 +1,34 @@
+2001-10-17  Jesper Skov  <jskov@redhat.com>
+
+	* tests/dhrystone.c: CYGINT_ISO_STRING_STRFUNCS check changed to
+	ifdef.
+
+2001-10-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/synch.cdl (CYGIMP_KERNEL_SYNCH_MQUEUE_NOT_INLINE): New option
+	to avoid inliningn mqueue implementation.
+
+	* src/sync/mqueue.cxx: New file to provide non-inline version of
+	mqueue functions.
+
+	* include/mqueue.hxx: Don't include .inl if user doesn't want inlining.
+
+	* include/mqueue.inl: Allow choice of inlining or not to be
+	overridden by macro.
+
+	* tests/mqueue1.cxx: Never use inline version.
+
+2001-10-11  Jesper Skov  <jskov@redhat.com>
+
+	* tests/kmutex3.c (new_thread): Fixed allocation: increase counter
+	before starting threads which have been allocated resources.
+	* tests/kmutex4.c (new_thread): Same.
+	* tests/mutex3.cxx (new_thread): Same.
+	* tests/testaux.hxx (new_thread): Same.
+
+	* tests/kcache2.c: Fixed warning.
+	* tests/stress_threads.c: Same.
+
 2001-09-20  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* host/instr/dump_instr.c (main): Fix argc check.
--- a/packages/kernel/current/cdl/synch.cdl
+++ b/packages/kernel/current/cdl/synch.cdl
@@ -183,3 +183,15 @@ cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_W
         different mutex as an argument. This makes no difference to the semantics
         the wait operation except that a different mutex will be used during it."
 }
+
+cdl_option CYGIMP_KERNEL_SYNCH_MQUEUE_NOT_INLINE {
+    display       "Avoid inlines in mqueue implementation"
+    default_value 0
+    description   "
+        With this option disabled, the 'mqueue' message queue implementation
+        provides most of its implementation via inlines. However this can
+        adversely affect code size in application that make lots of mqueue
+        calls from different places, so enabling this option provides
+        non-inline versions to be used instead."
+    compile       sync/mqueue.cxx
+}
--- a/packages/kernel/current/include/mqueue.hxx
+++ b/packages/kernel/current/include/mqueue.hxx
@@ -135,7 +135,9 @@ public:
     
 }; /* class Cyg_Mqueue */
 
-#include <cyg/kernel/mqueue.inl>
+#ifndef CYGIMP_KERNEL_SYNCH_MQUEUE_NOT_INLINE
+# include <cyg/kernel/mqueue.inl>
+#endif
 
 #endif /* CYGONCE_KERNEL_MQUEUE_HXX multiple inclusion protection */
 
--- a/packages/kernel/current/include/mqueue.inl
+++ b/packages/kernel/current/include/mqueue.inl
@@ -88,9 +88,13 @@ externC void * memcpy( void *, const voi
 
 /* INLINE FUNCTIONS */
 
+#ifndef CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE
+# define CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE inline
+#endif
+
 //------------------------------------------------------------------------
 
-inline cyg_bool
+CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE cyg_bool
 Cyg_Mqueue::check_this( cyg_assert_class_zeal zeal ) const
 {
     if (zeal != cyg_none) {
@@ -175,7 +179,7 @@ Cyg_Mqueue::check_this( cyg_assert_class
 
 //------------------------------------------------------------------------
 
-inline
+CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE
 Cyg_Mqueue::Cyg_Mqueue( long maxmsgs, long maxmsgsize,
                         qalloc_fn_t qalloc, qfree_fn_t qfree, qerr_t *err )
     : putsem(maxmsgs), getsem(0)
@@ -237,7 +241,7 @@ Cyg_Mqueue::Cyg_Mqueue( long maxmsgs, lo
 
 //------------------------------------------------------------------------
 
-inline
+CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE
 Cyg_Mqueue::~Cyg_Mqueue()
 {
     CYG_REPORT_FUNCTION();
@@ -258,7 +262,7 @@ Cyg_Mqueue::~Cyg_Mqueue()
 //------------------------------------------------------------------------
 
 // put() copies len bytes of *buf into the queue at priority prio
-inline Cyg_Mqueue::qerr_t
+CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE Cyg_Mqueue::qerr_t
 Cyg_Mqueue::put( const char *buf, size_t len, unsigned int prio, bool block )
 {
     CYG_REPORT_FUNCTYPE( "err=%d");
@@ -365,7 +369,7 @@ Cyg_Mqueue::put( const char *buf, size_t
 // and sets *prio to the priority (if prio is non-NULL) and *len to the
 // actual message size
 
-inline Cyg_Mqueue::qerr_t
+CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE Cyg_Mqueue::qerr_t
 Cyg_Mqueue::get( char *buf, size_t *len, unsigned int *prio, bool block )
 {
     CYG_REPORT_FUNCTYPE( "err=%d");
@@ -467,7 +471,7 @@ Cyg_Mqueue::count()
 // when the queue goes from empty to non-empty (unless someone's already
 // doing a get()). This returns the old callback_fn, and if olddata is
 // non-NULL sets it to the old data (yes, really!)
-inline Cyg_Mqueue::callback_fn_t
+CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE Cyg_Mqueue::callback_fn_t
 Cyg_Mqueue::setnotify( callback_fn_t callback_fn, CYG_ADDRWORD data,
                        CYG_ADDRWORD *olddata)
 {
new file mode 100644
--- /dev/null
+++ b/packages/kernel/current/src/sync/mqueue.cxx
@@ -0,0 +1,56 @@
+//==========================================================================
+//
+//      sync/mqueue.cxx
+//
+//      Mqueue message queue non-inline implementation
+//
+//==========================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released September 30, 1998.                                             
+//                                                                          
+// The Initial Developer of the Original Code is Red Hat.                   
+// Portions created by Red Hat are                                          
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
+// All Rights Reserved.                                                     
+// -------------------------------------------                              
+//                                                                          
+//####COPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    jlarmour
+// Contributors: 
+// Date:         2001-10-12
+// Purpose:      Non-inlined implementation of mqueue message queue.
+// Description:  This file contains the non-inlined instantiations of the
+//               mqueue message queue implementation functions.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/kernel.h>
+
+#ifdef CYGIMP_KERNEL_SYNCH_MQUEUE_NOT_INLINE
+
+#define CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE
+#include <cyg/kernel/mqueue.hxx>
+#include <cyg/kernel/mqueue.inl>
+
+#endif
+
+// -------------------------------------------------------------------------
+// EOF sync/mqueue.cxx
--- a/packages/kernel/current/tests/dhrystone.c
+++ b/packages/kernel/current/tests/dhrystone.c
@@ -42,7 +42,7 @@
 # if !defined(CYGFUN_KERNEL_API_C) \
     || !defined(CYGINT_ISO_STDIO_FORMATTED_IO) \
     || CYGINT_ISO_MALLOC == 0 \
-    || CYGINT_ISO_STRING_STRFUNCS == 0
+    || !defined(CYGINT_ISO_STRING_STRFUNCS)
 
 #  define NA_MSG "Requires CYGFUN_KERNEL_API_C && CYGINT_ISO_STDIO_FORMATTED_IO && CYGINT_ISO_MALLOC && CYGINT_ISO_STRING_STRFUNCS"
 
--- a/packages/kernel/current/tests/kcache2.c
+++ b/packages/kernel/current/tests/kcache2.c
@@ -346,6 +346,7 @@ static void test_dsync(void)
 //  o Requires write-back cache.
 //  o Check that flushed data is written to memory.
 //  o Simple range check of macro.
+#ifdef HAL_DCACHE_QUERY_WRITE_MODE // only if we know this, can we test:
 #ifdef HAL_DCACHE_FLUSH
 static void test_dflush(void)
 {
@@ -389,6 +390,7 @@ static void test_dflush(void)
     HAL_DCACHE_ENABLE();
 }
 #endif
+#endif
 
 // -------------------------------------------------------------------------
 // Test of data cache disable (which does NOT force contents out to RAM)
--- a/packages/kernel/current/tests/kmutex3.c
+++ b/packages/kernel/current/tests/kmutex3.c
@@ -139,7 +139,7 @@ static CYG_ALIGNMENT_TYPE stack[NTHREADS
    (STACKSIZE+sizeof(CYG_ALIGNMENT_TYPE)-1)
      / sizeof(CYG_ALIGNMENT_TYPE)                     ];
 
-static int nthreads = 0;
+static volatile int nthreads = 0;
 
 #undef NULL
 #define NULL (0)
@@ -149,22 +149,24 @@ static cyg_handle_t new_thread( cyg_thre
                                 cyg_addrword_t priority,
                                 int do_resume )
 {
-    CYG_ASSERT(nthreads < NTHREADS, 
+    int _nthreads = nthreads++;
+
+    CYG_ASSERT(_nthreads < NTHREADS, 
                "Attempt to create more than NTHREADS threads");
 
     cyg_thread_create( priority,
                        entry,
                        data, 
                        NULL,                // no name
-                       (void *)(stack[nthreads]),
+                       (void *)(stack[_nthreads]),
                        STACKSIZE,
-                       &thread[nthreads],
-                       &thread_obj[nthreads] );
+                       &thread[_nthreads],
+                       &thread_obj[_nthreads] );
 
     if ( do_resume )
-        cyg_thread_resume( thread[nthreads] );
+        cyg_thread_resume( thread[_nthreads] );
 
-    return thread[nthreads++];
+    return thread[_nthreads];
 }
 
 
--- a/packages/kernel/current/tests/kmutex4.c
+++ b/packages/kernel/current/tests/kmutex4.c
@@ -122,7 +122,7 @@ static CYG_ALIGNMENT_TYPE stack[NTHREADS
    (STACKSIZE+sizeof(CYG_ALIGNMENT_TYPE)-1)
      / sizeof(CYG_ALIGNMENT_TYPE)                     ];
 
-static int nthreads = 0;
+static volatile int nthreads = 0;
 
 #undef NULL
 #define NULL (0)
@@ -133,22 +133,24 @@ static cyg_handle_t new_thread( cyg_thre
                                 int do_resume,
                                 char *name )
 {
-    CYG_ASSERT(nthreads < NTHREADS, 
+    int _nthreads = nthreads++;
+
+    CYG_ASSERT(_nthreads < NTHREADS, 
                "Attempt to create more than NTHREADS threads");
 
     cyg_thread_create( priority,
                        entry,
                        data, 
                        name,
-                       (void *)(stack[nthreads]),
+                       (void *)(stack[_nthreads]),
                        STACKSIZE,
-                       &thread[nthreads],
-                       &thread_obj[nthreads] );
+                       &thread[_nthreads],
+                       &thread_obj[_nthreads] );
 
     if ( do_resume )
-        cyg_thread_resume( thread[nthreads] );
+        cyg_thread_resume( thread[_nthreads] );
 
-    return thread[nthreads++];
+    return thread[_nthreads];
 }
 
 
--- a/packages/kernel/current/tests/mqueue1.cxx
+++ b/packages/kernel/current/tests/mqueue1.cxx
@@ -52,6 +52,9 @@
 #include <cyg/infra/cyg_type.h>      // common types and externC
 #include <cyg/kernel/thread.hxx>     // Cyg_Thread
 #include <cyg/kernel/thread.inl>
+// Specially avoid inlining here due to the way we abuse the mqueue
+// implementation by making lots and lots of calls.
+#define CYGPRI_KERNEL_SYNCH_MQUEUE_INLINE
 #include <cyg/kernel/mqueue.hxx>     // Mqueue Header
 #include <cyg/kernel/sema.hxx>       // semaphores
 #include <cyg/infra/testcase.h>      // test API
--- a/packages/kernel/current/tests/mutex3.cxx
+++ b/packages/kernel/current/tests/mutex3.cxx
@@ -138,26 +138,28 @@ static CYG_ALIGNMENT_TYPE stack[NTHREADS
    (STACKSIZE+sizeof(CYG_ALIGNMENT_TYPE)-1)
      / sizeof(CYG_ALIGNMENT_TYPE)                     ];
 
-static int nthreads = 0;
+static volatile int nthreads = 0;
 
 static Cyg_Thread *new_thread( cyg_thread_entry *entry,
                                CYG_ADDRWORD data,
                                CYG_ADDRWORD priority,
                                int do_resume )
 {
-    CYG_ASSERT(nthreads < NTHREADS, 
+    int _nthreads = nthreads++;
+
+    CYG_ASSERT(_nthreads < NTHREADS, 
                "Attempt to create more than NTHREADS threads");
 
-    thread[nthreads] = new( (void *)&thread_obj[nthreads] )
+    thread[_nthreads] = new( (void *)&thread_obj[_nthreads] )
         Cyg_Thread(priority,
                    entry, data, 
                    NULL,                // no name
-                   (CYG_ADDRESS)stack[nthreads], STACKSIZE );
+                   (CYG_ADDRESS)stack[_nthreads], STACKSIZE );
 
     if ( do_resume )
-        thread[nthreads]->resume();
+        thread[_nthreads]->resume();
 
-    return thread[nthreads++];
+    return thread[_nthreads];
 }
 
 
--- a/packages/kernel/current/tests/stress_threads.c
+++ b/packages/kernel/current/tests/stress_threads.c
@@ -492,7 +492,7 @@ void start_handler(void)
 {
     int prio;
     char* name;
-    int handler_slot;
+    int handler_slot = 0;
     int found = 0;
 
     while (!found) {
--- a/packages/kernel/current/tests/testaux.hxx
+++ b/packages/kernel/current/tests/testaux.hxx
@@ -73,22 +73,24 @@ static CYG_ALIGNMENT_TYPE stack[NTHREADS
    (STACKSIZE+sizeof(CYG_ALIGNMENT_TYPE)-1)
      / sizeof(CYG_ALIGNMENT_TYPE)                     ];
 
-static int nthreads = 0;
+static volatile int nthreads = 0;
 
-static Cyg_Thread *new_thread(cyg_thread_entry *entry, CYG_ADDRWORD data) {
+static Cyg_Thread *new_thread(cyg_thread_entry *entry, CYG_ADDRWORD data)
+{
+    int _nthreads = nthreads++;
 
-    CYG_ASSERT(nthreads < NTHREADS, 
+    CYG_ASSERT(_nthreads < NTHREADS, 
                "Attempt to create more than NTHREADS threads");
 
-    thread[nthreads] = new( (void *)&thread_obj[nthreads] )
+    thread[_nthreads] = new( (void *)&thread_obj[_nthreads] )
         Cyg_Thread(CYG_SCHED_DEFAULT_INFO,
                    entry, data, 
                    NULL,                // no name
-                   (CYG_ADDRESS)stack[nthreads], STACKSIZE );
+                   (CYG_ADDRESS)stack[_nthreads], STACKSIZE );
 
-    thread[nthreads]->resume();
+    thread[_nthreads]->resume();
 
-    return thread[nthreads++];
+    return thread[_nthreads];
 }
 #endif // defined(NTHREADS)
 
--- a/packages/language/c/libc/startup/current/ChangeLog
+++ b/packages/language/c/libc/startup/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/invokemain.cxx (cyg_libc_invoke_main): CYGINT_ISO_PTHREAD_IMPL
+	needs #ifdef not #if now.
+
 2000-12-22  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/startup.cdl: Allow others to say whether main() can be invoked
--- a/packages/language/c/libc/startup/current/src/invokemain.cxx
+++ b/packages/language/c/libc/startup/current/src/invokemain.cxx
@@ -106,7 +106,7 @@ cyg_libc_invoke_main( CYG_ADDRWORD )
     CYG_TRACE1( true, "main() has returned with code %d. Calling exit()",
                 rc );
 
-#if CYGINT_ISO_PTHREAD_IMPL > 0
+#ifdef CYGINT_ISO_PTHREAD_IMPL
     // It is up to pthread_exit() to call exit() if needed
     pthread_exit( (void *)rc );
     CYG_FAIL( "pthread_exit() returned!!!" );
--- a/packages/net/tcpip/current/ChangeLog
+++ b/packages/net/tcpip/current/ChangeLog
@@ -1,3 +1,13 @@
+2001-10-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/sys/netinet/in.c (in_lifaddr_ioctl): Silence warnings about
+	trigraphs.
+
+2001-10-10  Hugo Tyson  <hmt@redhat.com>
+
+	* tests/ftp_test.c (net_test): This was lacking #ifdefs for
+	CYGHWR_NET_DRIVER_ETH0 and CYGHWR_NET_DRIVER_ETH1.  Ooops.
+
 2001-10-05  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/net.cdl (CYGPKG_NET_CFLAGS_ADD): Define __INSIDE_NET within
@@ -11,7 +21,7 @@ 2001-10-04  Jonathan Larmour  <jlarmour@
 
 	* cdl/net.cdl (CYGHWR_NET_DRIVER_ETH0): Make flavor bool so it isn't
 	defined when 0.
-	(CYGHWR_NET_DRIVER_ETH0): Ditto.
+	(CYGHWR_NET_DRIVER_ETH1): Ditto.
 
 2001-10-04  Hugo Tyson  <hmt@redhat.com>
 
--- a/packages/net/tcpip/current/src/sys/netinet/in.c
+++ b/packages/net/tcpip/current/src/sys/netinet/in.c
@@ -470,7 +470,7 @@ in_control(so, cmd, data, ifp)
 
 /*
  * SIOC[GAD]LIFADDR.
- *	SIOCGLIFADDR: get first address. (???)
+ *	SIOCGLIFADDR: get first address. ( ??? )
  *	SIOCGLIFADDR with IFLR_PREFIX:
  *		get first address that matches the specified prefix.
  *	SIOCALIFADDR: add the specified address.
--- a/packages/net/tcpip/current/tests/ftp_test.c
+++ b/packages/net/tcpip/current/tests/ftp_test.c
@@ -161,12 +161,16 @@ net_test(cyg_addrword_t param)
 {
     diag_printf("Start FTP test\n");
     init_all_network_interfaces();
+#ifdef CYGHWR_NET_DRIVER_ETH0
     if (eth0_up) {
         ftp_test(&eth0_bootp_data);
     }
+#endif
+#ifdef CYGHWR_NET_DRIVER_ETH1
     if (eth1_up) {
         ftp_test(&eth1_bootp_data);
     }
+#endif
     cyg_test_exit();
 }
 
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,73 @@
+2001-10-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/net/net_io.c (net_init): Set cyg_io_eth_net_debug from net_debug.
+	* include/net/net.h: Declare cyg_io_eth_net_debug.
+
+2001-10-18  David Howells  <dhowells@redhat.com>
+
+	* src/syscall.c: Added support for the times() syscall and marked
+	the utime() syscall as being implemented incorrectly.
+
+2001-10-18  Gary Thomas  <gthomas@redhat.com>
+
+	* src/io.c (_rb_gets): Fix parsing of \" in strings.
+
+2001-10-16  Jesper Skov  <jskov@zoftcorp.adsl.dk>
+
+	* cdl/redboot.cdl: Require ISOINFA.
+
+2001-10-16  Jesper Skov  <jskov@redhat.com>
+
+	* src/net/dns.c (send_recv): Clear from_addr before passing it to
+	__udp_recvfrom. Fixed return value.
+
+2001-10-16  Gary Thomas  <gthomas@redhat.com>
+
+	* src/flash.c (_do_flash_init): 
+	Add wrapper function for do_flash_init() to avoid compiler warning.
+
+	* src/io.c (_rb_gets): 
+	Use sub-timeouts when calling mon_read_char_with_timeout() as it
+	was intended that this routine should timeout quickly to allow
+	for other processing to take place if no data is available.  In
+	practice this won't make any difference unless the global "idle"
+	timeout value is changed to be something quite large.
+
+	* src/decompress.c: Improve memory allocators.  Also use 'init'
+	style function so that this is the only file that knows anything
+	of the details of the decompression process or packaging.
+
+	* src/main.c: 
+	* include/redboot.h: 
+	* cdl/redboot.cdl: Rework decompression to be totally encapsulated.
+	This keeps the details of this functionality in a single file, rather
+	than scattered throughout RedBoot.
+
+2001-10-15  David Howells  <dhowells@redhat.com>
+
+	* src/xyzModem.c: put semicolon between goto-label and close curly.
+
+2001-10-15  Gary Thomas  <gthomas@redhat.com>
+
+	* src/flash.c (_expand_aliases): Change around some ambiguous code.
+
+	* src/main.c: 
+	* src/decompress.c: 
+	* include/redboot.h: 
+	* cdl/redboot.cdl: Provide RedBoot specific memory allocators
+	for ZLIB.  Allows much finer control over memory map.
+
+	* src/main.c (do_dump): Add option "-s" to dump data as S-records.
+
+2001-10-11  Gary Thomas  <gthomas@redhat.com>
+
+	* src/net/enet.c (__enet_poll): Suppress warning messages.
+
+2001-10-10  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/flash.c (do_flash_init): Only set __flash_init when init is
+	successful.
+
 2001-10-04  Jesper Skov  <jskov@redhat.com>
 
 	* src/fs/disk.c: Fix ISO9660 build error.
--- a/packages/redboot/current/cdl/redboot.cdl
+++ b/packages/redboot/current/cdl/redboot.cdl
@@ -56,6 +56,7 @@ cdl_package CYGPKG_REDBOOT {
         display "Build Redboot ROM ELF image"
         default_value 0
         requires CYGPKG_INFRA
+        requires CYGPKG_ISOINFRA
 # Someday the tools will handle this
 #        requires { CYGINT_HAL_DEBUG_GDB_STUBS implies CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS }
 #        requires { CYGINT_HAL_DEBUG_GDB_STUBS implies CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT }
@@ -71,6 +72,15 @@ cdl_package CYGPKG_REDBOOT {
         requires CYGINT_ISO_STRING_MEMFUNCS 
         requires CYGINT_ISO_STRING_STRFUNCS
 
+        cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB {
+            display       "Include support gzip/zlib decompression"
+            active_if     CYGPKG_COMPRESS_ZLIB
+            no_define
+            default_value 1
+            implements    CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC
+            compile       decompress.c
+        }
+
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS {
             display "Threads debugging support"
             no_define
@@ -102,7 +112,6 @@ cdl_package CYGPKG_REDBOOT {
 
         compile main.c crc.c
         compile misc_funs.c io.c parse.c ticks.c xyzModem.c syscall.c
-        compile decompress.c
         compile -library=libextras.a load.c
 
         make -priority 320 {
--- a/packages/redboot/current/include/net/net.h
+++ b/packages/redboot/current/include/net/net.h
@@ -46,12 +46,19 @@
 #ifndef _NET_H_
 #define _NET_H_
 
+#include <pkgconf/system.h>
 #include <pkgconf/redboot.h>
 #include <cyg/hal/hal_arch.h>
 #include <cyg/hal/basetype.h>
 #include <string.h>
 
 extern bool net_debug;
+#ifdef CYGPKG_IO_ETH_DRIVERS
+#  include <pkgconf/io_eth_drivers.h>
+# ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+extern int cyg_io_eth_net_debug;
+# endif
+#endif
 
 extern unsigned long do_ms_tick(void);
 extern unsigned long get_ms_ticks(void);
--- a/packages/redboot/current/src/decompress.c
+++ b/packages/redboot/current/src/decompress.c
@@ -32,7 +32,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    jskov
-// Contributors: jskov
+// Contributors: jskov, gthomas
 // Date:         2001-03-08
 // Purpose:      
 // Description:  
@@ -49,13 +49,195 @@
 #include <cyg/compress/zlib.h>
 static z_stream stream;
 
+#define __ZLIB_MAGIC__ 0x5A4C4942   // 'ZLIB'
+
+//
+// Free memory [blocks] are stored as a linked list of "struct _block"
+// When free, 'size' is the size of the whole block
+// When allocated, 'size' is the allocation size
+// The 'magic' is kept to insure that the block being freed is reasonable
+//
+struct _block {
+    int            size;
+    long           magic;  // Must be __ZLIB_MAGIC__
+    struct _block *next;
+    struct _block *self;
+};
+static struct _block *memlist;
+
+#define ZLIB_COMPRESSION_OVERHEAD 0xC000
+static void *zlib_workspace;
+
+//
+// This function is run as part of RedBoot's initialization.
+// It will allocate some memory from the "workspace" pool for
+// use by the gzip/zlib routines.  This allows the memory usage
+// of RedBoot to be more finely controlled than if we simply
+// used the generic 'malloc() from the heap' functionality.
+//
+static void
+_zlib_init(void)
+{
+    // Allocate some RAM for use by the gzip/zlib routines
+    workspace_end -= ZLIB_COMPRESSION_OVERHEAD;
+    zlib_workspace = workspace_end;
+}
+
+RedBoot_init(_zlib_init, RedBoot_INIT_FIRST);
+
+// #define DEBUG_ZLIB_MALLOC
+#ifdef DEBUG_ZLIB_MALLOC
+static void
+show_memlist(char *when)
+{
+    struct _block *bp = memlist;
+
+    diag_printf("memory list after %s\n", when);
+    while (bp != (struct _block *)0) {
+        diag_printf("   %08p %5d %08p\n", bp, bp->size, bp->next);
+        bp = bp->next;
+    }
+}
+#endif
+
+// Note: these have to be global and match the prototype used by the
+// gzip/zlib package since we are exactly replacing them.
+
+void 
+*zcalloc(void *opaque, unsigned int items, unsigned int size)
+{
+    voidpf res;
+    int len = (items*size);
+    struct _block *bp = memlist;
+    struct _block *nbp, *pbp;
+
+    // Simple, first-fit algorithm
+    pbp = (struct _block *)0;
+    while (bp) {
+        if (bp->size > len) {
+            nbp = (struct _block *)((char *)bp + len + sizeof(struct _block));
+            nbp->next = bp->next;
+            nbp->size = bp->size - len;
+            if (pbp) {
+                pbp->next = nbp;
+            } else {
+                memlist = nbp;
+            }
+            res = bp;
+            break;
+        }
+        pbp = bp;
+        bp = bp->next;
+    }
+    if (bp) {
+        bp->size = len;
+        bp->magic = __ZLIB_MAGIC__;
+        bp->self = bp;
+        res = bp+1;
+        memset(res, 0, len);
+    } else {
+        res = 0;  // No memory left
+    }
+#ifdef DEBUG_ZLIB_MALLOC
+    diag_printf("%s(%d,%d) = %p\n", __FUNCTION__, items, size, res);
+    show_memlist(__FUNCTION__);
+#endif
+    return res;
+}
+
+void 
+zcfree(void *opaque, void *ptr)
+{
+    struct _block *bp, *pbp, *nbp;
+    int size;
+
+    if (!ptr) return;  // Safety
+    bp = (struct _block *)((char *)ptr - sizeof(struct _block));
+    if ((bp->magic != __ZLIB_MAGIC__) || (bp->self != bp)) {
+        diag_printf("%s(%p) - invalid block\n", __FUNCTION__, ptr);
+        return;
+    }
+    size = bp->size;
+#ifdef DEBUG_ZLIB_MALLOC
+    diag_printf("%s(%p) = %d bytes\n", __FUNCTION__, ptr, size);
+#endif
+    // See if this block is adjacent to a free block
+    nbp = memlist;
+    pbp = (struct _block *)0;
+    while (nbp) {
+        if ((char *)bp+size+sizeof(struct _block) == (char *)nbp) {
+            // The block being freed fits just before
+            bp->next = nbp->next;
+            bp->size = nbp->size + size + sizeof(struct _block);
+#ifdef DEBUG_ZLIB_MALLOC
+            diag_printf("Free before\n");
+#endif
+            if (pbp) {
+                pbp->next = bp;
+                // See if this new block and the previous one can
+                // be combined.
+                if ((char *)pbp+pbp->size == (char *)bp) {
+#ifdef DEBUG_ZLIB_MALLOC
+                    diag_printf("Collapse [before] - p: %p/%d/%p, n: %p/%d/%p\n",
+                                pbp, pbp->size, pbp->next,
+                                bp, bp->size, bp->next);
+#endif
+                    pbp->size += bp->size;
+                    pbp->next = bp->next;
+                }
+            } else {
+                memlist = bp;
+            }
+#ifdef DEBUG_ZLIB_MALLOC
+            show_memlist(__FUNCTION__);
+#endif
+            return;
+        } else
+        if ((char *)nbp+nbp->size == (char *)bp) {
+            // The block being freed fits just after
+            nbp->size += size + sizeof(struct _block);
+            // See if it will now collapse with the following block
+#ifdef DEBUG_ZLIB_MALLOC
+            diag_printf("Free after\n");
+#endif
+            if (nbp->next != (struct _block *)0) {
+                if ((char *)nbp+nbp->size == (char *)nbp->next) {
+#ifdef DEBUG_ZLIB_MALLOC
+                    diag_printf("Collapse [after] - p: %p/%d/%p, n: %p/%d/%p\n",
+                                nbp, nbp->size, nbp->next,
+                                nbp->next, nbp->next->size, nbp->next->next);
+#endif
+                    nbp->size += (nbp->next)->size;
+                    nbp->next = (nbp->next)->next;
+                }
+            }
+#ifdef DEBUG_ZLIB_MALLOC
+            show_memlist(__FUNCTION__);
+#endif
+            return;
+        } else {
+            pbp = nbp;
+            nbp = nbp->next;
+        }
+    }
+}
+
+//
+// This function is called to initialize a gzip/zlib stream.
+// Note that it also reinitializes the memory pool every time.
+//
 static int
 gzip_init(_pipe_t* p)
 {
     int err;
+    struct _block *bp;
 
-    stream.zalloc = (alloc_func)0;
-    stream.zfree = (free_func)0;
+    bp = (struct _block *)zlib_workspace;
+    memlist = bp;
+    bp->next = 0;
+    bp->size = ZLIB_COMPRESSION_OVERHEAD;
+    stream.zalloc = zcalloc;
+    stream.zfree = zcfree;
     stream.next_in = NULL;
     stream.avail_in = 0;
     stream.next_out = NULL;
@@ -65,6 +247,10 @@ gzip_init(_pipe_t* p)
     return err;
 }
 
+//
+// This function is called during the decompression cycle to
+// actually cause a buffer to be filled with uncompressed data.
+//
 static int
 gzip_inflate(_pipe_t* p)
 {
@@ -82,6 +268,11 @@ gzip_inflate(_pipe_t* p)
     return err;
 }
 
+//
+// Called when the input data is completed or an error has
+// occured.  This allows for clean up as well as passing error
+// information up.
+//
 static int
 gzip_close(_pipe_t* p, int err)
 {
@@ -103,6 +294,9 @@ gzip_close(_pipe_t* p, int err)
     return err;
 }
 
+//
+// Exported interfaces
+//
 _decompress_fun_init* _dc_init = gzip_init;
 _decompress_fun_inflate* _dc_inflate = gzip_inflate;
 _decompress_fun_close* _dc_close = gzip_close;
--- a/packages/redboot/current/src/flash.c
+++ b/packages/redboot/current/src/flash.c
@@ -1076,7 +1076,6 @@ do_flash_init(void)
     int stat;
 
     if (!__flash_init) {
-        __flash_init = 1;
         if ((stat = flash_init((void *)(workspace_end-FLASH_MIN_WORKSPACE), 
                                FLASH_MIN_WORKSPACE, diag_printf)) != 0) {
             diag_printf("FLASH: driver init failed: %s\n", flash_errmsg(stat));
@@ -1092,12 +1091,20 @@ do_flash_init(void)
         fis_work_block = workspace_end;
         fisdir_size = block_size;
 #endif
+        __flash_init = 1;
     }
     return true;
 }
 
+// Wrapper to avoid compiler warnings
+static void
+_do_flash_init(void)
+{
+    do_flash_init();
+}
+
 #ifndef CYGOPT_REDBOOT_FLASH_CONFIG
-RedBoot_init(do_flash_init, RedBoot_INIT_FIRST);
+RedBoot_init(_do_flash_init, RedBoot_INIT_FIRST);
 #endif
 
 static void
@@ -1691,12 +1698,14 @@ bool
 			if (offset > 1) {
                             ep[offset] = '\0';
                             while (ep != (lp-1)) {
-                                ep[offset-1] = *ep--;
+                                ep[offset-1] = *ep;
+                                ep--;
                             }           
 			} else {
                             if (offset <=0) {
                                 while ((lp-1) != ep) {
-                                    lp[offset-1] = *lp++;
+                                    lp[offset-1] = *lp;
+                                    lp++;
                                 }
                                 lp[offset-1]='\0';
                             }
--- a/packages/redboot/current/src/io.c
+++ b/packages/redboot/current/src/io.c
@@ -297,7 +297,8 @@ int
         else
 #endif
         if ((timeout > 0) && (ptr == buf)) {
-            mon_set_read_char_timeout(timeout);
+#define MIN_TIMEOUT 50
+            mon_set_read_char_timeout(timeout > MIN_TIMEOUT ? MIN_TIMEOUT : timeout);
             while (timeout > 0) {
                 res = mon_read_char_with_timeout(&c);
                 if (res) {
@@ -305,7 +306,7 @@ int
                     do_idle(false);
                     break;
                 }
-                timeout -= 50;
+                timeout -= MIN_TIMEOUT;
             }
             if (res == false) {
                 do_idle(true);
@@ -349,15 +350,6 @@ int
                 ptr--;
             }
             break;
-        case '\\':                 // escape character
-            if (console_echo) {
-                mon_write_char(c);
-            }
-            if (last_ch != '\\') // if last was also an escape, 
-                break;             // don't add to buffer, just move on
-            *ptr++ = c;
-            c = '\0';    // cheat so that the "shift" state resets
-            break;
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
         case '+': // fall through
         case '$':
@@ -367,6 +359,9 @@ int
                 ungetDebugChar(c);  // Push back character so stubs will see it
                 return _GETS_GDB;
             }
+            if (last_ch == '\\') {
+                ptr--;  // Save \$ as $
+            }
             // else fall through
 #endif
         default:
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -87,13 +87,13 @@ RedBoot_cmd("go",
     );
 RedBoot_cmd("dump", 
             "Display (hex dump) a range of memory", 
-            "-b <location> [-l <length>]",
+            "-b <location> [-l <length>] [-s]",
             do_dump 
     );
 RedBoot_cmd("x", 
             "Display (hex dump) a range of memory", 
-            "-b <location> [-l <length>]",
-            do_x 
+            "-b <location> [-l <length>] [-s]",
+            do_x
     );
 RedBoot_cmd("cksum", 
             "Compute a 32bit checksum [POSIX algorithm] for a range of memory", 
@@ -240,13 +240,9 @@ cyg_start(void)
         (*init_entry->fun)();
     }
 
-#ifdef CYGPKG_COMPRESS_ZLIB
-#define ZLIB_COMPRESSION_OVERHEAD 0xB800
-#else
-#define ZLIB_COMPRESSION_OVERHEAD 0
-#endif
-    user_ram_start = workspace_start + ZLIB_COMPRESSION_OVERHEAD;
+    user_ram_start = workspace_start;
     user_ram_end = workspace_end;
+
     do_version(0,0);
 
 #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
@@ -404,16 +400,21 @@ do_help(int argc, char *argv[])
 void
 do_dump(int argc, char *argv[])
 {
-    struct option_info opts[2];
+    struct option_info opts[3];
     unsigned long base, len;
     bool base_set, len_set;
     static unsigned long _base, _len;
+    bool srec_dump;
+    int i, n, off, cksum;
+    cyg_uint8 ch;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
               (void **)&base, (bool *)&base_set, "base address");
     init_opts(&opts[1], 'l', true, OPTION_ARG_TYPE_NUM, 
               (void **)&len, (bool *)&len_set, "length");
-    if (!scan_opts(argc, argv, 1, opts, 2, 0, 0, "")) {
+    init_opts(&opts[2], 's', false, OPTION_ARG_TYPE_FLG, 
+              (void **)&srec_dump, 0, "dump data using Morotola S-records");
+    if (!scan_opts(argc, argv, 1, opts, 3, 0, 0, "")) {
         return;
     }
     if (!base_set) {
@@ -430,7 +431,26 @@ do_dump(int argc, char *argv[])
     if (!len_set) {
         len = 32;
     }
-    diag_dump_buf((void *)base, len);
+    if (srec_dump) {
+        off = 0;
+        while (off < len) {
+            n = (len > 16) ? 16 : len;
+            cksum = n+5;
+            diag_printf("S3%02X%08X", n+5, off+base);
+            for (i = 0;  i < 4;  i++) {
+                cksum += (((base+off)>>(i*8)) & 0xFF);
+            }
+            for (i = 0;  i < n;  i++) {
+                ch = *(cyg_uint8 *)(base+off+i);
+                diag_printf("%02X", ch);
+                cksum += ch;
+            }
+            diag_printf("%02X\n", ~cksum & 0xFF);
+            off += n;
+        }
+    } else {
+        diag_dump_buf((void *)base, len);
+    }
     _base = base + len;
     _len = len;
 }
--- a/packages/redboot/current/src/net/enet.c
+++ b/packages/redboot/current/src/net/enet.c
@@ -121,7 +121,9 @@ void
     pktbuf_t *pkt;
     eth_header_t eth_hdr;
     int i, type;
+#ifdef DEBUG_PKT_EXHAUSTION
     static bool was_exhausted = false;
+#endif
 
     while (true) {
         /*
@@ -129,6 +131,7 @@ void
          * are available.
          */
         if ((pkt = __pktbuf_alloc(ETH_MAX_PKTLEN)) == NULL) {
+#ifdef DEBUG_PKT_EXHAUSTION
             if (!was_exhausted) {
                 int old = start_console();  // Force output to standard port
                 diag_printf("__enet_poll: no more buffers\n");
@@ -136,9 +139,12 @@ void
                 was_exhausted = true;
                 end_console(old);
             } 
+#endif
             return;
         }
+#ifdef DEBUG_PKT_EXHAUSTION
         was_exhausted = false;  // Report the next time we're out of buffers
+#endif
 
         if ((pkt->pkt_bytes = eth_drv_read((char *)&eth_hdr, (char *)pkt->buf,
                                            ETH_MAX_PKTLEN)) > 0) {
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -568,6 +568,12 @@ net_init(void)
                          CONFIG_IP);
     }
 #endif
+# ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG
+    // Don't override if the user has deliberately set something more
+    // verbose.
+    if (0 == cyg_io_eth_net_debug)
+        cyg_io_eth_net_debug = net_debug;
+# endif
     have_net = false;
     // Make sure the recv buffers are set up
     eth_drv_buffers_init();
--- a/packages/redboot/current/src/syscall.c
+++ b/packages/redboot/current/src/syscall.c
@@ -72,6 +72,7 @@
 #define SYS_chmod       16
 #define SYS_utime       17
 #define SYS_time        18
+#define SYS_times       20
 
 #define SYS_interrupt   1000
 #define SYS_meminfo     1001
@@ -259,7 +260,7 @@ sys_lseek(int fd,  int offset, int whenc
 #define HZ 60
 
 static int
-sys_utime(unsigned long *p)
+sys_times(unsigned long *p)
 {
     static int inited = 0;
 
@@ -313,7 +314,12 @@ CYG_ADDRWORD
         break;
 
       case SYS_utime:
-        err = sys_utime((unsigned long *)arg1);
+        // FIXME. Some libglosses depend on this behavior.
+        err = sys_times((unsigned long *)arg1);
+        break;
+
+      case SYS_times:
+        err = sys_times((unsigned long *)arg1);
         break;
 
       case SYS_meminfo:
--- a/packages/redboot/current/src/xyzModem.c
+++ b/packages/redboot/current/src/xyzModem.c
@@ -215,6 +215,7 @@ xyzModem_get_hdr(void)
                 }
             default:
                 // Ignore, waiting for start of header
+                ;
             }
         } else {
             // Data stream timed out
--- a/packages/services/compress/zlib/current/ChangeLog
+++ b/packages/services/compress/zlib/current/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-15  Gary Thomas  <gthomas@redhat.com>
+
+	* include/zconf.h: 
+	* cdl/compress_zlib.cdl: 
+	Define new interface CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC which allows
+	users of this code (applications) to provide their own allocators.
+
 2001-04-02  Jesper Skov  <jskov@redhat.com>
 
 	* tests/zlib2.c: Removed BAD_CRC state.
--- a/packages/services/compress/zlib/current/cdl/compress_zlib.cdl
+++ b/packages/services/compress/zlib/current/cdl/compress_zlib.cdl
@@ -46,13 +46,29 @@ cdl_package CYGPKG_COMPRESS_ZLIB {
                   decompression."
     include_dir   cyg/compress
 
-    requires      CYGPKG_MEMALLOC
     requires      CYGPKG_ISOINFRA
 
     compile       infblock.c infcodes.c inffast.c inflate.c
     compile       inftrees.c infutil.c adler32.c crc32.c
     compile       zutil.c deflate.c trees.c compress.c uncompr.c
 
+    cdl_interface CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC {
+        display "Override memory allocation routines."
+    }
+
+    cdl_option CYGSEM_COMPRESS_ZLIB_NEEDS_MALLOC {
+        display        "Does this library need malloc?"
+        flavor         bool
+        active_if      { CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC == 0 }
+        requires       CYGPKG_MEMALLOC
+        no_define
+        default_value  1
+        description    "
+           This pseudo-option will force the memalloc library to be
+           required iff the application does not provide it's own
+           infrastructure."
+    }
+
 
 # ====================================================================
 
--- a/packages/services/compress/zlib/current/include/zconf.h
+++ b/packages/services/compress/zlib/current/include/zconf.h
@@ -278,4 +278,11 @@ typedef uLong FAR uLongf;
 #   pragma map(inflate_trees_free,"INTRFR")
 #endif
 
+#ifdef __ECOS__
+#include <pkgconf/compress_zlib.h>
+#if CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC != 0
+#define MY_ZCALLOC
+#endif
+#endif
+
 #endif /* _ZCONF_H */
--- a/packages/services/memalloc/common/current/ChangeLog
+++ b/packages/services/memalloc/common/current/ChangeLog
@@ -1,3 +1,18 @@
+2001-10-17  Jesper Skov  <jskov@redhat.com>
+
+	* include/sepmetaimpl.inl: CYGINT_ISO_STRING_MEMFUNCS checks
+	changed to ifdef.
+
+2001-10-11  Jesper Skov  <jskov@redhat.com>
+
+	* tests/testaux.hxx (new_thread): Fixed allocation: increase
+	counter before starting threads which have been allocated
+	resources.
+
+2001-10-08  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/memalloc.cdl: Only build malloc.cxx and kapi.cxx when needed.
+
 2001-09-20  Jesper Skov  <jskov@redhat.com>
 
 	* tests/heaptest.c: Fix failure reporting.
--- a/packages/services/memalloc/common/current/cdl/memalloc.cdl
+++ b/packages/services/memalloc/common/current/cdl/memalloc.cdl
@@ -46,7 +46,7 @@ cdl_package CYGPKG_MEMALLOC {
         dynamic memory allocators, including the ISO standard malloc
         interface. It also contains some sample implementations."
     include_dir   cyg/memalloc
-    compile       dlmalloc.cxx kapi.cxx malloc.cxx memfixed.cxx memvar.cxx \
+    compile       dlmalloc.cxx memfixed.cxx memvar.cxx \
                   sepmeta.cxx
 
 # ====================================================================
@@ -205,6 +205,7 @@ cdl_package CYGPKG_MEMALLOC {
         description   "
             This option must be enabled to provide the extensions required
             to support integration into the kernel C API."
+        compile       kapi.cxx
     }       
 
     cdl_option CYGSEM_MEMALLOC_MALLOC_ZERO_RETURNS_NULL {
@@ -224,6 +225,7 @@ cdl_package CYGPKG_MEMALLOC {
         implements    CYGINT_ISO_MALLOC
         implements    CYGINT_ISO_MALLINFO
         default_value 1
+        compile       malloc.cxx
         description   "
             This component enables support for dynamic memory
             allocation as supplied by the functions malloc(),
--- a/packages/services/memalloc/common/current/include/sepmetaimpl.inl
+++ b/packages/services/memalloc/common/current/include/sepmetaimpl.inl
@@ -65,7 +65,7 @@
 // list has the same structure but its memnext/memprev fields are zero.
 // Always having at least one item on the list simplifies the alloc and
 // free code.
-#if CYGINT_ISO_STRING_MEMFUNCS
+#ifdef CYGINT_ISO_STRING_MEMFUNCS
 # include <string.h>
 #endif
 
@@ -74,7 +74,7 @@ Cyg_Mempool_Sepmeta_Implementation::copy
                                                cyg_uint8 *src, 
                                                cyg_int32 nbytes )
 {
-#if CYGINT_ISO_STRING_MEMFUNCS
+#ifdef CYGINT_ISO_STRING_MEMFUNCS
     memmove( dst, src, nbytes );
 #else
     if ((src < dst) && (dst < (src + nbytes))) {
--- a/packages/services/memalloc/common/current/tests/testaux.hxx
+++ b/packages/services/memalloc/common/current/tests/testaux.hxx
@@ -74,22 +74,24 @@ static CYG_ALIGNMENT_TYPE stack[NTHREADS
    (STACKSIZE+sizeof(CYG_ALIGNMENT_TYPE)-1)
      / sizeof(CYG_ALIGNMENT_TYPE)                     ];
 
-static int nthreads = 0;
+static volatile int nthreads = 0;
 
-static Cyg_Thread *new_thread(cyg_thread_entry *entry, CYG_ADDRWORD data) {
+static Cyg_Thread *new_thread(cyg_thread_entry *entry, CYG_ADDRWORD data)
+{
+    int _nthreads = nthreads++;
 
-    CYG_ASSERT(nthreads < NTHREADS, 
+    CYG_ASSERT(_nthreads < NTHREADS, 
                "Attempt to create more than NTHREADS threads");
 
-    thread[nthreads] = new( (void *)&thread_obj[nthreads] )
+    thread[_nthreads] = new( (void *)&thread_obj[_nthreads] )
         Cyg_Thread(CYG_SCHED_DEFAULT_INFO,
                    entry, data, 
                    NULL,                // no name
-                   (CYG_ADDRESS)stack[nthreads], STACKSIZE );
+                   (CYG_ADDRESS)stack[_nthreads], STACKSIZE );
 
-    thread[nthreads]->resume();
+    thread[_nthreads]->resume();
 
-    return thread[nthreads++];
+    return thread[_nthreads];
 }
 #endif // defined(NTHREADS)