patch-2.3.99-pre4 linux/arch/sh/kernel/irq_imask.c

Next file: linux/arch/sh/kernel/process.c
Previous file: linux/arch/sh/kernel/irq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre3/linux/arch/sh/kernel/irq_imask.c linux/arch/sh/kernel/irq_imask.c
@@ -1,8 +1,8 @@
-/* $Id: irq_imask.c,v 1.2 2000/02/11 04:57:40 gniibe Exp $
+/* $Id: irq_imask.c,v 1.6 2000/03/06 14:11:32 gniibe Exp $
  *
  * linux/arch/sh/kernel/irq_imask.c
  *
- * Copyright (C) 1999  Niibe Yutaka
+ * Copyright (C) 1999, 2000  Niibe Yutaka
  *
  * Simple interrupt handling using IMASK of SR register.
  *
@@ -52,35 +52,40 @@
 	end_imask_irq
 };
 
-void disable_imask_irq(unsigned int irq)
+void static inline set_interrupt_registers(int ip)
 {
 	unsigned long __dummy;
 
+	asm volatile("ldc	%2, $r5_bank\n\t"
+		     "stc	$sr, %0\n\t"
+		     "and	#0xf0, %0\n\t"
+		     "shlr8	%0\n\t"
+		     "cmp/eq	#0x0f, %0\n\t"
+		     "bt	1f	! CLI-ed\n\t"
+		     "stc	$sr, %0\n\t"
+		     "and	%1, %0\n\t"
+		     "or	%2, %0\n\t"
+		     "ldc	%0, $sr\n"
+		     "1:"
+		     : "=&z" (__dummy)
+		     : "r" (~0xf0), "r" (ip << 4));
+}
+
+void disable_imask_irq(unsigned int irq)
+{
 	clear_bit(irq, &imask_mask);
 	if (interrupt_priority < IMASK_PRIORITY - irq)
 		interrupt_priority = IMASK_PRIORITY - irq;
 
-	asm volatile("stc	sr,%0\n\t"
-		     "and	%1,%0\n\t"
-		     "or	%2,%0\n\t"
-		     "ldc	%0,sr"
-		     : "=&r" (__dummy)
-		     : "r" (0xffffff0f), "r" (interrupt_priority << 4));
+	set_interrupt_registers(interrupt_priority);
 }
 
 static void enable_imask_irq(unsigned int irq)
 {
-	unsigned long __dummy;
-
 	set_bit(irq, &imask_mask);
 	interrupt_priority = IMASK_PRIORITY - ffz(imask_mask);
 
-	asm volatile("stc	sr,%0\n\t"
-		     "and	%1,%0\n\t"
-		     "or	%2,%0\n\t"
-		     "ldc	%0,sr"
-		     : "=&r" (__dummy)
-		     : "r" (0xffffff0f), "r" (interrupt_priority << 4));
+	set_interrupt_registers(interrupt_priority);
 }
 
 static void mask_and_ack_imask(unsigned int irq)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)