[Xenomai-git] Philippe Gerum : nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

2010-06-19 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: d6a7b9b49ee12b5804f233d0b5721f16fbf969a5
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=d6a7b9b49ee12b5804f233d0b5721f16fbf969a5

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun 16 07:58:47 2010 +0200

nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

---

 ...patch = adeos-ipipe-2.6.30-nios2-1.2-00.patch} |  683 
 1 files changed, 410 insertions(+), 273 deletions(-)

diff --git a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch 
b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
similarity index 94%
rename from ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
rename to ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
index 1c01a97..a89727a 100644
--- a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
+++ b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
@@ -1,6 +1,6 @@
-diff --git d01303a1/arch/nios2/Kconfig b/arch/nios2/Kconfig
+diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
 index 66b9348..82f997d 100644
 d01303a1/arch/nios2/Kconfig
+--- a/arch/nios2/Kconfig
 +++ b/arch/nios2/Kconfig
 @@ -309,6 +309,13 @@ config PASS_CMDLINE
  will override Default kernel command string.
@@ -16,9 +16,9 @@ index 66b9348..82f997d 100644
  source mm/Kconfig
  
  config BOOT_LINK_OFFSET
-diff --git d01303a1/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
+diff --git a/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
 index c5413ef..b5048f5 100644
 d01303a1/arch/nios2/boot/compressed/Makefile
+--- a/arch/nios2/boot/compressed/Makefile
 +++ b/arch/nios2/boot/compressed/Makefile
 @@ -7,6 +7,13 @@
  targets   := vmlinux head.o misc.o \
@@ -34,9 +34,9 @@ index c5413ef..b5048f5 100644
  
  OBJECTS = $(obj)/head.o $(obj)/misc.o
  
-diff --git d01303a1/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
+diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
 index 2f2425f..e12b3c7 100644
 d01303a1/arch/nios2/kernel/Makefile
+--- a/arch/nios2/kernel/Makefile
 +++ b/arch/nios2/kernel/Makefile
 @@ -14,6 +14,8 @@ obj-y   := entry.o traps.o irq.o syscalltable.o \
usb.o config.o dma-mapping.o \
@@ -47,9 +47,9 @@ index 2f2425f..e12b3c7 100644
  obj-$(CONFIG_MODULES) += module.o
  obj-$(CONFIG_PIO_DEVICES) += pio.o
  obj-$(CONFIG_AVALON_DMA) += dma.o
-diff --git d01303a1/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
+diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
 index 8e275fb..7a15e36 100644
 d01303a1/arch/nios2/kernel/entry.S
+--- a/arch/nios2/kernel/entry.S
 +++ b/arch/nios2/kernel/entry.S
 @@ -52,6 +52,23 @@ ENTRY(system_call)
stw r2,PT_R2(sp)/* default return value in r2 */
@@ -151,12 +151,12 @@ index 8e275fb..7a15e36 100644
*/
  
  ENTRY(instruction_trap)
-diff --git d01303a1/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
+diff --git a/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
 new file mode 100644
-index 000..e88d788
+index 000..e86e08f
 --- /dev/null
 +++ b/arch/nios2/kernel/ipipe.c
