Index: c/src/lib/libbsp/i386/force386/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i386/force386/include/bsp.h	(revision 3b170f53b369112b9944e631a504dff06184fe69)
+++ c/src/lib/libbsp/i386/force386/include/bsp.h	(revision 9e738b65b00b793d21a2c7d8322f3d82010207ec)
@@ -41,5 +41,5 @@
  */
 
-#define MUST_WAIT_FOR_INTERRUTPT 0
+#define MUST_WAIT_FOR_INTERRUPT 0
 
 #define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 )
Index: c/src/lib/libbsp/i386/go32/include/bsp.h
===================================================================
--- c/src/lib/libbsp/i386/go32/include/bsp.h	(revision 3b170f53b369112b9944e631a504dff06184fe69)
+++ c/src/lib/libbsp/i386/go32/include/bsp.h	(revision 9e738b65b00b793d21a2c7d8322f3d82010207ec)
@@ -39,12 +39,11 @@
  *  Define the interrupt mechanism for Time Test 27
  *
- *  NOTE: Use a software interrupt for the i386.
+ *  NOTE:  Use a software interrupt for the i386 family.
  */
-#define MUST_WAIT_FOR_INTERRUTPT 0
+#define MUST_WAIT_FOR_INTERRUPT 0
 #define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 )
 #define Cause_tm27_intr()              asm volatile( "int $0x90" : : );
 #define Clear_tm27_intr()
 #define Lower_tm27_intr()
-
 
 /*
@@ -106,4 +105,9 @@
 #define         TIMER_BCD       0x01    /* count in BCD */
 
+#define CLOCK_DISABLE()	\
+    ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask | 1 ); })
+#define	CLOCK_ENABLE()	\
+    ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask & ~1); })
+
 /*	The internal tick rate in ticks per second */
 #define		TIMER_TICK	1193182
@@ -155,2 +159,3 @@
 /* end of include file */
 
+
Index: c/src/lib/libbsp/i386/go32/startup/setvec.c
===================================================================
--- c/src/lib/libbsp/i386/go32/startup/setvec.c	(revision 3b170f53b369112b9944e631a504dff06184fe69)
+++ c/src/lib/libbsp/i386/go32/startup/setvec.c	(revision 9e738b65b00b793d21a2c7d8322f3d82010207ec)
@@ -38,28 +38,7 @@
 
   if ( type )  {
-      rtems_interrupt_catch( handler, vector, 
-			     (rtems_isr_entry *) &previous_isr );
+     rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr);
   } else {
-      /* Interrupt goes straight to the supplied ISR.  This code is	*/
-      /* slightly different than that in _CPU_ISR_install_vector	*/
-      /* (which is eventually called by the above) in that this code	*/
-      /* returns the raw entry point as the old handler, while the	*/
-      /* other version returns the old entry point pointed at by the	*/
-      /* rtems ISR table.						*/
-      _go32_dpmi_seginfo	handler_info;
-
-      /* get the address of the old handler */
-      _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info);
-
-      /* Notice how we're failing to save the pm_segment portion of the	*/
-      /* structure here?  That means we might crash the system if we	*/
-      /* try to restore the ISR.  Can't fix this until i386_isr	is	*/
-      /* redefined.  XXX [BHC].						*/
-      previous_isr = (i386_isr_entry) handler_info.pm_offset;
-     
-      /* install the IDT entry */
-      handler_info.pm_offset   = (u_long)handler;
-      handler_info.pm_selector = _go32_my_cs();
-      _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info);
+     _CPU_ISR_install_raw_handler( vector, handler, (proc_ptr *)&previous_isr);
   }
   return previous_isr;
Index: c/src/lib/libbsp/i386/go32/timer/timer.c
===================================================================
--- c/src/lib/libbsp/i386/go32/timer/timer.c	(revision 3b170f53b369112b9944e631a504dff06184fe69)
+++ c/src/lib/libbsp/i386/go32/timer/timer.c	(revision 9e738b65b00b793d21a2c7d8322f3d82010207ec)
@@ -21,5 +21,4 @@
  */
 
-
 #include <rtems.h>
 #include <bsp.h>
@@ -36,4 +35,8 @@
     return result;
 }
+static void restore_timer( void )
+{
+    CLOCK_ENABLE();
+}
 #else /* pentium */
 rtems_isr timerisr();
@@ -42,25 +45,42 @@
 void Timer_initialize()
 {
+    static int First = 1;
 #if defined(pentium)
+    if ( First )  {
+        extern int atexit( void (*)(void) );
+        First = 0;
+        /* Disable the programmable timer. */
+        CLOCK_DISABLE();
+        /* Try not to hose the system on return to DOS. */
+        atexit( restore_timer );
+    }
     Ttimer_val = rdtsc();
 #else /* pentium */
-    static int First = 1;
+
+#define WAIT() \
+  { \
+    Ttimer_val = 0; \
+    while ( Ttimer_val == 0 ) \
+      continue; \
+    Ttimer_val = 0; \
+  }
+
     if ( First )  {
+        First = 0;
+
         /* install ISR */
         set_vector( timerisr, 0x8, 0 );
 
-        /* Wait for ISR to be called at least once */
-        Ttimer_val = 0;
-        while ( Ttimer_val == 0 )
-            continue;
+       /* Wait for ISR to be called at least once */
+       WAIT();
 
-        /* load timer for 250 microsecond period */
-        outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
-        outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 0 & 0xff);
-        outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 8 & 0xff);
+       /* load timer for 250 microsecond period */
+       outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN );
+       outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 0 & 0xff);
+       outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 8 & 0xff);
+    }
 
-        First = 0;
-    }
-    Ttimer_val = 0;                           /* clear timer ISR count */
+    /* Wait for ISR to be called at least once */
+    WAIT();
 #endif /* PENTIUM */
 }
@@ -82,5 +102,5 @@
     inport_byte( TIMER_CNTR0, msb );
     clicks = msb << 8 | lsb;
-    total = Ttimer_val + 250 - TICK_TO_US( clicks );
+    total = Ttimer_val + (250 - TICK_TO_US( clicks ));
 #endif /* pentium */
 
@@ -105,2 +125,3 @@
   Timer_driver_Find_average_overhead = find_flag;
 }
+
Index: c/src/lib/libbsp/i386/go32/timer/timerisr.s
===================================================================
--- c/src/lib/libbsp/i386/go32/timer/timerisr.s	(revision 3b170f53b369112b9944e631a504dff06184fe69)
+++ c/src/lib/libbsp/i386/go32/timer/timerisr.s	(revision 9e738b65b00b793d21a2c7d8322f3d82010207ec)
@@ -27,14 +27,14 @@
         PUBLIC(timerisr)
 
-SYM (timerisr):	
- 	addl    $250,_Ttimer_val   # another 250 microseconds
-	push	edx
-	push	eax
-	movw	$0x20,dx
-	mov	edx,eax
-	outb	al,(dx)	# touch interrupt controller
-	pop	eax
-	pop	edx
- 	iret
+SYM (timerisr): 
+        addl    $250,_Ttimer_val   # another 250 microseconds
+        push    edx
+        push    eax
+        movw    $0x20,dx
+        mov     edx,eax
+        outb    al,(dx) # touch interrupt controller
+        pop     eax
+        pop     edx
+        iret
 
 END_CODE
