From: Jan Kiszka <jan.kiszka@domain.hid>
To: adeos-main <adeos-main@gna.org>
Cc: Philippe Gerum <rpm@xenomai.org>
Subject: [Adeos-main] [PATCH 3/3] i386: Cleanup root IRQ trampolines
Date: Wed, 26 Dec 2007 16:40:16 +0100 [thread overview]
Message-ID: <477275E0.7080001@domain.hid> (raw)
[-- 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 --]
next reply other threads:[~2007-12-26 15:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-26 15:40 Jan Kiszka [this message]
2007-12-26 22:11 ` [Adeos-main] [PATCH 3/3] i386: Cleanup root IRQ trampolines Philippe Gerum
2007-12-27 0:19 ` Jan Kiszka
2007-12-27 8:49 ` Philippe Gerum
2007-12-27 9:48 ` Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=477275E0.7080001@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=adeos-main@gna.org \
--cc=rpm@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.