-@@ -0,0 +1,446 @@
+@@ -0,0 +1,467 @@
 +/* -*- linux-c -*-
 + * linux/arch/nios2/kernel/ipipe.c
 + *
@@ -460,6 +460,18 @@ index 000..e88d788
 +  __ipipe_handle_irq(irq, regs);
 +  ipipe_trace_irq_exit(irq);
 +
++  if (user_mode(regs) 
++  (current-ipipe_flags  PF_EVTRET) != 0) {
++  /*
++   * Testing for user_regs() eliminates foreign stack
++   * contexts, including from careless domains which did
++   * not set the foreign stack bit (foreign stacks are
++   * always kernel-based).
++   */
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +  if (__ipipe_root_domain_p) {
 +  if (!test_bit(IPIPE_STALL_FLAG, ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -578,6 +590,15 @@ index 000..e88d788
 +
 +  local_irq_save_hw(flags);
 +
++  /*
++   * This is the end of the syscall path, so we may
++   * safely assume a valid Linux task stack here.
++   */
++  if (current-ipipe_flags  PF_EVTRET) {
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +if (!__ipipe_root_domain_p) {
 +  local_irq_restore_hw(flags);
 +  return 1;
@@ -603,9 +624,9 @@ index 000..e88d788
 +void notrace mcount(void);
 +EXPORT_SYMBOL(mcount);
 +#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
-diff --git d01303a1/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
+diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
 index bcd915c..6b68f82 100644
 d01303a1/arch/nios2/kernel/irq.c
+--- a/arch/nios2/kernel/irq.c
 +++ b/arch/nios2/kernel/irq.c
 @@ -39,18 +39,26 @@ 

[Xenomai-git] Philippe Gerum : nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

2010-06-18 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: d6a7b9b49ee12b5804f233d0b5721f16fbf969a5
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=d6a7b9b49ee12b5804f233d0b5721f16fbf969a5

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun 16 07:58:47 2010 +0200

nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

---

 ...patch = adeos-ipipe-2.6.30-nios2-1.2-00.patch} |  683 
 1 files changed, 410 insertions(+), 273 deletions(-)

diff --git a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch 
b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
similarity index 94%
rename from ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
rename to ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
index 1c01a97..a89727a 100644
--- a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
+++ b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
@@ -1,6 +1,6 @@
-diff --git d01303a1/arch/nios2/Kconfig b/arch/nios2/Kconfig
+diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
 index 66b9348..82f997d 100644
 d01303a1/arch/nios2/Kconfig
+--- a/arch/nios2/Kconfig
 +++ b/arch/nios2/Kconfig
 @@ -309,6 +309,13 @@ config PASS_CMDLINE
  will override Default kernel command string.
@@ -16,9 +16,9 @@ index 66b9348..82f997d 100644
  source mm/Kconfig
  
  config BOOT_LINK_OFFSET
-diff --git d01303a1/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
+diff --git a/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
 index c5413ef..b5048f5 100644
 d01303a1/arch/nios2/boot/compressed/Makefile
+--- a/arch/nios2/boot/compressed/Makefile
 +++ b/arch/nios2/boot/compressed/Makefile
 @@ -7,6 +7,13 @@
  targets   := vmlinux head.o misc.o \
@@ -34,9 +34,9 @@ index c5413ef..b5048f5 100644
  
  OBJECTS = $(obj)/head.o $(obj)/misc.o
  
-diff --git d01303a1/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
+diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
 index 2f2425f..e12b3c7 100644
 d01303a1/arch/nios2/kernel/Makefile
+--- a/arch/nios2/kernel/Makefile
 +++ b/arch/nios2/kernel/Makefile
 @@ -14,6 +14,8 @@ obj-y   := entry.o traps.o irq.o syscalltable.o \
usb.o config.o dma-mapping.o \
@@ -47,9 +47,9 @@ index 2f2425f..e12b3c7 100644
  obj-$(CONFIG_MODULES) += module.o
  obj-$(CONFIG_PIO_DEVICES) += pio.o
  obj-$(CONFIG_AVALON_DMA) += dma.o
-diff --git d01303a1/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
+diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
 index 8e275fb..7a15e36 100644
 d01303a1/arch/nios2/kernel/entry.S
+--- a/arch/nios2/kernel/entry.S
 +++ b/arch/nios2/kernel/entry.S
 @@ -52,6 +52,23 @@ ENTRY(system_call)
stw r2,PT_R2(sp)/* default return value in r2 */
@@ -151,12 +151,12 @@ index 8e275fb..7a15e36 100644
*/
  
  ENTRY(instruction_trap)
-diff --git d01303a1/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
+diff --git a/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
 new file mode 100644
-index 000..e88d788
+index 000..e86e08f
 --- /dev/null
 +++ b/arch/nios2/kernel/ipipe.c
-@@ -0,0 +1,446 @@
+@@ -0,0 +1,467 @@
 +/* -*- linux-c -*-
 + * linux/arch/nios2/kernel/ipipe.c
 + *
@@ -460,6 +460,18 @@ index 000..e88d788
 +  __ipipe_handle_irq(irq, regs);
 +  ipipe_trace_irq_exit(irq);
 +
++  if (user_mode(regs) 
++  (current-ipipe_flags  PF_EVTRET) != 0) {
++  /*
++   * Testing for user_regs() eliminates foreign stack
++   * contexts, including from careless domains which did
++   * not set the foreign stack bit (foreign stacks are
++   * always kernel-based).
++   */
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +  if (__ipipe_root_domain_p) {
 +  if (!test_bit(IPIPE_STALL_FLAG, ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -578,6 +590,15 @@ index 000..e88d788
 +
 +  local_irq_save_hw(flags);
 +
++  /*
++   * This is the end of the syscall path, so we may
++   * safely assume a valid Linux task stack here.
++   */
++  if (current-ipipe_flags  PF_EVTRET) {
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +if (!__ipipe_root_domain_p) {
 +  local_irq_restore_hw(flags);
 +  return 1;
@@ -603,9 +624,9 @@ index 000..e88d788
 +void notrace mcount(void);
 +EXPORT_SYMBOL(mcount);
 +#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
-diff --git d01303a1/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
+diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
 index bcd915c..6b68f82 100644
 d01303a1/arch/nios2/kernel/irq.c
+--- a/arch/nios2/kernel/irq.c
 +++ b/arch/nios2/kernel/irq.c
 @@ -39,18 +39,26 @@ 

[Xenomai-git] Philippe Gerum : nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

2010-06-17 Thread GIT version control
Module: xenomai-rpm
Branch: queue/vfile
Commit: 5b895a6efa59efe181137cbd8d44e56012cccbd8
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=5b895a6efa59efe181137cbd8d44e56012cccbd8

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun 16 07:58:47 2010 +0200

nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

---

 ...patch = adeos-ipipe-2.6.30-nios2-1.2-00.patch} |  683 
 1 files changed, 410 insertions(+), 273 deletions(-)

diff --git a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch 
b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
similarity index 94%
rename from ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
rename to ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
index 1c01a97..a89727a 100644
--- a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
+++ b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
@@ -1,6 +1,6 @@
-diff --git d01303a1/arch/nios2/Kconfig b/arch/nios2/Kconfig
+diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
 index 66b9348..82f997d 100644
 d01303a1/arch/nios2/Kconfig
+--- a/arch/nios2/Kconfig
 +++ b/arch/nios2/Kconfig
 @@ -309,6 +309,13 @@ config PASS_CMDLINE
  will override Default kernel command string.
@@ -16,9 +16,9 @@ index 66b9348..82f997d 100644
  source mm/Kconfig
  
  config BOOT_LINK_OFFSET
-diff --git d01303a1/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
+diff --git a/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
 index c5413ef..b5048f5 100644
 d01303a1/arch/nios2/boot/compressed/Makefile
+--- a/arch/nios2/boot/compressed/Makefile
 +++ b/arch/nios2/boot/compressed/Makefile
 @@ -7,6 +7,13 @@
  targets   := vmlinux head.o misc.o \
@@ -34,9 +34,9 @@ index c5413ef..b5048f5 100644
  
  OBJECTS = $(obj)/head.o $(obj)/misc.o
  
-diff --git d01303a1/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
+diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
 index 2f2425f..e12b3c7 100644
 d01303a1/arch/nios2/kernel/Makefile
+--- a/arch/nios2/kernel/Makefile
 +++ b/arch/nios2/kernel/Makefile
 @@ -14,6 +14,8 @@ obj-y   := entry.o traps.o irq.o syscalltable.o \
usb.o config.o dma-mapping.o \
@@ -47,9 +47,9 @@ index 2f2425f..e12b3c7 100644
  obj-$(CONFIG_MODULES) += module.o
  obj-$(CONFIG_PIO_DEVICES) += pio.o
  obj-$(CONFIG_AVALON_DMA) += dma.o
-diff --git d01303a1/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
+diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
 index 8e275fb..7a15e36 100644
 d01303a1/arch/nios2/kernel/entry.S
+--- a/arch/nios2/kernel/entry.S
 +++ b/arch/nios2/kernel/entry.S
 @@ -52,6 +52,23 @@ ENTRY(system_call)
stw r2,PT_R2(sp)/* default return value in r2 */
@@ -151,12 +151,12 @@ index 8e275fb..7a15e36 100644
*/
  
  ENTRY(instruction_trap)
-diff --git d01303a1/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
+diff --git a/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
 new file mode 100644
-index 000..e88d788
+index 000..e86e08f
 --- /dev/null
 +++ b/arch/nios2/kernel/ipipe.c
-@@ -0,0 +1,446 @@
+@@ -0,0 +1,467 @@
 +/* -*- linux-c -*-
 + * linux/arch/nios2/kernel/ipipe.c
 + *
@@ -460,6 +460,18 @@ index 000..e88d788
 +  __ipipe_handle_irq(irq, regs);
 +  ipipe_trace_irq_exit(irq);
 +
++  if (user_mode(regs) 
++  (current-ipipe_flags  PF_EVTRET) != 0) {
++  /*
++   * Testing for user_regs() eliminates foreign stack
++   * contexts, including from careless domains which did
++   * not set the foreign stack bit (foreign stacks are
++   * always kernel-based).
++   */
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +  if (__ipipe_root_domain_p) {
 +  if (!test_bit(IPIPE_STALL_FLAG, ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -578,6 +590,15 @@ index 000..e88d788
 +
 +  local_irq_save_hw(flags);
 +
++  /*
++   * This is the end of the syscall path, so we may
++   * safely assume a valid Linux task stack here.
++   */
++  if (current-ipipe_flags  PF_EVTRET) {
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +if (!__ipipe_root_domain_p) {
 +  local_irq_restore_hw(flags);
 +  return 1;
@@ -603,9 +624,9 @@ index 000..e88d788
 +void notrace mcount(void);
 +EXPORT_SYMBOL(mcount);
 +#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
-diff --git d01303a1/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
+diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
 index bcd915c..6b68f82 100644
 d01303a1/arch/nios2/kernel/irq.c
+--- a/arch/nios2/kernel/irq.c
 +++ b/arch/nios2/kernel/irq.c
 @@ -39,18 +39,26 

[Xenomai-git] Philippe Gerum : nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

2010-06-16 Thread GIT version control
Module: xenomai-rpm
Branch: for-upstream
Commit: 5b895a6efa59efe181137cbd8d44e56012cccbd8
URL:
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=5b895a6efa59efe181137cbd8d44e56012cccbd8

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun 16 07:58:47 2010 +0200

nios2: upgrade I-pipe support to 2.6.30-nios2-1.2-00

---

 ...patch = adeos-ipipe-2.6.30-nios2-1.2-00.patch} |  683 
 1 files changed, 410 insertions(+), 273 deletions(-)

diff --git a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch 
b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
similarity index 94%
rename from ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
rename to ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
index 1c01a97..a89727a 100644
--- a/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.1-00.patch
+++ b/ksrc/arch/nios2/patches/adeos-ipipe-2.6.30-nios2-1.2-00.patch
@@ -1,6 +1,6 @@
-diff --git d01303a1/arch/nios2/Kconfig b/arch/nios2/Kconfig
+diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
 index 66b9348..82f997d 100644
 d01303a1/arch/nios2/Kconfig
+--- a/arch/nios2/Kconfig
 +++ b/arch/nios2/Kconfig
 @@ -309,6 +309,13 @@ config PASS_CMDLINE
  will override Default kernel command string.
@@ -16,9 +16,9 @@ index 66b9348..82f997d 100644
  source mm/Kconfig
  
  config BOOT_LINK_OFFSET
-diff --git d01303a1/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
+diff --git a/arch/nios2/boot/compressed/Makefile 
b/arch/nios2/boot/compressed/Makefile
 index c5413ef..b5048f5 100644
 d01303a1/arch/nios2/boot/compressed/Makefile
+--- a/arch/nios2/boot/compressed/Makefile
 +++ b/arch/nios2/boot/compressed/Makefile
 @@ -7,6 +7,13 @@
  targets   := vmlinux head.o misc.o \
@@ -34,9 +34,9 @@ index c5413ef..b5048f5 100644
  
  OBJECTS = $(obj)/head.o $(obj)/misc.o
  
-diff --git d01303a1/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
+diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
 index 2f2425f..e12b3c7 100644
 d01303a1/arch/nios2/kernel/Makefile
+--- a/arch/nios2/kernel/Makefile
 +++ b/arch/nios2/kernel/Makefile
 @@ -14,6 +14,8 @@ obj-y   := entry.o traps.o irq.o syscalltable.o \
usb.o config.o dma-mapping.o \
@@ -47,9 +47,9 @@ index 2f2425f..e12b3c7 100644
  obj-$(CONFIG_MODULES) += module.o
  obj-$(CONFIG_PIO_DEVICES) += pio.o
  obj-$(CONFIG_AVALON_DMA) += dma.o
-diff --git d01303a1/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
+diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
 index 8e275fb..7a15e36 100644
 d01303a1/arch/nios2/kernel/entry.S
+--- a/arch/nios2/kernel/entry.S
 +++ b/arch/nios2/kernel/entry.S
 @@ -52,6 +52,23 @@ ENTRY(system_call)
stw r2,PT_R2(sp)/* default return value in r2 */
@@ -151,12 +151,12 @@ index 8e275fb..7a15e36 100644
*/
  
  ENTRY(instruction_trap)
-diff --git d01303a1/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
+diff --git a/arch/nios2/kernel/ipipe.c b/arch/nios2/kernel/ipipe.c
 new file mode 100644
-index 000..e88d788
+index 000..e86e08f
 --- /dev/null
 +++ b/arch/nios2/kernel/ipipe.c
-@@ -0,0 +1,446 @@
+@@ -0,0 +1,467 @@
 +/* -*- linux-c -*-
 + * linux/arch/nios2/kernel/ipipe.c
 + *
@@ -460,6 +460,18 @@ index 000..e88d788
 +  __ipipe_handle_irq(irq, regs);
 +  ipipe_trace_irq_exit(irq);
 +
++  if (user_mode(regs) 
++  (current-ipipe_flags  PF_EVTRET) != 0) {
++  /*
++   * Testing for user_regs() eliminates foreign stack
++   * contexts, including from careless domains which did
++   * not set the foreign stack bit (foreign stacks are
++   * always kernel-based).
++   */
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +  if (__ipipe_root_domain_p) {
 +  if (!test_bit(IPIPE_STALL_FLAG, ipipe_root_cpudom_var(status)))
 +  return 1;
@@ -578,6 +590,15 @@ index 000..e88d788
 +
 +  local_irq_save_hw(flags);
 +
++  /*
++   * This is the end of the syscall path, so we may
++   * safely assume a valid Linux task stack here.
++   */
++  if (current-ipipe_flags  PF_EVTRET) {
++  current-ipipe_flags = ~PF_EVTRET;
++  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);
++  }
++
 +if (!__ipipe_root_domain_p) {
 +  local_irq_restore_hw(flags);
 +  return 1;
@@ -603,9 +624,9 @@ index 000..e88d788
 +void notrace mcount(void);
 +EXPORT_SYMBOL(mcount);
 +#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
-diff --git d01303a1/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
+diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c
 index bcd915c..6b68f82 100644
 d01303a1/arch/nios2/kernel/irq.c
+--- a/arch/nios2/kernel/irq.c
 +++ b/arch/nios2/kernel/irq.c
 @@ -39,18 +39,26