changeset 48:1370c5e55234 ecos-sw-1999-10-25

Merge from eCos master repository on 1999-10-25-21:18:27-BST
author jlarmour
date Mon, 25 Oct 1999 20:48:32 +0000
parents dda182546c3f
children 698ff3191b93
files packages/devs/watchdog/current/include/pkgconf/watchdog.h packages/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/include/hal_arch.h packages/hal/arm/cma230/current/ChangeLog packages/hal/arm/cma230/current/include/hal_cma230.h packages/hal/arm/cma230/current/misc/gdb_module.c packages/hal/arm/cma230/current/src/PKGconf.mak packages/hal/arm/pid/current/ChangeLog packages/hal/arm/pid/current/misc/PKGconf.mak packages/hal/arm/pid/current/misc/STUBS_config packages/hal/arm/pid/current/misc/prog_flash.c packages/hal/arm/pid/current/src/hal_diag.c packages/hal/common/current/ChangeLog packages/hal/common/current/include/hal_stub.h packages/hal/common/current/src/generic-stub.c packages/hal/common/current/src/hal_stub.c packages/hal/i386/arch/current/ChangeLog packages/hal/i386/arch/current/src/i386.ld packages/hal/mips/arch/current/ChangeLog packages/hal/mips/arch/current/include/arch.inc packages/hal/mips/arch/current/src/vectors.S packages/hal/powerpc/mbx/current/ChangeLog packages/hal/powerpc/mbx/current/src/hal_diag.c packages/io/serial/current/ChangeLog packages/io/serial/current/src/arm/cl7211_serial.c packages/io/serial/current/src/arm/pid_serial.h packages/io/serial/current/src/arm/pid_serial_with_ints.c packages/packages
diffstat 28 files changed, 287 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/watchdog/current/include/pkgconf/watchdog.h
+++ b/packages/devs/watchdog/current/include/pkgconf/watchdog.h
@@ -83,6 +83,7 @@
 #endif
 
 
+
 /* -------------------------------------------------------------------- */
 #endif  /* CYGONCE_PKGCONF_WATCHDOG_H */
 /* EOF watchdog.h */
--- a/packages/hal/arm/arch/current/ChangeLog
+++ b/packages/hal/arm/arch/current/ChangeLog
@@ -1,3 +1,14 @@
+1999-10-22  Hugo Tyson  <hmt@cygnus.co.uk>
+
+	* src/arm_stub.c (cyg_hal_gdb_running_step):
+	(cyg_hal_gdb_break_is_set): Provide dummies for these two for now.
+	See changelog for hal/common/ hal_stub and generic_stub for info.
+
+1999-10-21  Jonathan Larmour  <jlarmour@cygnus.co.uk>
+
+	* include/hal_arch.h: Tidy a bit so the breakpoint instruction is only
+	defined in one place
+
 1999-10-14  Jesper Skov  <jskov@cygnus.co.uk>
         From James Ingham <jingham@cygnus.com>:
 	* src/PKGconf.mak: Make sed invocation Solaris safe.
