All of lore.kernel.org
 help / color / mirror / Atom feed
* [Adeos-main] [PATCH 3/3] i386: Cleanup root IRQ trampolines
@ 2007-12-26 15:40 Jan Kiszka
  2007-12-26 22:11 ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2007-12-26 15:40 UTC (permalink / raw)
  To: adeos-main; +Cc: Philippe Gerum


[-- Attachment #1.1: Type: text/plain, Size: 149 bytes --]

Simplifies xirq trampoline and applies the xirq refactorings to
virq_handler too.

Merry Christmas and all the best for 2008 to everyone!

Jan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: cleanup-root-irq-trampolines-i386.patch --]
[-- Type: text/x-patch; name="cleanup-root-irq-trampolines-i386.patch", Size: 3517 bytes --]

---
 include/asm-i386/ipipe.h |   78 ++++++++++++++++++++++++-----------------------
 1 file changed, 40 insertions(+), 38 deletions(-)

Index: linux-2.6.23.12-xeno/include/asm-i386/ipipe.h
===================================================================
--- linux-2.6.23.12-xeno.orig/include/asm-i386/ipipe.h
+++ linux-2.6.23.12-xeno/include/asm-i386/ipipe.h
@@ -141,11 +141,7 @@ __ipipe_call_root_xirq_handler(unsigned 
 		"pushl %%ds\n\t"
 		"pushl %%eax\n\t"
 		"pushl %%ebp\n\t"
-		"pushl %%edi\n\t"
-		"pushl %%esi\n\t"
-		"pushl %%edx\n\t"
-		"pushl %%ecx\n\t"
-		"pushl %%ebx\n\t"
+		"subl  $5*4,%%esp	# rest can remain unsaved\n\t"
 
 		"movl  %[regs],%%eax	# always pass tick regs\n\t"
 		"call *%[handler]\n\t"
@@ -158,33 +154,41 @@ __ipipe_call_root_xirq_handler(unsigned 
 		 : "eax");
 }
 
-#define __ipipe_call_root_virq_handler(ipd,irq) \
-   __asm__ __volatile__ ("pushfl\n\t" \
-                         "pushl %%cs\n\t" \
-                         "pushl $__virq_end\n\t" \
-	                 "pushl $-1\n\t" \
-                         "pushl %%fs\n\t" \
-	                 "pushl %%es\n\t" \
-	                 "pushl %%ds\n\t" \
-	                 "pushl %%eax\n\t" \
-	                 "pushl %%ebp\n\t" \
-	                 "pushl %%edi\n\t" \
-	                 "pushl %%esi\n\t" \
-	                 "pushl %%edx\n\t" \
-	                 "pushl %%ecx\n\t" \
-	                 "pushl %%ebx\n\t" \
-			 "pushl %2\n\t" \
-                         "pushl %%eax\n\t" \
-                         "call *%1\n\t" \
-			 "addl $8,%%esp\n\t" \
-			 : /* no output */ \
-			 : "a" (irq), "m" ((ipd)->irqs[irq].handler), "r" ((ipd)->irqs[irq].cookie))
-
-#define __ipipe_finalize_root_virq_handler() \
-   __asm__ __volatile__ ("jmp ret_from_intr\n\t" \
-	                 "__virq_end: cli\n" \
-			 : /* no output */ \
-			 : /* no input */)
+void irq_enter(void);
+void irq_exit(void);
+
+static inline void
+__ipipe_call_root_virq_handler(unsigned irq,
+			       void (*handler)(unsigned irq, void *cookie),
+			       void *cookie)
+{
+	irq_enter();
+	__asm__ __volatile__ (
+		"pushfl\n\t"
+		"pushl %%cs\n\t"
+		"pushl $virq_end\n\t"
+		"pushl %%eax		# dummy value\n\t"
+		"pushl %%fs\n\t"
+		"pushl %%es\n\t"
+		"pushl %%ds\n\t"
+		"pushl %%eax\n\t"
+		"pushl %%ebp\n\t"
+		"subl  $5*4,%%esp	# rest can remain unsaved\n\t"
+
+		"pushl %[cookie]\n\t"
+		"pushl %[irq]\n\t"
+		"call *%[handler]\n\t"
+		"addl $8,%%esp\n\t" \
+		 : /* no output */ \
+		 : [irq] "rm" (irq), [handler] "rm" (handler),
+		   [cookie] "rm" (cookie));
+	irq_exit();
+	__asm__ __volatile__ (
+		"jmp ret_from_intr	# Linux IRQ epilogue\n\t"
+		"virq_end: cli\n\t"
+		 : /* no output */
+		 : /* no input */);
+}
 
 static inline unsigned long __ipipe_ffnz(unsigned long ul)
 {
@@ -205,12 +209,10 @@ static inline unsigned long __ipipe_ffnz
 			if (likely(!ipipe_virtual_irq_p(irq)))		\
 				__ipipe_call_root_xirq_handler(		\
 					irq, (ipd)->irqs[irq].handler); \
-			else {						\
-				irq_enter();				\
-				__ipipe_call_root_virq_handler(ipd,irq); \
-				irq_exit();				\
-				__ipipe_finalize_root_virq_handler();	\
-			}						\
+			else						\
+				__ipipe_call_root_virq_handler(		\
+					irq, (ipd)->irqs[irq].handler,	\
+					(ipd)->irqs[irq].cookie);	\
 		} else {						\
 			__clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
 			ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-12-27  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-26 15:40 [Adeos-main] [PATCH 3/3] i386: Cleanup root IRQ trampolines Jan Kiszka
2007-12-26 22:11 ` Philippe Gerum
2007-12-27  0:19   ` Jan Kiszka
2007-12-27  8:49     ` Philippe Gerum
2007-12-27  9:48     ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.