Index: c/src/lib/libbsp/i386/ChangeLog
===================================================================
--- c/src/lib/libbsp/i386/ChangeLog	(revision bd51a636de805e88028a08791b4b4dff91cf4d71)
+++ c/src/lib/libbsp/i386/ChangeLog	(revision c83c3254d417d29e2d6809ebd3e6832105505da0)
@@ -1,2 +1,14 @@
+2007-09-12	Joel Sherrill <joel.sherrill@OARcorp.com>
+
+	PR 1257/bsps
+	* shared/irq/idt.c, shared/irq/irq.c, shared/irq/irq_init.c: Code
+	outside of cpukit should use the public API for
+	rtems_interrupt_disable/rtems_interrupt_enable. By bypassing the
+	public API and directly accessing _CPU_ISR_Disable and
+	_CPU_ISR_Enable, they were bypassing the compiler memory barrier
+	directive which could lead to problems. This patch also changes the
+	type of the variable passed into these routines and addresses minor
+	style issues.
+
 2007-03-30	Ralf CorsÃ©pius <ralf.corsepius@rtems.org>
 
Index: c/src/lib/libbsp/i386/shared/irq/idt.c
===================================================================
--- c/src/lib/libbsp/i386/shared/irq/idt.c	(revision bd51a636de805e88028a08791b4b4dff91cf4d71)
+++ c/src/lib/libbsp/i386/shared/irq/idt.c	(revision c83c3254d417d29e2d6809ebd3e6832105505da0)
@@ -63,5 +63,5 @@
     interrupt_gate_descriptor* 	idt_entry_tbl;
     unsigned			limit;
-    unsigned int 		level;
+    rtems_interrupt_level       level;
 
     i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
@@ -84,5 +84,5 @@
     }
 
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
 
     raw_irq_table [irq->idtIndex] = *irq;
@@ -90,5 +90,5 @@
     irq->on(irq);
 
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
     return 1;
 }
@@ -101,5 +101,5 @@
     unsigned			limit;
     interrupt_gate_descriptor	new;
-    unsigned int 		level;
+    rtems_interrupt_level       level;
 
     i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
@@ -111,5 +111,5 @@
       return;
     }
-    _CPU_ISR_Disable(level)
+    rtems_interrupt_disable(level);
     * ((unsigned int *) oldHdl) = idt_entry_tbl[vector].low_offsets_bits |
 	(idt_entry_tbl[vector].high_offsets_bits << 16);
@@ -118,5 +118,5 @@
     idt_entry_tbl[vector] = new;
 
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
 }
 
@@ -145,5 +145,5 @@
     interrupt_gate_descriptor* 	idt_entry_tbl;
     unsigned			limit;
-    unsigned int 		level;
+    rtems_interrupt_level       level;
 
     i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
@@ -165,5 +165,5 @@
       return 0;
     }
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
 
     idt_entry_tbl[irq->idtIndex] = default_idt_entry;
@@ -174,5 +174,5 @@
     raw_irq_table[irq->idtIndex].idtIndex = irq->idtIndex;
 
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
 
     return 1;
@@ -186,5 +186,5 @@
     unsigned			limit;
     unsigned 			i;
-    unsigned 			level;
+    rtems_interrupt_level       level;
     interrupt_gate_descriptor*	idt_entry_tbl;
 
@@ -204,5 +204,5 @@
     default_raw_irq_entry 	= config->defaultRawEntry;
 
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
 
     create_interrupt_gate_descriptor (&default_idt_entry, default_raw_irq_entry.hdl);
@@ -219,5 +219,5 @@
       }
     }
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
 
     return 1;
