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

Merry Christmas and all the best for 2008 to everyone!

Jan
---
 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: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Adeos-main mailing list
Adeos-main@gna.org
https://mail.gna.org/listinfo/adeos-main

Reply via email to