--- a/packages/hal/arm/arch/current/include/hal_arch.h
+++ b/packages/hal/arm/arch/current/include/hal_arch.h
@@ -171,15 +171,21 @@ externC void hal_thread_load_context( CY
 // HAL_BREAKINST is the value of the breakpoint instruction and 
 // HAL_BREAKINST_SIZE is its size in bytes.
 
-#define HAL_BREAKPOINT(_label_)                \
-asm volatile (" .globl  " #_label_ ";"         \
-              #_label_":"                      \
-              " .word 0xE7FFDEFE"              \
+#define _stringify1(__arg) #__arg
+#define _stringify(__arg) _stringify1(__arg)
+
+#define HAL_BREAKINST_ARM          0xE7FFDEFE
+#define HAL_BREAKINST_ARM_SIZE     4
+
+#define HAL_BREAKPOINT(_label_)                   \
+asm volatile (" .globl  " #_label_ ";"            \
+              #_label_":"                         \
+              " .word " _stringify(HAL_BREAKINST_ARM) \
     );
 
 //#define HAL_BREAKINST           {0xFE, 0xDE, 0xFF, 0xE7}
-#define HAL_BREAKINST           0xE7FFDEFE
-#define HAL_BREAKINST_SIZE      4
+#define HAL_BREAKINST            HAL_BREAKINST_ARM
+#define HAL_BREAKINST_SIZE       HAL_BREAKINST_ARM_SIZE
 
 //--------------------------------------------------------------------------
 // Thread register state manipulation for GDB support.
--- a/packages/hal/arm/cma230/current/ChangeLog
+++ b/packages/hal/arm/cma230/current/ChangeLog
@@ -1,3 +1,11 @@
+
+1999-10-19  Jonathan Larmour  <jlarmour@cygnus.co.uk>
+
+	* include/hal_cma230.h: Fix ifdefs and comments to be for
+	the cma230, not any other board
+	* misc/gdb_module.c: Likewise
+	* src/PKGconf.mak: Likewise
+
 1999-10-14  Jesper Skov  <jskov@cygnus.co.uk>
 
 	* misc/STUBS_config: Updated.
--- a/packages/hal/arm/cma230/current/include/hal_cma230.h
+++ b/packages/hal/arm/cma230/current/include/hal_cma230.h
@@ -1,9 +1,9 @@
-#ifndef CYGONCE_HAL_CL7211_H
-#define CYGONCE_HAL_CL7211_H
+#ifndef CYGONCE_HAL_CMA230_H
+#define CYGONCE_HAL_CMA230_H
 
 /*=============================================================================
 //
-//      hal_cl7211.h
+//      hal_cma230.h
 //
 //      HAL Support for Kernel Diagnostic Routines
 //
--- a/packages/hal/arm/cma230/current/misc/gdb_module.c
+++ b/packages/hal/arm/cma230/current/misc/gdb_module.c
@@ -2,7 +2,7 @@
 //
 //        gdb_module.c
 //
-//        Cirrus CL7211 eval board GDB stubs (module wrapper)
+//        Cogent CMA230 board GDB stubs (module wrapper)
 //
 //==========================================================================
 //####COPYRIGHTBEGIN####
@@ -32,7 +32,7 @@
 // Author(s):     gthomas
 // Contributors:  gthomas
 // Date:          1999-05-11
-// Description:   Cirrus CL7211 FLASH module for eCos GDB stubs
+// Description:   Cirrus CMA230 module for eCos GDB stubs
 //####DESCRIPTIONEND####
 
 //
--- a/packages/hal/arm/cma230/current/src/PKGconf.mak
+++ b/packages/hal/arm/cma230/current/src/PKGconf.mak
@@ -2,7 +2,7 @@
 #
 #    makefile
 #
-#    hal/arm/cl7211/src
+#    hal/arm/cma230/src
 #
 #==============================================================================
 #####COPYRIGHTBEGIN####
--- a/packages/hal/arm/pid/current/ChangeLog
+++ b/packages/hal/arm/pid/current/ChangeLog
@@ -1,3 +1,10 @@
+1999-10-25  Jesper Skov  <jskov@cygnus.co.uk>
+
+	* misc/STUBS_config: Updated.
+	* src/hal_diag.c (hal_diag_led): Added LED diag.
+	* misc/prog_flash.c: Fixed compiler warning.
+
+	
 1999-10-19  Jesper Skov  <jskov@cygnus.co.uk>
 
 	* include/pkgconf/hal_arm_pid.h: Added ARM9 options.
--- a/packages/hal/arm/pid/current/misc/PKGconf.mak
+++ b/packages/hal/arm/pid/current/misc/PKGconf.mak
@@ -51,5 +51,3 @@ gdb_module.img: gdb_module.stamp
 	$(RM) -f gdb_module.img.XX
 endif
 
-
-
--- a/packages/hal/arm/pid/current/misc/STUBS_config
+++ b/packages/hal/arm/pid/current/misc/STUBS_config
@@ -12,9 +12,18 @@ tcl $1/pkgconf.tcl                      
    --disable CYGPKG_DEVICES_WATCHDOG
 
 patch <<END_OF_PATCH -p0
---- pkgconf/hal.h~      Thu Jul  8 08:26:44 1999
-+++ pkgconf/hal.h       Wed Jul 28 10:51:07 1999
-@@ -369,10 +369,10 @@
+--- pkgconf/hal.h.orig  Fri Oct 22 09:32:14 1999
++++ pkgconf/hal.h       Mon Oct 25 09:15:33 1999
+@@ -110,7 +110,7 @@
+  }
+ 
+  }}CFG_DATA */
+-#define CYGFUN_HAL_COMMON_KERNEL_SUPPORT
++#undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
+ 
+ /* {{CFG_DATA
+    
+@@ -382,10 +382,10 @@
  
     }}CFG_DATA */
  
--- a/packages/hal/arm/pid/current/misc/prog_flash.c
+++ b/packages/hal/arm/pid/current/misc/prog_flash.c
@@ -62,6 +62,8 @@ void write_sector(int, char *);
 char *flash_buffer = (char *)0x60000;
 char *flash_buffer_end = (char *)0x64000;
 
+#define BUF(x) buf[x]
+
 // FUNCTIONS
 
 externC void
@@ -89,6 +91,7 @@ main( int argc, char *argv[] )
     cyg_thread_delay(5*100);
     diag_printf("\n");
     diag_printf("...Programming FLASH\n");
+
     i = 0;
     while (flash_buffer < flash_buffer_end) {
         write_sector(i++, flash_buffer);
@@ -171,7 +174,7 @@ void
 write_sector(int num, char *buf)
 {
     int i, cnt;
-    volatile char *wrt = (volatile int *)&FLASH[num*sector_size];
+    volatile char *wrt = (volatile char *)&FLASH[num*sector_size];
 
 //    diag_printf("Writing to %08x\n", wrt);
     // Enter Program Mode
@@ -181,26 +184,25 @@ write_sector(int num, char *buf)
 
     // Note: write bytes as longs regardless of bus width
     for (i = 0;  i < sector_size;  i++) {
-        wrt[i] = buf[i];
+        wrt[i] = BUF(i);
     }
 
     // Wait for sector to program
     cnt = 0;
     i = sector_size - 1;
-    while (wrt[i] != buf[i]) {
+    while (wrt[i] != BUF(i)) {
         if (cnt++ > 0x01000000) break;
     }
-//    diag_printf("Out - i: %d, wrt[i] = %08X.%08X, buf[i] = %08X, count = %x\n", i, &wrt[i], wrt[i], buf[i], cnt);
+//    diag_printf("Out - i: %d, wrt[i] = %08X.%08X, BUF(i) = %08X, count = %x\n", i, &wrt[i], wrt[i], BUF(i), cnt);
 
     // Verify
     for (i = 0;  i < sector_size;  i++) {
         for (cnt = 0;  cnt < 10;  cnt++) {
-            if (*wrt == *buf) break;
+            if (wrt[i] == BUF(i)) break;
             cyg_thread_delay(1);
         }
         if (cnt == 10) {
-            diag_printf("Can't program at 0x%08X: %02X not %02X\n", wrt, *wrt, *buf);
+            diag_printf("Can't program at 0x%08X: %02X not %02X\n", wrt, *wrt, BUF(0));
         }
-        wrt++;  buf++;
     }
 }
--- a/packages/hal/arm/pid/current/src/hal_diag.c
+++ b/packages/hal/arm/pid/current/src/hal_diag.c
@@ -346,4 +346,17 @@ hal_diag_write_char(char c)
 #endif
 
 /*---------------------------------------------------------------------------*/
+
+// Control the LEDs PP0-PP3. this requires the jumpers on pins 1-8 to
+// be set on LK11, thus preventing the use of the parallel port.
+
+#define CYG_DEVICE_PARALLEL_DATA 0x0d800040
+
+void
+hal_diag_led(int n)
+{
+    HAL_WRITE_UINT8(CYG_DEVICE_PARALLEL_DATA, (n & 0xf) << 4);
+}
+
+/*---------------------------------------------------------------------------*/
 /* End of hal_diag.c */
--- a/packages/hal/common/current/ChangeLog
+++ b/packages/hal/common/current/ChangeLog
@@ -1,3 +1,32 @@
+1999-10-22  Hugo Tyson  <hmt@cygnus.co.uk>
+
+	* include/hal_stub.h (CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION):
+	(CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION): new macros to be invoked
+	in hal_diag routines to make atomic the code that outputs a
+	complete GDB $O packet.  This is required so that watching
+	variables (which is implemented by stepping) and stepping itself
+	does not try to ss through that $O output code.  CASE 102327.
+
+	* src/hal_stub.c (cyg_hal_gdb_break_is_set): new routine to query
+	whether a break is set: used by step in the stubs to decide to
+	continue instead, because we are in a critical region.
+	(cyg_hal_gdb_running_step): communication between generic stub and
+	here: if set, a step has been converted into a continue, so we do
+	NOT obey cyg_hal_gdb_remove_break until it is cleared, in
+	handle_exception_cleanup().
+
+	* src/generic-stub.c (__process_packet): If there is a break set
+	by the hal_stub.c, convert a step to continue, and set
+	cyg_hal_gdb_running_step to say we did so.
+
+1999-10-22  Jesper Skov  <jskov@cygnus.co.uk>
+        Case 102379
+	* src/generic-stub.c (__handle_exception): Flush and clear caches
+	after cleaning up after single-stepping.
+
+	(memcpy, memset): Added to prevent stub hanging if user puts
+	breakpoints in either function.
+
 1999-10-10  Gary Thomas  <gthomas@cygnus.co.uk>
 
 	* src/thread-packets.c (stub_pkt_currthread): Fix typo in comment.
--- a/packages/hal/common/current/include/hal_stub.h
+++ b/packages/hal/common/current/include/hal_stub.h
@@ -60,6 +60,9 @@ typedef cyg_uint32 uint32;
 #ifdef __cplusplus
 extern "C" {
 #endif
+#if 0
+} // to make below format correctly.
+#endif
 
 //-----------------------------------------------------------------------------
 // Definitions for generic-stub.c
@@ -150,6 +153,40 @@ extern unsigned long __break_opcode (voi
 #ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
 extern void cyg_hal_gdb_interrupt    (target_register_t pc);
 extern int  cyg_hal_gdb_remove_break (target_register_t pc);
+extern int  cyg_hal_gdb_break_is_set (void);
+
+/* This is used so that the generic stub can tell
+ * cyg_hal_gdb_remove_break() not to bother when we are avoiding stepping
+ * through a critical region ie. hal_diag_write_char() usually - that
+ * shares the GDB IO device.
+ */
+extern volatile int cyg_hal_gdb_running_step;
+
+// Use these in hal_diag.c when about to write a whole $O packet to GDB.
+// NB they require __builtin_return_address() to work: if your platform
+// does not support this, use HAL_DISABLE_INTERRUPTS &c instead.
+
+#define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ )                           \
+do {                                                                            \
+    HAL_DISABLE_INTERRUPTS(_old_);                                              \
+    cyg_hal_gdb_interrupt((target_register_t)__builtin_return_address(0));      \
+} while ( 0 )
+
+#define CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION( _old_ )                           \
+do {                                                                            \
+    cyg_hal_gdb_remove_break((target_register_t)__builtin_return_address(0));   \
+    HAL_RESTORE_INTERRUPTS(_old_);                                              \
+} while ( 0 )
+
+#else // NO debug_gdb_break_support
+
+// so define these just to do interrupts:
+#define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ )   \
+    HAL_DISABLE_INTERRUPTS(_old_)
+
+#define CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION( _old_ )   \
+    HAL_RESTORE_INTERRUPTS(_old_)
+
 #endif
 
 //----------------------------------------------------------------------------
--- a/packages/hal/common/current/src/generic-stub.c
+++ b/packages/hal/common/current/src/generic-stub.c
@@ -103,7 +103,35 @@ static uint32 crc32 (unsigned char *ptr,
  *
  ****************************************************************************/
 
-#ifndef __ECOS__
+#ifdef __ECOS__
+
+// 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)
+{
+    unsigned char* __d = (unsigned char*) dest;
+    unsigned char* __s = (unsigned char*) src;
+    
+    while(size--)
+        *__d++ = *__s++;
+
+    return dest;
+}
+
+static inline void*
+memset(void* s, int c, int size)
+{
+    unsigned char* __s = (unsigned char*) s;
+    unsigned char __c = (unsigned char) c;
+    
+    while(size--)
+        *__s++ = __c;
+
+    return s;
+}
+
+#else
 #include <string.h>
 #include <signal.h>
 #endif // __ECOS__
@@ -776,6 +804,15 @@ void
   unlock_thread_scheduler ();
   __clear_single_step ();
 
+#ifdef __ECOS__
+      /* Need to flush the data and instruction cache here, as we may have
+         removed a breakpoint in __single_step - and we may be sharing
+         some code with the application! */
+
+        __data_cache (CACHE_FLUSH) ;
+        __instruction_cache (CACHE_FLUSH) ;
+#endif
+
 #ifdef SIGSYSCALL
   if (sigval == SIGSYSCALL)
     {
@@ -1131,6 +1168,17 @@ int
             return 0;
           }
 
+#ifdef __ECOS__
+        // CASE 102327 - watchpoints fight with output, so do not step
+        // through $O packet output routines.
+#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
+        if ( cyg_hal_gdb_break_is_set() ) {
+            packet[0] = 'c'; // Force it to be a "continue" instead of step.
+            cyg_hal_gdb_running_step = 1; // And tell the hal_stub...
+        }
+#endif
+#endif
+
         /* Set machine state to force a single step.  */
         if (packet[0] == 's' || packet[0] == 'S')
           {
--- a/packages/hal/common/current/src/hal_stub.c
+++ b/packages/hal/common/current/src/hal_stub.c
@@ -136,9 +136,14 @@ typedef struct
 
 static instrBuffer break_buffer;
 
+volatile int cyg_hal_gdb_running_step = 0;
+
 void 
 cyg_hal_gdb_interrupt (target_register_t pc)
 {
+    // Clear this regardless
+    cyg_hal_gdb_running_step = 0;
+    // so that a call to set a BP because of a ^C will take effect
     if (NULL == break_buffer.targetAddr) {
         break_buffer.targetAddr = (t_inst*) pc;
         break_buffer.savedInstr = *(t_inst*)pc;
@@ -152,6 +157,9 @@ cyg_hal_gdb_interrupt (target_register_t
 int 
 cyg_hal_gdb_remove_break (target_register_t pc)
 {
+    if ( cyg_hal_gdb_running_step )
+        return 0;
+
     if ((t_inst*)pc == break_buffer.targetAddr) {
         *(t_inst*)pc = break_buffer.savedInstr;
         break_buffer.targetAddr = NULL;
@@ -163,6 +171,15 @@ cyg_hal_gdb_remove_break (target_registe
     return 0;
 }
 
+int 
+cyg_hal_gdb_break_is_set (void)
+{
+    if (NULL != break_buffer.targetAddr) {
+        return 1;
+    }
+    return 0;
+}
+
 
 #endif // CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
 
@@ -222,6 +239,14 @@ handle_exception_cleanup( void )
 #endif
 
 #ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
+    // If we continued instead of stepping, when there was a break set
+    // ie. we were stepping within a critical region, clear the break, and
+    // that flag.  If we stopped for some other reason, this has no effect.
+    if ( cyg_hal_gdb_running_step ) {
+        cyg_hal_gdb_running_step = 0;
+        cyg_hal_gdb_remove_break(get_register (PC));
+    }
+
     // FIXME: (there may be a better way to do this)
     // If we hit a breakpoint set by the gdb interrupt stub, make it
     // seem like an interrupt rather than having hit a breakpoint.
--- a/packages/hal/i386/arch/current/ChangeLog
+++ b/packages/hal/i386/arch/current/ChangeLog
@@ -1,3 +1,8 @@
+1999-10-25  Jonathan Larmour  <jlarmour@cygnus.co.uk>
+
+	* src/i386.ld: Add asterisks to input section names to make them more
+	tolerant of subtle differences
+
 1999-10-05  Jesper Skov  <jskov@cygnus.co.uk>
         From Andrew Lunn (lunn@ma.tech.ascom.ch)
 	* include/hal_arch.h (HAL_IDLE_THREAD_ACTION): Defined.
--- a/packages/hal/i386/arch/current/src/i386.ld
+++ b/packages/hal/i386/arch/current/src/i386.ld
@@ -115,7 +115,7 @@ GROUP(libtarget.a libgcc.a)
       /* We want the small data sections together, so single-instruction */ \
       /* offsets can access them all, and initialized data all before    */ \
       /* uninitialized, so we can shorten the on-disk segment size.      */ \
-    _SDATA_START_ = ABSOLUTE(.); *(.sdata) }                                \
+    _SDATA_START_ = ABSOLUTE(.); *(.sdata*) }                                \
     > _region_                                                              \
     __rom_data_start = LOADADDR(.data);                                     \
     __ram_data_end = .; PROVIDE(__ram_data_end = .);                        \
@@ -124,13 +124,13 @@ GROUP(libtarget.a libgcc.a)
 #define SECTION_sbss(_region_, _vma_, _lma_)                   \
     .sbss _vma_ : _lma_                                                       \
     { __bss_start = ABSOLUTE (.);       \
-    _SBSS_START_ = ABSOLUTE(.); *(.sbss) _SBSS_END_ = ABSOLUTE(.);      \
-    *(.scommon) }                                                       \
+    _SBSS_START_ = ABSOLUTE(.); *(.sbss*) _SBSS_END_ = ABSOLUTE(.);      \
+    *(.scommon*) }                                                       \
     > _region_
 
 #define SECTION_bss(_region_, _vma_, _lma_)                      \
     .bss _vma_ : _lma_                                                          \
-    { FORCE_OUTPUT; *(.dynbss) *(.bss) *(COMMON) }      \
+    { FORCE_OUTPUT; *(.dynbss*) *(.bss*) *(COMMON) }      \
     > _region_
 
 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
--- a/packages/hal/mips/arch/current/ChangeLog
+++ b/packages/hal/mips/arch/current/ChangeLog
@@ -1,3 +1,12 @@
+1999-10-22  Nick Garnett  <nickg@cygnus.co.uk>
+
+	* src/vectors.S: Replaced ifdef with call to hal_intc_translate
+	macro so the behaviour here may be customized by variant or
+	platform HALs.
+
+	* include/arch.inc: Added default implementations of
+	hal_intc_translate macro.
+
 1999-10-05  Nick Garnett  <nickg@cygnus.co.uk>
 
 	* include/basetype.h: Made definition of CYG_BYTEORDER dependent
--- a/packages/hal/mips/arch/current/include/arch.inc
+++ b/packages/hal/mips/arch/current/include/arch.inc
@@ -295,6 +295,18 @@
 	lb	\vnum,0(v0)		# pick up vector number
 	.endm
 
+#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED
+#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
+	.macro	hal_intc_translate inum,vnum
+	move	\vnum,zero			# Just vector zero is supported
+	.endm
+#else			
+	.macro	hal_intc_translate inum,vnum
+	move	\vnum,\inum			# Vector == interrupt number
+	.endm
+#endif
+#endif
+
 	.macro	hal_intc_decode_data
 hal_intc_translation_table:	
 	.byte	0, 0, 1, 0
--- a/packages/hal/mips/arch/current/src/vectors.S
+++ b/packages/hal/mips/arch/current/src/vectors.S
@@ -500,13 +500,13 @@ 8:
 	# Decode external interrupt via interrupt controller
 
 	hal_intc_decode	s2
+
+	# Here, s2 contains the number of the interrupt being serviced,
+	# we need to derive from that the vector number to call in the ISR
+	# table.
 	
-#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
-	move	s1,zero				# Just vector zero is supported
-#else			
-	move	s1,s2				# Vector == interrupt number
-#endif
-
+	hal_intc_translate s2,s1
+	
 	# Here s1 is the number of the vector to be called and s2 is
 	# the number of the interrupt being serviced. 
 
@@ -519,7 +519,7 @@ 8:
 	li	a0,0x0301			# a0 = type = INTR,RAISE
 	move	a1,s1				# a1 = vector number
 	jal	cyg_instrument			# call instrument function
-	xor	a2,a2,a2			# arg2 = 0 (delay slot)
+	 move	a2,s2				# a2 = interrupt number
 #endif
 
 #if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
--- a/packages/hal/powerpc/mbx/current/ChangeLog
+++ b/packages/hal/powerpc/mbx/current/ChangeLog
@@ -1,3 +1,11 @@
+1999-10-22  Hugo Tyson  <hmt@cygnus.co.uk>
+
+	* src/hal_diag.c (hal_diag_write_char): Call new hal_stub.h macro
+	CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION() instead of simply disabling
+	interrupts, ditto for enable.  This provides atomicity wrt single
+	stepping and watching variables when this code to output a whole
+	GDB $O packet is entered.
+
 1999-09-20  Hugo Tyson  <hmt@cygnus.co.uk>
 
 	* include/pkgconf/hal_powerpc_mbx.h:
--- a/packages/hal/powerpc/mbx/current/src/hal_diag.c
+++ b/packages/hal/powerpc/mbx/current/src/hal_diag.c
@@ -161,7 +161,11 @@ void hal_diag_write_char(char c)
         // receive interrupt will be seen when we re-enable interrupts
         // later.
         
+#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+        CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old);
+#else
         HAL_DISABLE_INTERRUPTS(old);
+#endif
         
         while(1)
         {
@@ -213,7 +217,11 @@ void hal_diag_write_char(char c)
         pos = 0;
 
         // And re-enable interrupts
+#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+        CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old);
+#else
         HAL_RESTORE_INTERRUPTS(old);
+#endif
         
     }
 }
--- a/packages/io/serial/current/ChangeLog
+++ b/packages/io/serial/current/ChangeLog
@@ -1,3 +1,14 @@
+1999-10-25  Gary Thomas  <gthomas@cygnus.co.uk>
+
+	* src/arm/pid_serial.h (ISR_RxTO): Define - character received but
+	not handled "promptly".
+
+	* src/arm/pid_serial_with_ints.c (pid_serial_DSR): Handle rcv interrupts
+	properly (can't ignore them even with TO bit set).
+
+	* src/arm/cl7211_serial.c (cl7211_serial_rx_DSR): Need to handle all
+	input (empty input FIFO) otherwise characters get dropped.
+
 1999-10-15  Jesper Skov  <jskov@cygnus.co.uk>
 
 	* tests/ser_test_protocol.inl: Removed AEB rev C change. Was bogus.
--- a/packages/io/serial/current/src/arm/cl7211_serial.c
+++ b/packages/io/serial/current/src/arm/cl7211_serial.c
@@ -356,7 +356,7 @@ cl7211_serial_rx_DSR(cyg_vector_t vector
     cl7211_serial_info *cl7211_chan = (cl7211_serial_info *)chan->dev_priv;
     volatile cyg_uint32 *datreg = (volatile cyg_uint32 *)cl7211_chan->data;
     volatile cyg_uint32 *stat = (volatile cyg_uint32 *)cl7211_chan->stat;
-    if (!(*stat & SYSFLG1_URXFE1))
+    while (!(*stat & SYSFLG1_URXFE1))
         (chan->callbacks->rcv_char)(chan, *datreg);
     cyg_drv_interrupt_unmask(cl7211_chan->rx_int_num);
 }
--- a/packages/io/serial/current/src/arm/pid_serial.h
+++ b/packages/io/serial/current/src/arm/pid_serial.h
@@ -99,6 +99,7 @@ struct serial_port {
 // Interrupt status register
 #define ISR_Tx  0x02
 #define ISR_Rx  0x04
+#define ISR_RxTO  0x0C
 
 static unsigned char select_word_length[] = {
     LCR_WL5,    // 5 bits / word (char)
--- a/packages/io/serial/current/src/arm/pid_serial_with_ints.c
+++ b/packages/io/serial/current/src/arm/pid_serial_with_ints.c
@@ -305,6 +305,8 @@ pid_serial_DSR(cyg_vector_t vector, cyg_
     isr = port->isr & 0x0E;
     if (isr == ISR_Tx) {
         (chan->callbacks->xmt_char)(chan);
+    } else if (isr == ISR_RxTO) {
+        (chan->callbacks->rcv_char)(chan, port->rhr);
     } else if (isr == ISR_Rx) {
         (chan->callbacks->rcv_char)(chan, port->rhr);
     }
--- a/packages/packages
+++ b/packages/packages
@@ -317,4 +317,3 @@ package CYGPKG_DEVICES_WATCHDOG {
 	default_value	1
 	include_dir	cyg/devs
 }
-