Index: c/src/lib/libbsp/i386/shared/irq/irq.c
===================================================================
--- c/src/lib/libbsp/i386/shared/irq/irq.c	(revision bd51a636de805e88028a08791b4b4dff91cf4d71)
+++ c/src/lib/libbsp/i386/shared/irq/irq.c	(revision c83c3254d417d29e2d6809ebd3e6832105505da0)
@@ -57,6 +57,6 @@
 int BSP_irq_disable_at_i8259s    (const rtems_irq_number irqLine)
 {
-  unsigned short mask;
-  unsigned int 	level;
+  unsigned short        mask;
+  rtems_interrupt_level level;
 
   if ( ((int)irqLine < BSP_LOWEST_OFFSET) ||
@@ -65,5 +65,5 @@
     return 1;
 
-  _CPU_ISR_Disable(level);
+  rtems_interrupt_disable(level);
 
   mask = 1 << irqLine;
@@ -78,5 +78,5 @@
     outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
   }
-  _CPU_ISR_Enable (level);
+  rtems_interrupt_enable(level);
 
   return 0;
@@ -92,6 +92,6 @@
 int BSP_irq_enable_at_i8259s    (const rtems_irq_number irqLine)
 {
-  unsigned short mask;
-  unsigned int 	level;
+  unsigned short        mask;
+  rtems_interrupt_level level;
 
   if ( ((int)irqLine < BSP_LOWEST_OFFSET) ||
@@ -100,5 +100,5 @@
     return 1;
 
-  _CPU_ISR_Disable(level);
+  rtems_interrupt_disable(level);
 
   mask = ~(1 << irqLine);
@@ -113,5 +113,5 @@
     outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
   }
-  _CPU_ISR_Enable (level);
+  rtems_interrupt_enable(level);
 
   return 0;
@@ -201,5 +201,5 @@
 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
 {
-    unsigned int level;
+    rtems_interrupt_level       level;
 
     if (!isValidInterrupt(irq->name)) {
@@ -213,7 +213,7 @@
      * to get the previous handler before accepting to disconnect.
      */
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
     if (rtems_hdl_tbl[irq->name].hdl != default_rtems_entry.hdl) {
-	  _CPU_ISR_Enable(level);
+	  rtems_interrupt_enable(level);
       return 0;
     }
@@ -232,5 +232,5 @@
     irq->on(irq);
 
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
 
     return 1;
@@ -239,18 +239,18 @@
 int BSP_get_current_rtems_irq_handler	(rtems_irq_connect_data* irq)
 {
-     unsigned int level;
-
-     if (!isValidInterrupt(irq->name)) {
-      return 0;
-     }
-    _CPU_ISR_Disable(level);
-     *irq = rtems_hdl_tbl[irq->name];
-    _CPU_ISR_Enable(level);
-     return 1;
+    rtems_interrupt_level       level;
+
+    if (!isValidInterrupt(irq->name)) {
+      return 0;
+    }
+    rtems_interrupt_disable(level);
+      *irq = rtems_hdl_tbl[irq->name];
+    rtems_interrupt_enable(level);
+    return 1;
 }
 
 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
 {
-    unsigned int level;
+    rtems_interrupt_level       level;
 
     if (!isValidInterrupt(irq->name)) {
@@ -264,7 +264,7 @@
      * to get the previous handler before accepting to disconnect.
      */
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
     if (rtems_hdl_tbl[irq->name].hdl != irq->hdl) {
-      _CPU_ISR_Enable(level);
+      rtems_interrupt_enable(level);
       return 0;
     }
@@ -285,5 +285,5 @@
     rtems_hdl_tbl[irq->name] = default_rtems_entry;
 
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
 
     return 1;
@@ -296,14 +296,15 @@
 int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)
 {
-    int i;
-    unsigned int level;
-   /*
-    * Store various code accelerators
-    */
+    int                    i;
+    rtems_interrupt_level  level;
+
+    /*
+     * Store various code accelerators
+     */
     internal_config 		= config;
     default_rtems_entry 	= config->defaultEntry;
     rtems_hdl_tbl 		= config->irqHdlTbl;
 
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
     /*
      * set up internal tables used by rtems interrupt prologue
@@ -325,5 +326,5 @@
      */
     BSP_irq_enable_at_i8259s (2);
-    _CPU_ISR_Enable(level);
+    rtems_interrupt_enable(level);
     return 1;
 }
Index: c/src/lib/libbsp/i386/shared/irq/irq_init.c
===================================================================
--- c/src/lib/libbsp/i386/shared/irq/irq_init.c	(revision bd51a636de805e88028a08791b4b4dff91cf4d71)
+++ c/src/lib/libbsp/i386/shared/irq/irq_init.c	(revision c83c3254d417d29e2d6809ebd3e6832105505da0)
@@ -115,5 +115,5 @@
     interrupt_gate_descriptor* 	idt_entry_tbl;
     unsigned int                limit;
-    unsigned int 		level;
+    rtems_interrupt_level       level;
 
     i386_get_info_from_IDTR(&idt_entry_tbl, &limit);
@@ -127,5 +127,5 @@
     }
 
-    _CPU_ISR_Disable(level);
+    rtems_interrupt_disable(level);
 
     /*
