From: Jan Kiszka <jan.kiszka@domain.hid>
To: adeos-main <adeos-main@gna.org>
Cc: Philippe Gerum <rpm@xenomai.org>
Subject: Re: [Adeos-main] [PATCH 2/3] i386: Rework root IRQ handler invocation
Date: Wed, 26 Dec 2007 16:48:56 +0100 [thread overview]
Message-ID: <477277E8.1020105@domain.hid> (raw)
In-Reply-To: <477275C4.7030503@domain.hid>
[-- Attachment #1.1: Type: text/plain, Size: 96 bytes --]
Jan Kiszka wrote:
> i386 port of the earlier posted x86_64 patch.
>
The usual mistake...
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: rework-call_root_xirq_handler-i386.patch --]
[-- Type: text/x-patch; name="rework-call_root_xirq_handler-i386.patch", Size: 4387 bytes --]
---
arch/i386/kernel/ipipe.c | 22 ++++++++-------
include/asm-i386/ipipe.h | 65 +++++++++++++++++++++++++++--------------------
2 files changed, 50 insertions(+), 37 deletions(-)
Index: linux-2.6.23.12-xeno/arch/i386/kernel/ipipe.c
===================================================================
--- linux-2.6.23.12-xeno.orig/arch/i386/kernel/ipipe.c
+++ linux-2.6.23.12-xeno/arch/i386/kernel/ipipe.c
@@ -764,17 +764,19 @@ int __ipipe_handle_irq(struct pt_regs re
finalize:
- /* Given our deferred dispatching model for regular IRQs, we
- * only record CPU regs for the last timer interrupt, so that
- * the timer handler charges CPU times properly. It is assumed
- * that other interrupt handlers don't actually care for such
- * information. */
-
+ /*
+ * Given our deferred dispatching model for regular IRQs, we only
+ * record relevant registers for the last timer interrupt, so that the
+ * timer handler charges CPU times properly. It is assumed that other
+ * interrupt handlers don't actually care for such information.
+ */
if (irq == __ipipe_tick_irq) {
- __raw_get_cpu_var(__ipipe_tick_regs).eflags = regs.eflags;
- __raw_get_cpu_var(__ipipe_tick_regs).eip = regs.eip;
- __raw_get_cpu_var(__ipipe_tick_regs).xcs = regs.xcs;
- __raw_get_cpu_var(__ipipe_tick_regs).ebp = regs.ebp;
+ struct pt_regs *tick_regs =
+ &__raw_get_cpu_var(__ipipe_tick_regs);
+ tick_regs->eflags = regs.eflags;
+ tick_regs->xcs = regs.xcs;
+ tick_regs->eip = regs.eip;
+ tick_regs->ebp = regs.ebp;
}
/*
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
@@ -123,27 +123,40 @@ extern int __ipipe_tick_irq;
DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
-#define __ipipe_call_root_xirq_handler(ipd,irq) \
- __asm__ __volatile__ ("pushfl\n\t" \
- "pushl %%cs\n\t" \
- "pushl $1f\n\t" \
- "pushl %%eax\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" \
- "movl %%esp,%%eax\n\t" \
- "call *%1\n\t" \
- "jmp ret_from_intr\n\t" \
- "1: cli\n" \
- : /* no output */ \
- : "a" (~irq), "m" ((ipd)->irqs[irq].handler))
+static inline void
+__ipipe_call_root_xirq_handler(unsigned irq,
+ void (*handler)(unsigned irq, void *cookie))
+{
+ struct pt_regs *regs = &__raw_get_cpu_var(__ipipe_tick_regs);
+
+ regs->orig_eax = ~irq;
+
+ __asm__ __volatile__ (
+ "pushfl\n\t"
+ "pushl %%cs\n\t"
+ "pushl $xirq_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"
+ "pushl %%edi\n\t"
+ "pushl %%esi\n\t"
+ "pushl %%edx\n\t"
+ "pushl %%ecx\n\t"
+ "pushl %%ebx\n\t"
+
+ "movl %[regs],%%eax # always pass tick regs\n\t"
+ "call *%[handler]\n\t"
+
+ "jmp ret_from_intr # Linux IRQ epilogue\n\t"
+
+ "xirq_end: cli\n\t"
+ : /* no output */ \
+ : [handler] "rm" (handler), [regs] "rm" (regs)
+ : "eax");
+}
#define __ipipe_call_root_virq_handler(ipd,irq) \
__asm__ __volatile__ ("pushfl\n\t" \
@@ -189,12 +202,10 @@ static inline unsigned long __ipipe_ffnz
do { \
local_irq_enable_nohead(ipd); \
if (ipd == ipipe_root_domain) { \
- if (likely(!ipipe_virtual_irq_p(irq))) { \
- struct pt_regs *old_regs; \
- old_regs = set_irq_regs(&__raw_get_cpu_var(__ipipe_tick_regs)); \
- __ipipe_call_root_xirq_handler(ipd,irq); \
- set_irq_regs(old_regs); \
- } else { \
+ 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(); \
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
prev parent reply other threads:[~2007-12-26 15:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-26 15:39 [Adeos-main] [PATCH 2/3] i386: Rework root IRQ handler invocation Jan Kiszka
2007-12-26 15:48 ` Jan Kiszka [this message]
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=477277E8.1020105@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.