[Xenomai-git] Philippe Gerum : compat: provide linux/err.h wrapper to linux/fs.h

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun  5 11:34:02 2010 +0200

compat: provide linux/err.h wrapper to linux/fs.h

---

 include/compat/linux/err.h |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/compat/linux/err.h b/include/compat/linux/err.h
new file mode 100644
index 000..ae980db
--- /dev/null
+++ b/include/compat/linux/err.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2010 Philippe Gerum r...@xenomai.org.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#ifndef _XENO_COMPAT_LINUX_ERR_H
+#define _XENO_COMPAT_LINUX_ERR_H
+
+#include linux/fs.h
+
+#endif /* _XENO_COMPAT_LINUX_ERR_H */


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: silence deprecated warnings on __builtin_expect for old compilers

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun  5 11:36:37 2010 +0200

nucleus: silence deprecated warnings on __builtin_expect for old compilers

---

 include/asm-powerpc/bits/pod.h |2 +-
 ksrc/nucleus/registry.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-powerpc/bits/pod.h b/include/asm-powerpc/bits/pod.h
index 6fe5e7b..7093b40 100644
--- a/include/asm-powerpc/bits/pod.h
+++ b/include/asm-powerpc/bits/pod.h
@@ -138,7 +138,7 @@ static inline void xnarch_switch_to(xnarchtcb_t *out_tcb,
}
 }
 #else /* PPC32 */
-   if (likely(next_mm)) {
+   if (likely(next_mm != NULL)) {
next-thread.pgdir = next_mm-pgd;
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,29)
get_mmu_context(next_mm);
diff --git a/ksrc/nucleus/registry.c b/ksrc/nucleus/registry.c
index 53781f2..7dc7cf0 100644
--- a/ksrc/nucleus/registry.c
+++ b/ksrc/nucleus/registry.c
@@ -1037,7 +1037,7 @@ void *xnregistry_get(xnhandle_t handle)
xnlock_get_irqsave(nklock, s);
 
object = xnregistry_validate(handle);
-   if (likely(object)) {
+   if (likely(object != NULL)) {
++object-safelock;
objaddr = object-objaddr;
} else


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : skins: sanitize heap binding

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jun 13 17:27:06 2010 +0200

skins: sanitize heap binding

---

 include/nucleus/heap.h  |5 +++
 ksrc/nucleus/shadow.c   |   16 +++--
 src/skins/common/sem_heap.c |   76 +++
 src/skins/native/heap.c |   38 -
 src/skins/native/queue.c|   38 -
 src/skins/psos+/rn.c|   36 +++-
 src/skins/rtai/shm.c|   61 +++---
 src/skins/vrtx/heap.c   |   36 +++-
 src/skins/vrtx/pt.c |   36 +++-
 9 files changed, 90 insertions(+), 252 deletions(-)

diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index fecdb79..f4ebe11 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -279,4 +279,9 @@ int xnheap_check_block(xnheap_t *heap,
 
 #define XNHEAP_DEV_NAME  /dev/rtheap
 
+struct xnheap_desc {
+   unsigned long handle;
+   unsigned int size;
+};
+
 #endif /* !_XENO_NUCLEUS_HEAP_H */
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 1a32527..cc313cf 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -702,8 +702,7 @@ void __init xnheap_init_vdso(void)
 {
nkvdso = (struct xnvdso *)
xnheap_alloc(__xnsys_global_ppd.sem_heap, sizeof(*nkvdso));
-
-   if (!nkvdso)
+   if (nkvdso == NULL)
xnpod_fatal(Xenomai: cannot allocate memory for xnvdso!\n);
 
nkvdso-features = XNVDSO_FEATURES;
@@ -1891,20 +1890,15 @@ static int xnshadow_sys_trace(struct pt_regs *regs)
return err;
 }
 
-struct heap_info {
-   xnheap_t *addr;
-   unsigned size;
-};
-
 static int xnshadow_sys_sem_heap(struct pt_regs *regs)
 {
-   struct heap_info hinfo, __user *us_hinfo;
+   struct xnheap_desc hinfo, __user *us_hinfo;
unsigned global;
 
global = __xn_reg_arg2(regs);
-   us_hinfo = (struct heap_info __user *) __xn_reg_arg1(regs);
-   hinfo.addr = xnsys_ppd_get(global)-sem_heap;
-   hinfo.size = xnheap_extentsize(hinfo.addr);
+   us_hinfo = (struct xnheap_desc __user *) __xn_reg_arg1(regs);
+   hinfo.handle = (unsigned long)xnsys_ppd_get(global)-sem_heap;
+   hinfo.size = xnheap_extentsize(xnsys_ppd_get(global)-sem_heap);
 
return __xn_safe_copy_to_user(us_hinfo, hinfo, sizeof(*us_hinfo));
 }
diff --git a/src/skins/common/sem_heap.c b/src/skins/common/sem_heap.c
index bf7031d..acb655b 100644
--- a/src/skins/common/sem_heap.c
+++ b/src/skins/common/sem_heap.c
@@ -11,62 +11,68 @@
 #include sys/mman.h
 
 #include nucleus/vdso.h
+#include nucleus/heap.h
 #include asm/xenomai/syscall.h
 #include asm-generic/bits/current.h
-
 #include sem_heap.h
 
 unsigned long xeno_sem_heap[2] = { 0, 0 };
+
 struct xnvdso *nkvdso;
 
-static void *map_sem_heap(unsigned shared)
+void *xeno_map_heap(unsigned long handle, unsigned int size)
 {
-   struct heap_info {
-   void *addr;
-   unsigned size;
-   } hinfo;
-   int fd, err;
+   int fd, ret;
+   void *addr;
 
-   fd = open(/dev/rtheap, O_RDWR, 0);
+   fd = open(XNHEAP_DEV_NAME, O_RDWR, 0);
if (fd  0) {
-   fprintf(stderr, Xenomai: open: %m\n);
+   perror(Xenomai: open);
return MAP_FAILED;
}
 
-   err = XENOMAI_SYSCALL2(__xn_sys_sem_heap, hinfo, shared);
-   if (err  0) {
-   fprintf(stderr, Xenomai: sys_sem_heap: %m\n);
+   ret = ioctl(fd, 0, handle);
+   if (ret) {
+   perror(Xenomai: ioctl);
return MAP_FAILED;
}
 
-   err = ioctl(fd, 0, hinfo.addr);
-   if (err  0) {
-   fprintf(stderr, Xenomai: ioctl: %m\n);
-   return MAP_FAILED;
-   }
+   addr = mmap(NULL, size, PROT_READ|PROT_WRITE,
+   MAP_SHARED, fd, 0L);
 
-   hinfo.addr = mmap(NULL, hinfo.size,
- PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
 
-   return hinfo.addr;
+   return addr;
 }
 
-static void unmap_sem_heap(unsigned long heap_addr, unsigned shared)
+static void *map_sem_heap(unsigned int shared)
 {
-   struct heap_info {
-   void *addr;
-   unsigned size;
-   } hinfo;
-   int err;
+   struct xnheap_desc hinfo;
+   int ret;
 
-   err = XENOMAI_SYSCALL2(__xn_sys_sem_heap, hinfo, shared);
-   if (err  0) {
-   fprintf(stderr, Xenomai: sys_sem_heap: %m\n);
+   ret = XENOMAI_SYSCALL2(__xn_sys_sem_heap, hinfo, shared);
+   if (ret  0) {
+   errno = -ret;
+   perror(Xenomai: sys_sem_heap);
+   return MAP_FAILED;
+   }
+
+   return 

[Xenomai-git] Philippe Gerum : hal/generic: always track switch to foreign stack

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

Author: Philippe Gerum r...@xenomai.org
Date:   Fri Jun  4 16:32:43 2010 +0200

hal/generic: always track switch to foreign stack

We do want to let the I-pipe know when we switch to a non-linux stack,
always.  So remove the condition on CONFIG_KGDB for tracking such
change.

---

 include/asm-generic/hal.h |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 84c1a4d..f03219d 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -318,14 +318,8 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_disable_ondemand_mappings(tsk)   (0)
 #endif /* !(VM_PINNED || MMF_VM_PINNED) */
 
-#ifdef CONFIG_KGDB
 #define rthal_set_foreign_stack(ipd)   ipipe_set_foreign_stack(ipd)
 #define rthal_clear_foreign_stack(ipd) ipipe_clear_foreign_stack(ipd)
-#else /* !CONFIG_KGDB */
-/* No need to track foreign stacks unless KGDB is active. */
-#define rthal_set_foreign_stack(ipd)   do { } while(0)
-#define rthal_clear_foreign_stack(ipd) do { } while(0)
-#endif /* CONFIG_KGDB */
 
 #define rthal_catch_cleanup(hdlr) \
 ipipe_catch_event(ipipe_root_domain,IPIPE_EVENT_CLEANUP,hdlr)


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : build: check for CONFIG_MMU in user-space

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

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Jun 15 12:37:21 2010 +0200

build: check for CONFIG_MMU in user-space

---

 Makefile.in|  196 +-
 aclocal.m4 | 6980 +---
 config/Makefile.in |   46 +-
 configure  |  679 +-
 configure.in   |   17 +-
 doc/Makefile.in|  136 +-
 doc/docbook/Makefile.in|  136 +-
 doc/docbook/custom-stylesheets/Makefile.in |  136 +-
 doc/docbook/custom-stylesheets/xsl/Makefile.in |  136 +-
 .../custom-stylesheets/xsl/common/Makefile.in  |   46 +-
 doc/docbook/custom-stylesheets/xsl/fo/Makefile.in  |   46 +-
 .../custom-stylesheets/xsl/html/Makefile.in|   46 +-
 doc/docbook/xenomai/Makefile.in|   46 +-
 doc/doxygen/Makefile.in|   46 +-
 doc/man/Makefile.in|  218 +-
 doc/txt/Makefile.in|   85 +-
 include/Makefile.in|  197 +-
 include/analogy/Makefile.in|  110 +-
 include/asm-arm/Makefile.in|  175 +-
 include/asm-arm/bits/Makefile.in   |  110 +-
 include/asm-blackfin/Makefile.in   |  175 +-
 include/asm-blackfin/bits/Makefile.in  |  110 +-
 include/asm-generic/Makefile.in|  175 +-
 include/asm-generic/bits/Makefile.in   |  110 +-
 include/asm-nios2/Makefile.in  |  175 +-
 include/asm-nios2/bits/Makefile.in |  110 +-
 include/asm-powerpc/Makefile.in|  175 +-
 include/asm-powerpc/bits/Makefile.in   |  110 +-
 include/asm-sim/Makefile.in|  175 +-
 include/asm-sim/bits/Makefile.in   |  110 +-
 include/asm-x86/Makefile.in|  175 +-
 include/asm-x86/bits/Makefile.in   |  110 +-
 include/native/Makefile.in |  110 +-
 include/nucleus/Makefile.in|  110 +-
 include/posix/Makefile.in  |  175 +-
 include/posix/sys/Makefile.in  |  110 +-
 include/psos+/Makefile.in  |  110 +-
 include/rtai/Makefile.in   |  110 +-
 include/rtdm/Makefile.in   |  110 +-
 include/uitron/Makefile.in |  110 +-
 include/vrtx/Makefile.in   |  110 +-
 include/vxworks/Makefile.in|  110 +-
 scripts/Makefile.in|  107 +-
 src/Makefile.in|  136 +-
 src/drvlib/Makefile.in |  136 +-
 src/drvlib/analogy/Makefile.in |  154 +-
 src/include/Makefile.in|   50 +-
 src/include/xeno_config.h.in   |6 +
 src/rtdk/Makefile.in   |  142 +-
 src/skins/Makefile.in  |  136 +-
 src/skins/common/Makefile.in   |  148 +-
 src/skins/native/Makefile.in   |  208 +-
 src/skins/posix/Makefile.in|  196 +-
 src/skins/psos+/Makefile.in|  160 +-
 src/skins/rtai/Makefile.in |  130 +-
 src/skins/rtdm/Makefile.in |  130 +-
 src/skins/uitron/Makefile.in   |  148 +-
 src/skins/vrtx/Makefile.in |  184 +-
 src/skins/vxworks/Makefile.in  |  190 +-
 src/testsuite/Makefile.in  |  136 +-
 src/testsuite/clocktest/Makefile.in|  138 +-
 src/testsuite/cyclic/Makefile.in   |  138 +-
 src/testsuite/irqbench/Makefile.in |  142 +-
 src/testsuite/klatency/Makefile.in |  138 +-
 src/testsuite/latency/Makefile.in  |  138 +-
 src/testsuite/sigtest/Makefile.in  |  138 +-
 src/testsuite/switchtest/Makefile.in   |  138 +-
 src/testsuite/unit/Makefile.in |  170 +-
 src/utils/Makefile.in  |  136 +-
 src/utils/analogy/Makefile.in  |  190 +-
 src/utils/can/Makefile.in  |  190 +-
 src/utils/ps/Makefile.in   |  134 +-
 72 files changed, 6855 insertions(+), 9894 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-rpm.git;a=commitdiff;h=79008a73d85a16e25ad6c06cbc21b0333c5bc2bc


[Xenomai-git] Philippe Gerum : wrappers: no need to reserve pages passed to vm_insert_page

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 09:35:58 2010 +0200

wrappers: no need to reserve pages passed to vm_insert_page

---

 include/asm-generic/wrappers.h |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index ecc1867..a7349db 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -343,10 +343,9 @@ unsigned long find_next_bit(const unsigned long *addr,
 /* VM */
 
 #if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,15)  defined(CONFIG_MMU)
-#define wrap_remap_vm_page(vma,from,to) ({ \
-vma-vm_flags |= VM_RESERVED; \
-vm_insert_page(vma,from,vmalloc_to_page((void *)to)); \
-})
+#define wrap_remap_vm_page(vma,from,to) \
+vm_insert_page(vma,from,vmalloc_to_page((void *)to))
+
 #define wrap_remap_io_page_range(vma,from,to,size,prot)  ({\
 (vma)-vm_page_prot = pgprot_noncached((vma)-vm_page_prot);   \
 /* Sets VM_RESERVED | VM_IO | VM_PFNMAP on the vma. */ \


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: fix heap mapping for nommu

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jun 13 21:49:01 2010 +0200

nucleus: fix heap mapping for nommu

Despite the kernel sees a single backing device with direct mapping
capabilities on nommu targets (/dev/rtheap), we do map different heaps
through it, so we want a brand new mapping region for each of
them. Therefore, we must make sure to request mappings on
non-overlapping areas.

To this end, we request mappings from offsets representing the start
RAM address of the heap memory instead of mapping from offset 0 like
previously.  Otherwise, the kernel could match the same region for
different heaps, for all mmap() requests directed to /dev/rtheap which
appear to be a subset of a previous one, i.e. [offset=0, length =
largest mapped size to date]. Which does happen most of the time.

Basically, this also means that shared heap mapping on nommu systems
has always been badly broken on all Xenomai releases prior to this
commit. Yeepeee.

For this reason, we do break the nommu ABI to introduce this fix
(i.e. blackfin and nios2), simply because the previous implementation
did not work at all.

---

 include/asm-blackfin/features.h |2 +-
 include/asm-nios2/features.h|2 +-
 include/native/heap.h   |   14 +++--
 include/native/queue.h  |   14 +++--
 include/nucleus/heap.h  |   19 +++--
 include/vrtx/vrtx.h |8 ++---
 ksrc/nucleus/heap.c |   53 +--
 ksrc/nucleus/shadow.c   |   13 ++---
 ksrc/skins/native/syscall.c |7 +++--
 ksrc/skins/posix/syscall.c  |   10 +--
 ksrc/skins/psos+/syscall.c  |2 +
 ksrc/skins/vrtx/syscall.c   |4 +-
 src/skins/common/sem_heap.c |   41 +
 src/skins/native/heap.c |9 +-
 src/skins/native/queue.c|   10 ++-
 src/skins/psos+/rn.c|9 +-
 src/skins/rtai/shm.c|8 -
 src/skins/vrtx/heap.c   |8 -
 src/skins/vrtx/pt.c |8 -
 19 files changed, 152 insertions(+), 89 deletions(-)

diff --git a/include/asm-blackfin/features.h b/include/asm-blackfin/features.h
index 9dbee9c..c365c38 100644
--- a/include/asm-blackfin/features.h
+++ b/include/asm-blackfin/features.h
@@ -22,7 +22,7 @@
 #include asm-generic/xenomai/features.h
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   3UL
+#define XENOMAI_ABI_REV   4UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/include/asm-nios2/features.h b/include/asm-nios2/features.h
index eb4589a..534c052 100644
--- a/include/asm-nios2/features.h
+++ b/include/asm-nios2/features.h
@@ -36,7 +36,7 @@ static inline void collect_arch_features(struct xnfeatinfo 
*finfo)
 #endif
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   1UL
+#define XENOMAI_ABI_REV   2UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/include/native/heap.h b/include/native/heap.h
index 0c2a7a2..443fd82 100644
--- a/include/native/heap.h
+++ b/include/native/heap.h
@@ -58,15 +58,11 @@ typedef struct rt_heap_info {
 } RT_HEAP_INFO;
 
 typedef struct rt_heap_placeholder {
-
-xnhandle_t opaque;
-
-void *opaque2;
-
-caddr_t mapbase;
-
-size_t mapsize;
-
+   xnhandle_t opaque;
+   void *opaque2;
+   caddr_t mapbase;
+   size_t mapsize;
+   xnheap_area_decl();
 } RT_HEAP_PLACEHOLDER;
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
diff --git a/include/native/queue.h b/include/native/queue.h
index 2951c42..b266c1d 100644
--- a/include/native/queue.h
+++ b/include/native/queue.h
@@ -58,15 +58,11 @@ typedef struct rt_queue_info {
 } RT_QUEUE_INFO;
 
 typedef struct rt_queue_placeholder {
-
-xnhandle_t opaque;
-
-void *opaque2;
-
-caddr_t mapbase;
-
-size_t mapsize;
-
+   xnhandle_t opaque;
+   void *opaque2;
+   caddr_t mapbase;
+   size_t mapsize;
+   xnheap_area_decl();
 } RT_QUEUE_PLACEHOLDER;
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index f4ebe11..e837bf2 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -208,14 +208,17 @@ void xnheap_destroy_mapped(xnheap_t *heap,
   void (*release)(struct xnheap *heap),
   void __user *mapaddr);
 
+#define xnheap_base_memory(heap) \
+   ((caddr_t)(heap)-archdep.heapbase)
+
 #define xnheap_mapped_offset(heap,ptr) \
-(((caddr_t)(ptr)) - ((caddr_t)(heap)-archdep.heapbase))
+   (((caddr_t)(ptr)) - xnheap_base_memory(heap))
 
 #define xnheap_mapped_address(heap,off) \
-(((caddr_t)(heap)-archdep.heapbase) + (off))
+   (xnheap_base_memory(heap) + (off))
 
 #define 

[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2. 10-01, 2.6.34-powerpc-2.10-00

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 11:31:28 2010 +0200

powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2.10-01, 
2.6.34-powerpc-2.10-00

---

 ksrc/arch/powerpc/patches/README   |8 +
 .../adeos-ipipe-2.6.30.3-powerpc-DENX-2.7-06.patch |11728 
 ... = adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch} |  460 +-
 ...ch = adeos-ipipe-2.6.34-powerpc-2.10-00.patch} |  428 +-
 4 files changed, 548 insertions(+), 12076 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-rpm.git;a=commitdiff;h=b22c366f20cd7e6ac64471c1c58418dd22d979c2

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6. 34-x86-2.7-00

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 14:47:01 2010 +0200

x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-00, 2.6.34-x86-2.7-00

---

 .../patches/adeos-ipipe-2.6.32.15-x86-2.7-00.patch |11475 +++
 .../patches/adeos-ipipe-2.6.34-x86-2.7-00.patch|11570 
 2 files changed, 23045 insertions(+), 0 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-rpm.git;a=commitdiff;h=42dc7e778d1441a4fe325148829ad9748989eb6a

___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : arm: upgrade I-pipe support to 2.6.33-arm-1.17-00

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun 12 09:38:33 2010 +0200

arm: upgrade I-pipe support to 2.6.33-arm-1.17-00

---

 patch = adeos-ipipe-2.6.33-arm-1.17-00.patch} |  263 +---
 1 files changed, 168 insertions(+), 95 deletions(-)

diff --git a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.16-01.patch 
b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
similarity index 98%
rename from ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.16-01.patch
rename to ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
index cbb3fb6..d2ab300 100644
--- a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.16-01.patch
+++ b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
@@ -630,7 +630,7 @@ index 000..cfdf14a
 +#endif /* __ASM_ARM_FCSE_H */
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 000..8ae0cb3
+index 000..ada91f3
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -665,10 +665,10 @@ index 000..8ae0cb3
 +#include linux/ipipe_percpu.h
 +#include mach/irqs.h/* For __IPIPE_FEATURE_PIC_MUTE */
 +
-+#define IPIPE_ARCH_STRING 1.16-01
++#define IPIPE_ARCH_STRING 1.17-00
 +#define IPIPE_MAJOR_NUMBER1
-+#define IPIPE_MINOR_NUMBER16
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_MINOR_NUMBER17
++#define IPIPE_PATCH_NUMBER0
 +
 +#ifdef CONFIG_SMP
 +#error I-pipe/arm: SMP not yet implemented
@@ -880,7 +880,7 @@ index 000..8ae0cb3
 +} while(0)
 +
 +#define __ipipe_syscall_watched_p(p, sc)  \
-+  (((p)-flags  PF_EVNOTIFY) || (unsigned long)sc = __ARM_NR_BASE + 64)
++  (ipipe_notifier_enabled_p(p) || (unsigned long)sc = __ARM_NR_BASE + 64)
 +
 +#define __ipipe_root_tick_p(regs) (!raw_irqs_disabled_flags(regs-ARM_cpsr))
 +
@@ -910,10 +910,10 @@ index 000..8ae0cb3
 +#endif/* !__ARM_IPIPE_H */
 diff --git a/arch/arm/include/asm/ipipe_base.h 
b/arch/arm/include/asm/ipipe_base.h
 new file mode 100644
-index 000..20e97a4
+index 000..f78523d
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe_base.h
-@@ -0,0 +1,108 @@
+@@ -0,0 +1,109 @@
 +/* -*- linux-c -*-
 + * arch/arm/include/asm/ipipe_base.h
 + *
@@ -966,7 +966,8 @@ index 000..20e97a4
 +#define IPIPE_EVENT_INIT  (IPIPE_FIRST_EVENT + 4)
 +#define IPIPE_EVENT_EXIT  (IPIPE_FIRST_EVENT + 5)
 +#define IPIPE_EVENT_CLEANUP   (IPIPE_FIRST_EVENT + 6)
-+#define IPIPE_LAST_EVENT  IPIPE_EVENT_CLEANUP
++#define IPIPE_EVENT_RETURN(IPIPE_FIRST_EVENT + 7)
++#define IPIPE_LAST_EVENT  IPIPE_EVENT_RETURN
 +#define IPIPE_NR_EVENTS   (IPIPE_LAST_EVENT + 1)
 +
 +#ifndef __ASSEMBLY__
@@ -2706,10 +2707,10 @@ index 000..1b9550c
 +#endif /* CONFIG_ARM_FCSE_MESSAGES */
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
-index 000..41b1013
+index 000..0ee9ee1
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe.c
-@@ -0,0 +1,549 @@
+@@ -0,0 +1,571 @@
 +/* -*- linux-c -*-
 + * linux/arch/arm/kernel/ipipe.c
 + *
@@ -3062,11 +3063,17 @@ index 000..41b1013
 +asmlinkage int __ipipe_syscall_root(unsigned long scno, struct pt_regs *regs)
 +{
 +  struct ipipe_percpu_domain_data *p;
-+  unsigned long flags, origr7;
++  unsigned long orig_r7;
++int ret = 0;
 +
-+  /* We use r7 to pass the syscall number to the other domains */
-+  origr7 = regs-ARM_r7;
++  WARN_ON_ONCE(irqs_disabled_hw());
++
++  /*
++   * We use r7 to pass the syscall number to the other domains.
++   */
++  orig_r7 = regs-ARM_r7;
 +  regs-ARM_r7 = __NR_SYSCALL_BASE + scno;
++
 +  /*
 +   * This routine either returns:
 +   * 0 -- if the syscall is to be passed to Linux;
@@ -3076,32 +3083,36 @@ index 000..41b1013
 +   * tail work has to be performed (for handling signals etc).
 +   */
 +
-+  WARN_ON_ONCE(irqs_disabled_hw());
-+
 +  if (!__ipipe_syscall_watched_p(current, regs-ARM_r7) ||
 +  !__ipipe_event_monitored_p(IPIPE_EVENT_SYSCALL))
-+  goto done;
++  goto out;
 +
-+  if (__ipipe_dispatch_event(IPIPE_EVENT_SYSCALL,regs)  0){
-+  if (ipipe_root_domain_p  !in_atomic()) {
-+  /*
-+   * Sync pending VIRQs before _TIF_NEED_RESCHED
-+   * is tested.
-+   */
-+  local_irq_save_hw(flags);
-+  p = ipipe_root_cpudom_ptr();
-+  if (__ipipe_ipending_p(p))
-+  __ipipe_sync_pipeline(IPIPE_IRQ_DOVIRT);
-+  local_irq_restore_hw(flags);
-+  regs-ARM_r7 = origr7;
-+  return -1;
-+  }
-+ 

[Xenomai-git] Philippe Gerum : nucleus: introduce generic bits for MAYDAY support

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun  5 11:39:24 2010 +0200

nucleus: introduce generic bits for MAYDAY support

This patch enables the nucleus to force a user-space thread running
syscall-less code in primary mode, to call the nucleus back on its way
out from an interrupt via a dedicated syscall (__xn_sys_mayday).

This feature is currently useful for recovering gracefully from a
runaway thread situation detected by the nucleus watchdog. Instead of
killing the runaway thread bluntly, this feature allows to force a
relax on it, despite the syscall-less nature of the code it was
running in primary mode.

The trick is to force the thread to run a piece of user-space code
that issues the mayday syscall, by fixing up its program counter on
its way back to userland. This code is laid on the special mayday
page, mapped to the process address space at binding time. The
implementation relies on the new IPIPE_EVENT_RETURN notification
available from the latest I-pipe patches, to run the fixup code.

In the future, Xenomai real-time signals will be rebased on this
feature to make them able to preempt syscall-less code as well.  In
the same move, the mayday page allocation and setup should move to
user-space. We do this from kernel space for now only to preserve the
2.5.x ABI.

---

 include/asm-generic/hal.h |   28 ++-
 include/asm-generic/syscall.h |1 +
 include/nucleus/ppd.h |4 +
 include/nucleus/shadow.h  |   10 ++
 ksrc/nucleus/sched.c  |1 +
 ksrc/nucleus/shadow.c |  186 ++---
 6 files changed, 216 insertions(+), 14 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index f03219d..f90cafa 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -259,7 +259,7 @@ static int hdlr (unsigned event, struct ipipe_domain *ipd, 
void *data) \
 static int hdlr (unsigned event, struct ipipe_domain *ipd, void *data) \
 {  \
struct task_struct *p = (struct task_struct *)data; \
-   do_##hdlr(p,p-rt_priority);\
+   do_##hdlr(p, p-rt_priority);   \
return RTHAL_EVENT_PROPAGATE;   \
 }
 
@@ -287,6 +287,14 @@ static int hdlr (unsigned event, struct ipipe_domain *ipd, 
void *data) \
return RTHAL_EVENT_PROPAGATE;  \
 }
 
+#define RTHAL_DECLARE_MAYDAY_EVENT(hdlr) \
+static int hdlr(unsigned event, struct ipipe_domain *ipd, void *data) \
+{\
+   struct pt_regs *regs = data;  \
+   do_##hdlr(regs);  \
+   return RTHAL_EVENT_PROPAGATE; \
+}
+
 #ifndef TASK_ATOMICSWITCH
 #ifdef CONFIG_PREEMPT
 /* We want this feature for preemptible kernels, or the behaviour when
@@ -321,6 +329,15 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_set_foreign_stack(ipd)   ipipe_set_foreign_stack(ipd)
 #define rthal_clear_foreign_stack(ipd) ipipe_clear_foreign_stack(ipd)
 
+#ifdef __IPIPE_FEATURE_ENABLE_NOTIFIER
+#define rthal_enable_notifier(p)   ipipe_enable_notifier(p)
+#else
+static inline void rthal_enable_notifier(struct task_struct *p)
+{
+   p-flags |= PF_EVNOTIFY;
+}
+#endif
+
 #define rthal_catch_cleanup(hdlr) \
 ipipe_catch_event(ipipe_root_domain,IPIPE_EVENT_CLEANUP,hdlr)
 #define rthal_catch_taskexit(hdlr) \
@@ -338,6 +355,15 @@ static inline void clear_task_nowakeup(struct task_struct 
*p)
 #define rthal_catch_exception(ex,hdlr) \
 ipipe_catch_event(rthal_domain,ex|IPIPE_EVENT_SELF,hdlr)
 
+#ifdef IPIPE_EVENT_RETURN
+#define RTHAL_HAVE_RETURN_EVENT
+#define rthal_catch_return(hdlr) \
+ipipe_catch_event(rthal_domain,IPIPE_EVENT_RETURN,hdlr)
+#define rthal_return_intercept(p)  ipipe_return_notify(p)
+#else
+#define rthal_catch_return(hdlr)   do { } while(0)
+#endif
+
 #define rthal_register_domain(_dom,_name,_id,_prio,_entry) \
 ({ \
struct ipipe_domain_attr attr;  \
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 3f10065..7e3d01a 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -47,6 +47,7 @@
 #define __xn_sys_current_info  9   /* r = xnshadow_current_info(info) */
 #define __xn_sys_get_next_sigs 10  /* only unqueue pending signals. */
 #define __xn_sys_drop_u_mode   11  /* stop updating thread-u_mode */

[Xenomai-git] Philippe Gerum : x86: enable MAYDAY support

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jun  6 16:25:36 2010 +0200

x86: enable MAYDAY support

---

 include/asm-x86/bits/shadow_32.h |  111 ++
 include/asm-x86/bits/shadow_64.h |   71 
 include/asm-x86/system_32.h  |7 +++
 include/asm-x86/system_64.h  |7 +++
 4 files changed, 196 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/bits/shadow_32.h b/include/asm-x86/bits/shadow_32.h
index 9fc37a2..40ccc62 100644
--- a/include/asm-x86/bits/shadow_32.h
+++ b/include/asm-x86/bits/shadow_32.h
@@ -49,4 +49,115 @@ static void xnarch_schedule_tail(struct task_struct *prev)
wrap_switch_iobitmap(prev, rthal_processor_id());
 }
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+*  b8 2b 02 00 0c  mov$mux_code,%eax
+*  bd 00 00 00 00  mov$0x0,%ebp
+* if HAVE_SEP
+*  65 ff 15 10 00 00 00call   *%gs:0x10
+* else
+*  cd 80   int$0x80
+* endif
+*  0f 0b   ud2a
+*
+* We intentionally don't mess with EFLAGS here, so that we
+* don't have to save/restore it in handle/fixup code.
+*
+* Also note that if SEP is present, we always assume NPTL on
+* the user side.
+*/
+   static const struct {
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_eax;
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_ebp;
+   struct __attribute__ ((__packed__)) {
+   u8 op[3];
+   u32 moffs;
+   } syscall;
+   u16 bug;
+   } code_sep = {
+   .mov_eax = {
+   .op = 0xb8,
+   .imm = __xn_mux_code(0, __xn_sys_mayday)
+   },
+   .mov_ebp = {
+   .op = 0xbd,
+   .imm = 0
+   },
+   .syscall = {
+   .op = {
+   0x65, 0xff, 0x15
+   },
+   .moffs = 0x10
+   },
+   .bug = 0x0b0f,
+   };
+
+   static const struct {
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_eax;
+   struct __attribute__ ((__packed__)) {
+   u8 op;
+   u32 imm;
+   } mov_ebp;
+   u16 syscall;
+   u16 bug;
+   } code_nosep = {
+   .mov_eax = {
+   .op = 0xb8,
+   .imm = __xn_mux_code(0, __xn_sys_mayday)
+   },
+   .mov_ebp = {
+   .op = 0xbd,
+   .imm = 0
+   },
+   .syscall = 0x80cd,
+   .bug = 0x0b0f,
+   };
+
+   if (cpu_has_sep)
+   memcpy(page, code_sep, sizeof(code_sep));
+   else
+   memcpy(page, code_nosep, sizeof(code_nosep));
+
+   /* no cache flush required. */
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb-mayday.eip = regs-x86reg_ip;
+   tcb-mayday.eax = regs-x86reg_ax;
+   tcb-mayday.ebp = regs-x86reg_bp;
+   regs-x86reg_ip = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs-x86reg_ip = tcb-mayday.eip;
+   regs-x86reg_ax = tcb-mayday.eax;
+   regs-x86reg_bp = tcb-mayday.ebp;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_X86_BITS_SHADOW_32_H */
diff --git a/include/asm-x86/bits/shadow_64.h b/include/asm-x86/bits/shadow_64.h
index ddaa86a..41a266f 100644
--- a/include/asm-x86/bits/shadow_64.h
+++ b/include/asm-x86/bits/shadow_64.h
@@ -52,4 +52,75 @@ static void xnarch_schedule_tail(struct task_struct *prev)
 {
 }
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+*  b8 2b 02 00 0c  mov$mux_code,%eax
+*  49 c7 c1 00 00 

[Xenomai-git] Philippe Gerum : arm: enable MAYDAY support

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sat Jun 12 08:28:29 2010 +0200

arm: enable MAYDAY support

---

 include/asm-arm/bits/shadow.h |  111 +
 include/asm-arm/system.h  |   10 
 2 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/include/asm-arm/bits/shadow.h b/include/asm-arm/bits/shadow.h
index a396510..6021dad 100644
--- a/include/asm-arm/bits/shadow.h
+++ b/include/asm-arm/bits/shadow.h
@@ -27,6 +27,8 @@
 #error Pure kernel header included from user-space!
 #endif
 
+#include asm/cacheflush.h
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -182,4 +184,113 @@ static inline int xnarch_local_syscall(struct pt_regs 
*regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+* ifdef ARM_EABI
+*
+* e3a00f8a mov r0, #552; 0x228
+* e28003c3 add r0, r0, #201326595  ; 0xc03
+* e3a0780f mov r7, #983040 ; 0xf
+* e2877042 add r7, r7, #66 ; 0x42
+* e3a06000 mov r6, #0
+* ef00 svc 0x
+* e3a0 mov r0, #0
+* e580 str r0, [r0]; bug
+*
+* elif ARM_OABI
+*
+* e3a00f8a mov r0, #552; 0x228
+* e28003c3 add r0, r0, #201326595  ; 0xc03
+* e3a06000 mov r6, #0
+* ef9f0042 swi 0x009f0042
+* e3a0 mov r0, #0
+* e580 str r0, [r0]; bug
+*
+* endif
+*
+* 32bit instruction words will be laid out by the compiler as
+* the target endianness requires.
+*
+* We don't mess with CPSR here, so no need to save/restore it
+* in handle/fixup code.
+*/
+#ifdef CONFIG_XENO_ARM_EABI
+   static const struct {
+   u32 mov_muxl;
+   u32 add_muxh;
+   u32 mov_sysh;
+   u32 add_sysl;
+   u32 mov_sigp;
+   u32 swi_0;
+   u32 mov_r0;
+   u32 str_r0;
+   } code = {
+   .mov_muxl = 0xe3a00f8a,
+   .add_muxh = 0xe28003c3,
+   .mov_sysh = 0xe3a0780f,
+   .add_sysl = 0xe2877042,
+   .mov_sigp = 0xe3a06000,
+   .swi_0 = 0xef00,
+   .mov_r0 = 0xe3a0,
+   .str_r0 = 0xe580
+   };
+#else /* OABI */
+   static const struct {
+   u32 mov_muxl;
+   u32 add_muxh;
+   u32 mov_sigp;
+   u32 swi_syscall;
+   u32 mov_r0;
+   u32 str_r0;
+   } code = {
+   .mov_muxl = 0xe3a00f8a,
+   .add_muxh = 0xe28003c3,
+   .mov_sigp = 0xe3a06000,
+   .swi_syscall = 0x009f0042,
+   .mov_r0 = 0xe3a0,
+   .str_r0 = 0xe580
+   };
+#endif /* OABI */
+
+   memcpy(page, code, sizeof(code));
+
+   flush_dcache_page(vmalloc_to_page(page));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb-mayday.pc = regs-ARM_pc;
+   tcb-mayday.r0 = regs-ARM_r0;
+   tcb-mayday.r6 = regs-ARM_r6;
+#ifdef CONFIG_XENO_ARM_EABI
+   tcb-mayday.r7 = regs-ARM_r7;
+#endif
+   regs-ARM_pc = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs-ARM_pc = tcb-mayday.pc;
+   regs-ARM_r0 = tcb-mayday.r0;
+   regs-ARM_r6 = tcb-mayday.r6;
+#ifdef CONFIG_XENO_ARM_EABI
+   regs-ARM_r7 = tcb-mayday.r7;
+#endif
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_ARM_BITS_SHADOW_H */
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 3cbf43b..2b7b734 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -69,6 +69,16 @@ typedef struct xnarchtcb {  /* Per-thread arch-dependent 
block */
struct mm_struct *active_mm;
struct thread_info ti;  /* Holds kernel-based thread info */
struct thread_info *tip;/* Pointer to the active thread 
info (ti or user-thread_info). */
+#ifdef 

[Xenomai-git] Philippe Gerum : arm: upgrade I-pipe support to 2.6.33-arm-1.17-01

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun 14 11:45:16 2010 +0200

arm: upgrade I-pipe support to 2.6.33-arm-1.17-01

---

 patch = adeos-ipipe-2.6.33-arm-1.17-01.patch} |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch 
b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-01.patch
similarity index 99%
rename from ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
rename to ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-01.patch
index d2ab300..22f5d3f 100644
--- a/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-00.patch
+++ b/ksrc/arch/arm/patches/adeos-ipipe-2.6.33-arm-1.17-01.patch
@@ -630,7 +630,7 @@ index 000..cfdf14a
 +#endif /* __ASM_ARM_FCSE_H */
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 000..ada91f3
+index 000..f8880e0
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -665,10 +665,10 @@ index 000..ada91f3
 +#include linux/ipipe_percpu.h
 +#include mach/irqs.h/* For __IPIPE_FEATURE_PIC_MUTE */
 +
-+#define IPIPE_ARCH_STRING 1.17-00
++#define IPIPE_ARCH_STRING 1.17-01
 +#define IPIPE_MAJOR_NUMBER1
 +#define IPIPE_MINOR_NUMBER17
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
 +
 +#ifdef CONFIG_SMP
 +#error I-pipe/arm: SMP not yet implemented
@@ -10835,10 +10835,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..fdb84db
+index 000..75f5d42
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1970 @@
+@@ -0,0 +1,1971 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -12797,6 +12797,7 @@ index 000..fdb84db
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL)  defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : blackfin: enable MAYDAY support

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jun 13 17:26:05 2010 +0200

blackfin: enable MAYDAY support

---

 include/asm-blackfin/bits/shadow.h |   78 
 include/asm-blackfin/system.h  |7 +++
 2 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/include/asm-blackfin/bits/shadow.h 
b/include/asm-blackfin/bits/shadow.h
index f44d25d..1a77fe4 100644
--- a/include/asm-blackfin/bits/shadow.h
+++ b/include/asm-blackfin/bits/shadow.h
@@ -24,6 +24,8 @@
 #error Pure kernel header included from user-space!
 #endif
 
+#include asm/cacheflush.h
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -66,4 +68,80 @@ static inline int xnarch_local_syscall(struct pt_regs *regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+* 45 e1 0c 00R5.H = 0xc
+* 05 e1 2b 02R5.L = 0x22b
+* 05 32  P0 = R5
+* 05 60  R5 = 0x0 (X)
+* a0 00  EXCPT 0x0
+* cd ef  bug opcode
+*
+* We don't mess with ASTAT here, so no need to save/restore
+* it in handle/fixup code.
+*/
+   static const struct {
+   struct __attribute__ ((__packed__)) {
+   u16 op;
+   u16 imm;
+   } load_r5h;
+   struct __attribute__ ((__packed__)) {
+   u16 op;
+   u16 imm;
+   } load_r5l;
+   u16 mov_p0;
+   u16 clear_r5;
+   u16 syscall;
+   u16 bug;
+   } code = {
+   .load_r5h = {
+   .op = 0xe145,
+   .imm = __xn_mux_code(0, __xn_sys_mayday)  16
+   },
+   .load_r5l = {
+   .op = 0xe105,
+   .imm = __xn_mux_code(0, __xn_sys_mayday)  0x
+   },
+   .mov_p0 = 0x3205,
+   .clear_r5 = 0x6005,
+   .syscall = 0x00a0,
+   .bug = BFIN_BUG_OPCODE,
+   };
+
+   memcpy(page, code, sizeof(code));
+
+   flush_dcache_range((unsigned long)page,
+  (unsigned long)page + sizeof(code));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb-mayday.pc = regs-pc;
+   tcb-mayday.p0 = regs-p0;
+   tcb-mayday.r5 = regs-r5;
+   regs-pc = tramp;   /* i.e. RETI */
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs-pc = tcb-mayday.pc;
+   regs-p0 = tcb-mayday.p0;
+   regs-r5 = tcb-mayday.r5;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_BLACKFIN_BITS_SHADOW_H */
diff --git a/include/asm-blackfin/system.h b/include/asm-blackfin/system.h
index f7a46b2..b4be882 100644
--- a/include/asm-blackfin/system.h
+++ b/include/asm-blackfin/system.h
@@ -53,6 +53,13 @@ typedef struct xnarchtcb {   /* Per-thread arch-dependent 
block */
 struct task_struct *active_task;/* Active user-space task */
 #endif
 struct thread_struct *tsp; /* Pointer to the active thread struct (ts or 
user-thread). */
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   unsigned long pc;
+   unsigned long p0;
+   unsigned long r5;
+   } mayday;
+#endif
 
 /* Init block */
 struct xnthread *self;


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : blackfin: upgrade I-pipe support to 2.6.34-blackfin-1. 14-01

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun 14 11:46:02 2010 +0200

blackfin: upgrade I-pipe support to 2.6.34-blackfin-1.14-01

---

 ...h = adeos-ipipe-2.6.34-blackfin-1.14-01.patch} |   28 +++
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git 
a/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-00.patch 
b/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-01.patch
similarity index 99%
rename from ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-00.patch
rename to ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-01.patch
index e57f536..d62e225 100644
--- a/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-00.patch
+++ b/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-01.patch
@@ -1,21 +1,36 @@
+diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
+index c078849..799b1c0 100644
+--- a/arch/blackfin/Kconfig
 b/arch/blackfin/Kconfig
+@@ -84,6 +84,8 @@ source kernel/Kconfig.freezer
+ 
+ menu Blackfin Processor Options
+ 
++source kernel/ipipe/Kconfig
++
+ comment Processor and Board Settings
+ 
+ choice
 diff --git a/arch/blackfin/include/asm/ipipe.h 
b/arch/blackfin/include/asm/ipipe.h
-index d3b4044..32b7bad 100644
+index d3b4044..331ef0b 100644
 --- a/arch/blackfin/include/asm/ipipe.h
 +++ b/arch/blackfin/include/asm/ipipe.h
-@@ -34,10 +34,11 @@
+@@ -34,11 +34,12 @@
  #include asm/bitops.h
  #include asm/atomic.h
  #include asm/traps.h
 +#include asm/bitsperlong.h
  
 -#define IPIPE_ARCH_STRING 1.12-00
-+#define IPIPE_ARCH_STRING 1.14-00
++#define IPIPE_ARCH_STRING 1.14-01
  #define IPIPE_MAJOR_NUMBER1
 -#define IPIPE_MINOR_NUMBER12
+-#define IPIPE_PATCH_NUMBER0
 +#define IPIPE_MINOR_NUMBER14
- #define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
  
  #ifdef CONFIG_SMP
+ #error I-pipe/blackfin: SMP not implemented
 @@ -129,11 +130,11 @@ void __ipipe_enable_pipeline(void);
  #define __ipipe_hook_critical_ipi(ipd) do { } while (0)
  
@@ -2679,10 +2694,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..b7d863d
+index 000..e2503bd
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1976 @@
+@@ -0,0 +1,1977 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -4647,6 +4662,7 @@ index 000..b7d863d
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL)  defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nios2: enable MAYDAY support

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun 14 18:24:14 2010 +0200

nios2: enable MAYDAY support

---

 include/asm-nios2/bits/shadow.h |   65 +++
 include/asm-nios2/system.h  |8 +
 2 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/include/asm-nios2/bits/shadow.h b/include/asm-nios2/bits/shadow.h
index 1d1969a..8917045 100644
--- a/include/asm-nios2/bits/shadow.h
+++ b/include/asm-nios2/bits/shadow.h
@@ -24,6 +24,8 @@
 #error Pure kernel header included from user-space!
 #endif
 
+#include asm/cacheflush.h
+
 static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb,
  struct xnthread *thread,
  const char *name)
@@ -63,4 +65,67 @@ static inline int xnarch_local_syscall(struct pt_regs *regs)
 
 #define xnarch_schedule_tail(prev) do { } while(0)
 
+#ifdef XNARCH_HAVE_MAYDAY
+
+static inline void xnarch_setup_mayday_page(void *page)
+{
+   /*
+* We want this code to appear at the top of the MAYDAY page:
+*
+*  00c00334movhi   r3,#__xn_sys_mayday
+*  18c08ac4addir3,r3,#__xn_sys_mux
+*  0084movir2,0
+*  0244movir9,0
+*  003b683atrap
+*  003fff06br  .
+*/
+   static const struct {
+   u32 movhi_r3h;
+   u32 addi_r3l;
+   u32 movi_r2;
+   u32 movi_r9;
+   u32 syscall;
+   u32 bug;
+   } code = {
+   .movhi_r3h = 0x00c00334,
+   .addi_r3l = 0x18c08ac4,
+   .movi_r2 = 0x0084,
+   .movi_r9 = 0x0244,
+   .syscall = 0x003b683a,
+   .bug = 0x003fff06
+   };
+
+   memcpy(page, code, sizeof(code));
+
+   flush_dcache_range((unsigned long)page,
+  (unsigned long)page + sizeof(code));
+}
+
+static inline void xnarch_call_mayday(void)
+{
+   rthal_return_intercept(current);
+}
+
+static inline void xnarch_handle_mayday(struct xnarchtcb *tcb,
+   struct pt_regs *regs,
+   unsigned long tramp)
+{
+   tcb-mayday.ea = regs-ea;
+   tcb-mayday.r2 = regs-r2;
+   tcb-mayday.r3 = regs-r3;
+   tcb-mayday.r9 = regs-r9;
+   regs-ea = tramp;
+}
+
+static inline void xnarch_fixup_mayday(struct xnarchtcb *tcb,
+  struct pt_regs *regs)
+{
+   regs-ea = tcb-mayday.ea;
+   regs-r2 = tcb-mayday.r2;
+   regs-r3 = tcb-mayday.r3;
+   regs-r9 = tcb-mayday.r9;
+}
+
+#endif /* XNARCH_HAVE_MAYDAY */
+
 #endif /* !_XENO_ASM_NIOS2_BITS_SHADOW_H */
diff --git a/include/asm-nios2/system.h b/include/asm-nios2/system.h
index 65426d1..a31aadf 100644
--- a/include/asm-nios2/system.h
+++ b/include/asm-nios2/system.h
@@ -48,6 +48,14 @@ typedef struct xnarchtcb {   /* Per-thread arch-dependent 
block */
struct thread_struct ts;/* Holds kernel-based thread context. */
struct task_struct *user_task;  /* Shadowed user-space task */
struct thread_struct *tsp;  /* Active thread struct */
+#ifdef XNARCH_HAVE_MAYDAY
+   struct {
+   unsigned long ea;
+   unsigned long r2;
+   unsigned long r3;
+   unsigned long r9;
+   } mayday;
+#endif
 
/* Init block */
struct xnthread *self;


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2. 10-02, 2.6.34-powerpc-2.10-01

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun 14 11:47:15 2010 +0200

powerpc: upgrade I-pipe support to 2.6.33.5-powerpc-2.10-02, 
2.6.34-powerpc-2.10-01

---

 ... = adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch} |   11 ++-
 ...ch = adeos-ipipe-2.6.34-powerpc-2.10-01.patch} |   11 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git 
a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch
index 8cf975e..9ae5e24 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-01.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.33.5-powerpc-2.10-02.patch
@@ -262,7 +262,7 @@ index bd100fc..8fa1901 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..b8befae
+index 000..8ec5cd7
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,276 @@
@@ -313,10 +313,10 @@ index 000..b8befae
 +#include asm/paca.h
 +#endif
 +
-+#define IPIPE_ARCH_STRING 2.10-01
++#define IPIPE_ARCH_STRING 2.10-02
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER10
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_PATCH_NUMBER2
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -7871,10 +7871,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..fdb84db
+index 000..75f5d42
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1970 @@
+@@ -0,0 +1,1971 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -9833,6 +9833,7 @@ index 000..fdb84db
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL)  defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif
diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-00.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-01.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-00.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-01.patch
index aa050eb..ba5e550 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-00.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-01.patch
@@ -262,7 +262,7 @@ index bd100fc..8fa1901 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..f345359
+index 000..4bb5021
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,277 @@
@@ -313,10 +313,10 @@ index 000..f345359
 +#include asm/paca.h
 +#endif
 +
-+#define IPIPE_ARCH_STRING 2.10-00
++#define IPIPE_ARCH_STRING 2.10-01
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER10
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -7295,10 +7295,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..b7d863d
+index 000..e2503bd
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1976 @@
+@@ -0,0 +1,1977 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -9263,6 +9263,7 @@ index 000..b7d863d
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL)  defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-01, 2.6. 34-x86-2.7-01

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun 14 11:48:11 2010 +0200

x86: upgrade I-pipe support to 2.6.32.15-x86-2.7-01, 2.6.34-x86-2.7-01

---

 ...atch = adeos-ipipe-2.6.32.15-x86-2.7-01.patch} |   11 ++-
 ...0.patch = adeos-ipipe-2.6.34-x86-2.7-01.patch} |   11 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.15-x86-2.7-00.patch 
b/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.15-x86-2.7-01.patch
similarity index 99%
rename from ksrc/arch/x86/patches/adeos-ipipe-2.6.32.15-x86-2.7-00.patch
rename to ksrc/arch/x86/patches/adeos-ipipe-2.6.32.15-x86-2.7-01.patch
index 57287d9..fa5203e 100644
--- a/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.15-x86-2.7-00.patch
+++ b/ksrc/arch/x86/patches/adeos-ipipe-2.6.32.15-x86-2.7-01.patch
@@ -168,7 +168,7 @@ index 0b72282..6574056 100644
  /*
 diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h
 new file mode 100644
-index 000..a090aeb
+index 000..8b95530
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,158 @@
@@ -199,10 +199,10 @@ index 000..a090aeb
 +#ifdef CONFIG_IPIPE
 +
 +#ifndef IPIPE_ARCH_STRING
-+#define IPIPE_ARCH_STRING 2.7-00
++#define IPIPE_ARCH_STRING 2.7-01
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER7
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
 +#endif
 +
 +DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
@@ -6840,10 +6840,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..c6f4507
+index 000..b6731a4
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1954 @@
+@@ -0,0 +1,1955 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -8786,6 +8786,7 @@ index 000..c6f4507
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL)  defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif
diff --git a/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-00.patch 
b/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-01.patch
similarity index 99%
rename from ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-00.patch
rename to ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-01.patch
index 4d6b31b..d214c88 100644
--- a/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-00.patch
+++ b/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-01.patch
@@ -168,7 +168,7 @@ index 0b72282..6574056 100644
  /*
 diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h
 new file mode 100644
-index 000..92d6b4d
+index 000..ef806d7
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,181 @@
@@ -199,10 +199,10 @@ index 000..92d6b4d
 +#ifdef CONFIG_IPIPE
 +
 +#ifndef IPIPE_ARCH_STRING
-+#define IPIPE_ARCH_STRING 2.7-00
++#define IPIPE_ARCH_STRING 2.7-01
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER7
-+#define IPIPE_PATCH_NUMBER0
++#define IPIPE_PATCH_NUMBER1
 +#endif
 +
 +DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
@@ -6929,10 +6929,10 @@ index 000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 000..b7d863d
+index 000..e2503bd
 --- /dev/null
 +++ b/kernel/ipipe/core.c
-@@ -0,0 +1,1976 @@
+@@ -0,0 +1,1977 @@
 +/* -*- linux-c -*-
 + * linux/kernel/ipipe/core.c
 + *
@@ -8897,6 +8897,7 @@ index 000..b7d863d
 +EXPORT_SYMBOL(ipipe_send_ipi);
 +EXPORT_SYMBOL(__ipipe_pend_irq);
 +EXPORT_SYMBOL(__ipipe_set_irq_pending);
++EXPORT_SYMBOL(__ipipe_event_monitors);
 +#if defined(CONFIG_IPIPE_DEBUG_INTERNAL)  defined(CONFIG_SMP)
 +EXPORT_SYMBOL(__ipipe_check_percpu_access);
 +#endif


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : common: warn early about missing /dev/rtheap

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun 14 17:35:13 2010 +0200

common: warn early about missing /dev/rtheap

---

 include/nucleus/heap.h  |3 +--
 src/skins/common/bind.c |9 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/nucleus/heap.h b/include/nucleus/heap.h
index e837bf2..9758f5f 100644
--- a/include/nucleus/heap.h
+++ b/include/nucleus/heap.h
@@ -190,8 +190,6 @@ extern C {
 
 #ifdef __KERNEL__
 
-#define XNHEAP_DEV_MINOR 254
-
 int xnheap_mount(void);
 
 void xnheap_umount(void);
@@ -281,6 +279,7 @@ int xnheap_check_block(xnheap_t *heap,
 #endif /* __KERNEL__ || __XENO_SIM__ */
 
 #define XNHEAP_DEV_NAME  /dev/rtheap
+#define XNHEAP_DEV_MINOR 254
 
 #ifdef CONFIG_MMU
 /* XXX: 2.5.x ABI preserved for MMU-enabled only. */
diff --git a/src/skins/common/bind.c b/src/skins/common/bind.c
index d511072..fb15bf5 100644
--- a/src/skins/common/bind.c
+++ b/src/skins/common/bind.c
@@ -1,9 +1,11 @@
 #include stdio.h
 #include stdlib.h
 #include signal.h
+#include unistd.h
 #include string.h
 #include errno.h
 
+#include nucleus/heap.h
 #include asm/xenomai/syscall.h
 #include asm-generic/xenomai/bits/current.h
 #include asm-generic/xenomai/timeconv.h
@@ -86,6 +88,13 @@ xeno_bind_skin_opt(unsigned skin_magic, const char *skin,
xnfeatinfo_t finfo;
int muxid;
 
+   /* Some sanity checks first. */
+   if (access(XNHEAP_DEV_NAME, 0)) {
+   fprintf(stderr, Xenomai: %s is missing\n(chardev, major=10 
minor=%d)\n,
+   XNHEAP_DEV_NAME, XNHEAP_DEV_MINOR);
+   exit(EXIT_FAILURE);
+   }
+   
old_sigill_handler = signal(SIGILL, xeno_sigill_handler);
if (old_sigill_handler == SIG_ERR) {
perror(signal(SIGILL));


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus: fix uninit variable

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

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Jun 15 23:49:51 2010 +0200

nucleus: fix uninit variable

---

 ksrc/nucleus/select.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ksrc/nucleus/select.c b/ksrc/nucleus/select.c
index 29be0bc..656671d 100644
--- a/ksrc/nucleus/select.c
+++ b/ksrc/nucleus/select.c
@@ -179,7 +179,7 @@ EXPORT_SYMBOL_GPL(__xnselect_signal);
 void xnselect_destroy(struct xnselect *select_block)
 {
xnholder_t *holder;
-   int resched;
+   int resched = 0;
spl_t s;
 
xnlock_get_irqsave(nklock, s);


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[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 : rtai: disable for MMU-less and 64bit builds

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun 16 08:33:33 2010 +0200

rtai: disable for MMU-less and 64bit builds

This emulator is massively broken on those platforms, and fixing it
would require an ABI change, which would make no sense given that it
is on its way out.

---

 ksrc/skins/rtai/Kconfig |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ksrc/skins/rtai/Kconfig b/ksrc/skins/rtai/Kconfig
index ac411eb..2555354 100644
--- a/ksrc/skins/rtai/Kconfig
+++ b/ksrc/skins/rtai/Kconfig
@@ -1,10 +1,14 @@
 menuconfig XENO_SKIN_RTAI
-   depends on XENO_OPT_NUCLEUS
-   tristate RTAI emulator (DEPRECATED)
+   depends on XENO_OPT_NUCLEUS  MMU  WORD_SIZE != 64
+   tristate RTAI emulator (BROKEN, DEPRECATED)
help
 
An emulator of the RTAI system.
 
+   This emulator is actually broken beyond all recognition:
+   - on MMU-less targets
+   - on 64bit targets
+
WARNING: This emulator is DEPRECATED. It is planned for
removal in v2.6.x. Legacy applications depending on it should
be converted to the native Xenomai API, which provides


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : rtdm: fix memory mapping services for nommu platforms

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun 16 10:25:24 2010 +0200

rtdm: fix memory mapping services for nommu platforms

This patch is a follow-up to ada72009a, fixing the
rtdm_mmap/iomap_to_user() services, in the nommu case.

The rationale for it is that backing devices on nommu must have direct
mapping capabilities to support shared mapping requests (MAP_SHARED),
which are not available from /dev/zero.

We fix this by using /dev/rtheap instead of /dev/zero for issuing
non-anonymous mapping requests from rtdm_do_mmap(), since default caps
for character-based devices include BDI_CAP_MAP_DIRECT. In the same
move, we provide the missing .get_unmapped_area helper.

---

 ksrc/skins/rtdm/drvlib.c |   61 ++---
 1 files changed, 46 insertions(+), 15 deletions(-)

diff --git a/ksrc/skins/rtdm/drvlib.c b/ksrc/skins/rtdm/drvlib.c
index 68a661c..fe0cb64 100644
--- a/ksrc/skins/rtdm/drvlib.c
+++ b/ksrc/skins/rtdm/drvlib.c
@@ -1808,9 +1808,8 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
 
vaddr = (unsigned long)mmap_data-src_vaddr;
paddr = mmap_data-src_paddr;
-   if (!paddr)
-   /* kmalloc memory */
-   paddr = virt_to_phys((void *)vaddr);
+   if (paddr == 0) /* kmalloc memory? */
+   paddr = __pa(vaddr);
 
maddr = vma-vm_start;
size = vma-vm_end - vma-vm_start;
@@ -1834,6 +1833,8 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
xnarch_fault_range(vma);
ret = 0;
} else
+#else
+   vma-vm_pgoff = paddr  PAGE_SHIFT;
 #endif /* CONFIG_MMU */
if (mmap_data-src_paddr)
ret = xnarch_remap_io_page_range(filp, vma, maddr, paddr,
@@ -1848,22 +1849,43 @@ static int rtdm_mmap_buffer(struct file *filp, struct 
vm_area_struct *vma)
return ret;
 }
 
+#ifndef CONFIG_MMU
+static unsigned long rtdm_unmapped_area(struct file *file,
+   unsigned long addr,
+   unsigned long len,
+   unsigned long pgoff,
+   unsigned long flags)
+{
+   struct rtdm_mmap_data *mmap_data = file-private_data;
+   unsigned long pa;
+
+   pa = mmap_data-src_paddr;
+   if (pa == 0)
+   pa = __pa(mmap_data-src_vaddr);
+
+   return pa;
+}
+#else
+#define rtdm_unmapped_area  NULL
+#endif
+
 static struct file_operations rtdm_mmap_fops = {
.mmap = rtdm_mmap_buffer,
+   .get_unmapped_area = rtdm_unmapped_area
 };
 
 static int rtdm_do_mmap(rtdm_user_info_t *user_info,
struct rtdm_mmap_data *mmap_data,
size_t len, int prot, void **pptr)
 {
-   struct file *filp;
const struct file_operations *old_fops;
+   unsigned long u_addr;
void *old_priv_data;
-   void *user_ptr;
+   struct file *filp;
 
XENO_ASSERT(RTDM, xnpod_root_p(), return -EPERM;);
 
-   filp = filp_open(/dev/zero, O_RDWR, 0);
+   filp = filp_open(XNHEAP_DEV_NAME, O_RDWR, 0);
if (IS_ERR(filp))
return PTR_ERR(filp);
 
@@ -1874,8 +1896,8 @@ static int rtdm_do_mmap(rtdm_user_info_t *user_info,
filp-private_data = mmap_data;
 
down_write(user_info-mm-mmap_sem);
-   user_ptr = (void *)do_mmap(filp, (unsigned long)*pptr, len, prot,
-  MAP_SHARED, 0);
+   u_addr = do_mmap(filp, (unsigned long)*pptr, len, prot,
+MAP_SHARED, 0);
up_write(user_info-mm-mmap_sem);
 
filp-f_op = (typeof(filp-f_op))old_fops;
@@ -1883,10 +1905,11 @@ static int rtdm_do_mmap(rtdm_user_info_t *user_info,
 
filp_close(filp, user_info-files);
 
-   if (IS_ERR(user_ptr))
-   return PTR_ERR(user_ptr);
+   if (IS_ERR_VALUE(u_addr))
+   return (int)u_addr;
+
+   *pptr = (void *)u_addr;
 
-   *pptr = user_ptr;
return 0;
 }
 
@@ -1950,8 +1973,12 @@ int rtdm_mmap_to_user(rtdm_user_info_t *user_info,
  struct vm_operations_struct *vm_ops,
  void *vm_private_data)
 {
-   struct rtdm_mmap_data mmap_data =
-   { src_addr, 0, vm_ops, vm_private_data };
+   struct rtdm_mmap_data mmap_data = {
+   .src_vaddr = src_addr,
+   .src_paddr = 0,
+   .vm_ops = vm_ops,
+   .vm_private_data = vm_private_data
+   };
 
return rtdm_do_mmap(user_info, mmap_data, len, prot, pptr);
 }
@@ -2014,8 +2041,12 @@ int rtdm_iomap_to_user(rtdm_user_info_t *user_info,
   struct vm_operations_struct *vm_ops,
   void 

[Xenomai-git] Philippe Gerum : wrappers: introduce file-to-inode converter

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Apr 29 19:52:53 2010 +0200

wrappers: introduce file-to-inode converter

---

 include/asm-generic/wrappers.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index a7349db..f67f422 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -37,6 +37,7 @@
 #include linux/sched.h
 #include linux/bitops.h
 #include linux/delay.h
+#include linux/slab.h
 #include linux/moduleparam.h /* Use the backport. */
 #include asm/atomic.h
 
@@ -335,6 +336,8 @@ unsigned long find_next_bit(const unsigned long *addr,
 
 #define mmiowb()   barrier()
 
+#define wrap_f_inode(file) ((file)-f_dentry-d_inode)
+
 #else /* LINUX_VERSION_CODE = KERNEL_VERSION(2,6,0) */
 
 #define compat_module_param_array(name, type, count, perm) \
@@ -456,6 +459,8 @@ unsigned long find_next_bit(const unsigned long *addr,
 #define DECLARE_DELAYED_WORK_NODATA(n, f) DECLARE_DELAYED_WORK(n, f)
 #endif /* = 2.6.20 */
 
+#define wrap_f_inode(file) ((file)-f_path.dentry-d_inode)
+
 #endif /* LINUX_VERSION_CODE  KERNEL_VERSION(2,6,0) */
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,18)


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : wrappers: introduce kzalloc() for 2.4 kernels

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Apr 29 19:53:39 2010 +0200

wrappers: introduce kzalloc() for 2.4 kernels

---

 include/asm-generic/wrappers.h |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index f67f422..56fafbc 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -338,6 +338,19 @@ unsigned long find_next_bit(const unsigned long *addr,
 
 #define wrap_f_inode(file) ((file)-f_dentry-d_inode)
 
+static inline void *kzalloc(size_t size, int flags)
+{
+   void *ptr;
+
+   ptr = kmalloc(size, flags);
+   if (ptr == NULL)
+   return NULL;
+
+   memset(ptr, 0, size);
+
+   return ptr;
+}
+
 #else /* LINUX_VERSION_CODE = KERNEL_VERSION(2,6,0) */
 
 #define compat_module_param_array(name, type, count, perm) \


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : nucleus/registry: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Tue May 25 17:37:11 2010 +0200

nucleus/registry: convert to vfile

---

 include/nucleus/registry.h |  168 +---
 ksrc/nucleus/Makefile  |2 +
 ksrc/nucleus/registry.c|  473 
 3 files changed, 356 insertions(+), 287 deletions(-)

diff --git a/include/nucleus/registry.h b/include/nucleus/registry.h
index 6bd5ec9..34780f6 100644
--- a/include/nucleus/registry.h
+++ b/include/nucleus/registry.h
@@ -31,37 +31,33 @@
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
 #include nucleus/synch.h
+#include nucleus/vfile.h
 
 struct xnpnode;
 
 typedef struct xnobject {
-
-xnholder_t link;
-
-#define link2xnobj(ln) container_of(ln, xnobject_t, link)
-
-void *objaddr;
-
-const char *key;   /* ! Hash key. */
-
-xnsynch_t safesynch; /* ! Safe synchronization object. */
-
-u_long safelock;/* ! Safe lock count. */
-
-u_long cstamp; /* ! Creation stamp. */
-
-struct xnobject *hnext;/* ! Next in h-table */
-
+   void *objaddr;
+   const char *key;  /* ! Hash key. */
+   struct xnsynch safesynch; /* ! Safe synchronization object. */
+   u_long safelock;  /* ! Safe lock count. */
+   u_long cstamp;/* ! Creation stamp. */
 #ifdef CONFIG_PROC_FS
-
-struct xnpnode *pnode; /* ! /proc information class. */
-
-struct proc_dir_entry *proc; /* ! /proc entry. */
-
+   struct xnpnode *pnode;  /* ! v-file information class. */
+   union {
+   struct {
+   struct xnvfile_rev_tag tag;
+   struct xnvfile_snapshot vfile;
+   } file; /* ! virtual file. */
+   struct xnvfile_link link; /* ! virtual link. */
+   } vfile_u;
+   struct xnvfile *vfilp;
 #endif /* CONFIG_PROC_FS */
-
+   struct xnobject *hnext; /* ! Next in h-table */
+   struct xnholder link;
 } xnobject_t;
 
+#define link2xnobj(ln) container_of(ln, struct xnobject, link)
+
 #ifdef __cplusplus
 extern C {
 #endif
@@ -72,41 +68,65 @@ void xnregistry_cleanup(void);
 
 #ifdef CONFIG_PROC_FS
 
-#include linux/proc_fs.h
-
-#define XNOBJECT_PROC_RESERVED1 ((struct proc_dir_entry *)1)
-#define XNOBJECT_PROC_RESERVED2 ((struct proc_dir_entry *)2)
-
-typedef ssize_t link_proc_t(char *buf,
-   int count,
-   void *data);
-typedef struct xnptree {
-
-struct proc_dir_entry *dir;
-const char *name;
-int entries;
-
-} xnptree_t;
+#define XNOBJECT_PNODE_RESERVED1 ((struct xnvfile *)1)
+#define XNOBJECT_PNODE_RESERVED2 ((struct xnvfile *)2)
+
+struct xnptree {
+   const char *dirname;
+   /* hidden */
+   int entries;
+   struct xnvfile_directory vdir;
+};
+
+#define DEFINE_XNPTREE(__var, __name)  \
+   struct xnptree __var = {\
+   .dirname = __name,  \
+   .entries = 0,   \
+   .vdir = xnvfile_nodir,  \
+   }
 
-typedef struct xnpnode {
+struct xnpnode_ops {
+   int (*export)(struct xnobject *object, struct xnpnode *pnode);
+   void (*unexport)(struct xnobject *object, struct xnpnode *pnode);
+   void (*touch)(struct xnobject *object);
+};
+
+struct xnpnode {
+   const char *dirname;
+   struct xnptree *root;
+   struct xnpnode_ops *ops;
+   /* hidden */
+   int entries;
+   struct xnvfile_directory vdir;
+};
+
+struct xnpnode_file {
+   struct xnpnode node;
+   struct xnvfile_snapshot_template vfile;
+};
+
+struct xnpnode_link {
+   struct xnpnode node;
+   char *(*target)(void *obj);
+};
 
-struct proc_dir_entry *dir;
-const char *type;
-int entries;
-read_proc_t *read_proc;
-write_proc_t *write_proc;
-link_proc_t *link_proc;
-xnptree_t *root;
+#else /* !CONFIG_PROC_FS */
 
-} xnpnode_t;
+#define DEFINE_XNPTREE(__var, __name);
 
-#else /* !CONFIG_PROC_FS */
+/* Placeholders. */
 
-typedef struct xnpnode { /* Placeholder. */
+struct xnpnode {
+   const char *dirname;
+};
 
-const char *type;
+struct xnpnode_file {
+   struct xnpnode node;
+};
 
-} xnpnode_t;
+struct xnpnode_link {
+   struct xnpnode node;
+};
 
 #endif /* !CONFIG_PROC_FS */
 
@@ -114,26 +134,7 @@ extern struct xnobject *registry_obj_slots;
 
 /* Public interface. */
 
-int xnregistry_enter(const char *key,
-void *objaddr,
-xnhandle_t *phandle,
-xnpnode_t *pnode);
-
-int xnregistry_bind(const char *key,
-   xnticks_t timeout,
-   int timeout_mode,
-   xnhandle_t *phandle);
-
-int xnregistry_remove(xnhandle_t handle);
-
-int 

[Xenomai-git] Philippe Gerum : nucleus/heap: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Apr 28 17:01:42 2010 +0200

nucleus/heap: convert to vfile

---

 ksrc/nucleus/heap.c |  171 ---
 1 files changed, 95 insertions(+), 76 deletions(-)

diff --git a/ksrc/nucleus/heap.c b/ksrc/nucleus/heap.c
index f1d2c7b..2b148fc 100644
--- a/ksrc/nucleus/heap.c
+++ b/ksrc/nucleus/heap.c
@@ -66,18 +66,106 @@ HEAP {
 #include nucleus/pod.h
 #include nucleus/thread.h
 #include nucleus/heap.h
+#include nucleus/vfile.h
 #include nucleus/assert.h
 #include asm/xenomai/bits/heap.h
 
-xnheap_t kheap;/* System heap */
+struct xnheap kheap;   /* System heap */
 EXPORT_SYMBOL_GPL(kheap);
 
 #if CONFIG_XENO_OPT_SYS_STACKPOOLSZ  0
-xnheap_t kstacks;  /* Private stack pool */
+struct xnheap kstacks; /* Private stack pool */
 #endif
 
-static DEFINE_XNQUEUE(heapq);  /* Heap list for /proc reporting */
-static unsigned long heapq_rev;
+static DEFINE_XNQUEUE(heapq);  /* Heap list for v-file dump */
+
+#ifdef CONFIG_PROC_FS
+
+static struct xnvfile_rev_tag vfile_tag;
+
+static struct xnvfile_snapshot_ops vfile_ops;
+
+struct vfile_priv {
+   struct xnholder *curr;
+};
+
+struct vfile_data {
+   size_t usable_mem;
+   size_t used_mem;
+   size_t page_size;
+   char label[XNOBJECT_NAME_LEN+16];
+};
+
+static struct xnvfile_snapshot vfile = {
+   .privsz = sizeof(struct vfile_priv),
+   .datasz = sizeof(struct vfile_data),
+   .tag = vfile_tag,
+   .ops = vfile_ops,
+};
+
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+
+   priv-curr = getheadq(heapq);
+
+   return countq(heapq);
+}
+
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+   struct xnheap *heap;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   heap = container_of(priv-curr, struct xnheap, stat_link);
+   priv-curr = nextq(heapq, priv-curr);
+
+   p-usable_mem = xnheap_usable_mem(heap);
+   p-used_mem = xnheap_used_mem(heap);
+   p-page_size = xnheap_page_size(heap);
+   strncpy(p-label, heap-label, sizeof(p-label));
+
+   return 1;
+}
+
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_data *p = data;
+
+   if (p == NULL)
+   xnvfile_printf(it, %9s %9s  %6s  %s\n,
+  TOTAL, USED, PAGESZ, NAME);
+   else
+   xnvfile_printf(it, %9Zu %9Zu  %6Zu  %.*s\n,
+  p-usable_mem,
+  p-used_mem,
+  p-page_size,
+  sizeof(p-label),
+  p-label);
+   return 0;
+}
+
+static struct xnvfile_snapshot_ops vfile_ops = {
+   .rewind = vfile_rewind,
+   .next = vfile_next,
+   .show = vfile_show,
+};
+
+void xnheap_init_proc(void)
+{
+   xnvfile_init_snapshot(heap, vfile, NULL);
+}
+
+void xnheap_cleanup_proc(void)
+{
+   xnvfile_destroy_snapshot(vfile);
+}
+
+#endif /* CONFIG_PROC_FS */
 
 static void init_extent(xnheap_t *heap, xnextent_t *extent)
 {
@@ -241,7 +329,7 @@ int xnheap_init(xnheap_t *heap,
 
xnlock_get_irqsave(nklock, s);
appendq(heapq, heap-stat_link);
-   heapq_rev++;
+   xnvfile_touch_tag(vfile_tag);
xnlock_put_irqrestore(nklock, s);
 
xnarch_init_display_context(heap);
@@ -325,7 +413,7 @@ void xnheap_destroy(xnheap_t *heap,
 
xnlock_get_irqsave(nklock, s);
removeq(heapq, heap-stat_link);
-   heapq_rev++;
+   xnvfile_touch_tag(vfile_tag);
xnlock_put_irqrestore(nklock, s);
 
if (!flushfn)
@@ -1313,7 +1401,7 @@ void xnheap_destroy_mapped(xnheap_t *heap,
 
xnlock_get_irqsave(nklock, s);
removeq(heapq, heap-stat_link);
-   heapq_rev++;
+   xnvfile_touch_tag(vfile_tag);
xnlock_put_irqrestore(nklock, s);
 
len = xnheap_extentsize(heap);
@@ -1423,75 +1511,6 @@ void xnheap_destroy_mapped(xnheap_t *heap,
 }
 #endif /* !CONFIG_XENO_OPT_PERVASIVE */
 
-#ifdef CONFIG_PROC_FS
-
-#include linux/proc_fs.h
-
-static int heap_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   unsigned long rev;
-   xnholder_t *entry;
-   xnheap_t *heap;
-   int len;
-   spl_t s;
-
-   if (!xnpod_active_p())
-   return -ESRCH;
-
-   xnlock_get_irqsave(nklock, s);
-
-restart:
-   len = 0;
-
-   entry = getheadq(heapq);
-   while (entry) {
-  

[Xenomai-git] Philippe Gerum : nucleus/shadow: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sun May 16 13:34:34 2010 +0200

nucleus/shadow: convert to vfile

---

 include/nucleus/shadow.h |   11 
 ksrc/nucleus/shadow.c|  151 +++--
 2 files changed, 77 insertions(+), 85 deletions(-)

diff --git a/include/nucleus/shadow.h b/include/nucleus/shadow.h
index 93e4206..1615ec8 100644
--- a/include/nucleus/shadow.h
+++ b/include/nucleus/shadow.h
@@ -54,11 +54,6 @@ struct xnskin_props {
struct module *module;
 };
 
-struct xnskin_slot {
-   struct xnskin_props *props;
-   atomic_counter_t refcnt;
-};
-
 int xnshadow_mount(void);
 
 void xnshadow_cleanup(void);
@@ -103,8 +98,6 @@ void xnshadow_send_sig(struct xnthread *thread,
 
 void xnshadow_rpi_check(void);
 
-extern struct xnskin_slot muxtable[];
-
 int xnshadow_mark_sig(struct xnthread *thread, unsigned muxid);
 
 void xnshadow_clear_sig(struct xnthread *thread, unsigned muxid);
@@ -128,13 +121,9 @@ static inline void xnshadow_call_mayday(struct xnthread 
*thread)
 #if defined(CONFIG_XENO_OPT_PERVASIVE)  defined(CONFIG_PROC_FS)
 void xnshadow_init_proc(void);
 void xnshadow_cleanup_proc(void);
-void xnshadow_declare_proc(struct xnskin_slot *iface);
-void xnshadow_remove_proc(const char *iface);
 #else
 static inline void xnshadow_init_proc(void) { }
 static inline void xnshadow_cleanup_proc(void) { }
-#define xnshadow_declare_proc(iface)   do { (void)iface; } while(0)
-#define xnshadow_remove_proc(iface)do { (void)name; } while(0)
 #endif /* CONFIG_XENO_OPT_PERVASIVE  CONFIG_PROC_FS */
 
 #endif /* !_XENO_NUCLEUS_SHADOW_H */
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 80b9caa..80fc2b4 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -66,7 +66,13 @@ EXPORT_SYMBOL_GPL(nkthrptd);
 int nkerrptd;
 EXPORT_SYMBOL_GPL(nkerrptd);
 
-struct xnskin_slot muxtable[XENOMAI_MUX_NR];
+struct xnskin_slot {
+   struct xnskin_props *props;
+   atomic_counter_t refcnt;
+#ifdef CONFIG_PROC_FS
+   struct xnvfile_regular vfile;
+#endif
+} muxtable[XENOMAI_MUX_NR];
 
 static int lostage_apc;
 
@@ -102,6 +108,8 @@ static int nucleus_muxid = -1;
 
 static DECLARE_MUTEX(completion_mutex);
 
+static DECLARE_MUTEX(registration_mutex);
+
 static inline struct task_struct *get_switch_lock_owner(void)
 {
return switch_lock_owner[task_cpu(current)];
@@ -2780,6 +2788,44 @@ static inline void do_cleanup_event(struct mm_struct *mm)
 
 RTHAL_DECLARE_CLEANUP_EVENT(cleanup_event);
 
+#ifdef CONFIG_PROC_FS
+
+static struct xnvfile_directory iface_vfroot;
+
+static int iface_vfile_show(struct xnvfile_regular_iterator *it, void *data)
+{
+   struct xnskin_slot *iface;
+   int refcnt;
+
+   iface = container_of(it-vfile, struct xnskin_slot, vfile);
+   refcnt = xnarch_atomic_get(iface-refcnt);
+   xnvfile_printf(it, %d\n, refcnt);
+
+   return 0;
+}
+
+static struct xnvfile_regular_ops iface_vfile_ops = {
+   .show = iface_vfile_show,
+};
+
+void xnshadow_init_proc(void)
+{
+   xnvfile_init_dir(interfaces, iface_vfroot, NULL);
+}
+
+void xnshadow_cleanup_proc(void)
+{
+   int muxid;
+
+   for (muxid = 0; muxid  XENOMAI_MUX_NR; muxid++)
+   if (muxtable[muxid].props  muxtable[muxid].props-name)
+   xnvfile_destroy_regular(muxtable[muxid].vfile);
+
+   xnvfile_destroy_dir(iface_vfroot);
+}
+
+#endif /* CONFIG_PROC_FS */
+
 /*
  * xnshadow_register_interface() -- Register a new skin/interface.
  * NOTE: an interface can be registered without its pod being
@@ -2804,6 +2850,7 @@ RTHAL_DECLARE_CLEANUP_EVENT(cleanup_event);
 
 int xnshadow_register_interface(struct xnskin_props *props)
 {
+   struct xnskin_slot *iface;
int muxid;
spl_t s;
 
@@ -2814,22 +2861,34 @@ int xnshadow_register_interface(struct xnskin_props 
*props)
if (XENOMAI_MAX_SYSENT  props-nrcalls || 0  props-nrcalls)
return -EINVAL;
 
+   down(registration_mutex);
+
xnlock_get_irqsave(nklock, s);
 
for (muxid = 0; muxid  XENOMAI_MUX_NR; muxid++) {
-   if (muxtable[muxid].props == NULL) {
-   muxtable[muxid].props = props;
-   xnarch_atomic_set(muxtable[muxid].refcnt, 0);
+   iface = muxtable + muxid;
+   if (iface-props == NULL) {
+   iface-props = props;
+   xnarch_atomic_set(iface-refcnt, 0);
break;
}
}
 
xnlock_put_irqrestore(nklock, s);
 
-   if (muxid = XENOMAI_MUX_NR)
+   if (muxid = XENOMAI_MUX_NR) {
+   up(registration_mutex);
return -ENOBUFS;
+   }
 
-   xnshadow_declare_proc(muxtable + muxid);
+#ifdef CONFIG_PROC_FS

[Xenomai-git] Philippe Gerum : nucleus/sched: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Tue May 25 16:27:57 2010 +0200

nucleus/sched: convert to vfile

---

 include/nucleus/pod.h |   13 +-
 include/nucleus/sched.h   |9 +-
 ksrc/nucleus/pod.c|   16 +-
 ksrc/nucleus/sched-idle.c |1 -
 ksrc/nucleus/sched-rt.c   |  213 +-
 ksrc/nucleus/sched-sporadic.c |  232 ++-
 ksrc/nucleus/sched-tp.c   |  208 +-
 ksrc/nucleus/sched.c  |  653 -
 8 files changed, 522 insertions(+), 823 deletions(-)

diff --git a/include/nucleus/pod.h b/include/nucleus/pod.h
index bab9f07..1ad6014 100644
--- a/include/nucleus/pod.h
+++ b/include/nucleus/pod.h
@@ -71,8 +71,9 @@ struct xnpod {
xnsched_t sched[XNARCH_NR_CPUS];/*! Per-cpu scheduler slots. */
 
xnqueue_t threadq;  /*! All existing threads. */
-   int threadq_rev;/*! Modification counter of threadq. */
-
+#ifdef CONFIG_PROC_FS
+   struct xnvfile_rev_tag threadlist_tag;
+#endif
xnqueue_t tstartq,  /*! Thread start hook queue. */
 tswitchq,  /*! Thread switch hook queue. */
 tdeleteq;  /*! Thread delete hook queue. */
@@ -104,17 +105,17 @@ extern xnarch_cpumask_t nkaffinity;
 extern xnpod_t nkpod_struct;
 
 #ifdef CONFIG_PROC_FS
-void xnpod_init_proc(void);
+int xnpod_init_proc(void);
 void xnpod_cleanup_proc(void);
 #else /* !CONFIG_PROC_FS */
-static inline void xnpod_init_proc(void) {}
+static inline int xnpod_init_proc(void) { return 0; }
 static inline void xnpod_cleanup_proc(void) {}
 #endif /* !CONFIG_PROC_FS */
 
-static inline void xnpod_mount(void)
+static inline int xnpod_mount(void)
 {
xnsched_register_classes();
-   xnpod_init_proc();
+   return xnpod_init_proc();
 }
 
 static inline void xnpod_umount(void)
diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h
index 441a3a2..f8cc059 100644
--- a/include/nucleus/sched.h
+++ b/include/nucleus/sched.h
@@ -35,6 +35,7 @@
 #include nucleus/schedqueue.h
 #include nucleus/sched-tp.h
 #include nucleus/sched-sporadic.h
+#include nucleus/vfile.h
 
 /* Sched status flags */
 #define XNKCOUT0x8000  /* Sched callout context */
@@ -141,9 +142,9 @@ struct xnsched_class {
void (*sched_resume_rpi)(struct xnthread *thread);
 #endif
 #ifdef CONFIG_PROC_FS
-   void (*sched_init_proc)(struct proc_dir_entry *root);
-   void (*sched_cleanup_proc)(struct proc_dir_entry *root);
-   struct proc_dir_entry *proc;
+   int (*sched_init_vfile)(struct xnsched_class *schedclass,
+   struct xnvfile_directory *vfroot);
+   void (*sched_cleanup_vfile)(struct xnsched_class *schedclass);
 #endif
int nthreads;
struct xnsched_class *next;
@@ -242,7 +243,7 @@ static inline void xnsched_reset_watchdog(struct xnsched 
*sched)
 #include nucleus/sched-idle.h
 #include nucleus/sched-rt.h
 
-void xnsched_init_proc(void);
+int xnsched_init_proc(void);
 
 void xnsched_cleanup_proc(void);
 
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 7002a73..7e8a3b7 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -652,7 +652,7 @@ int xnpod_init_thread(struct xnthread *thread,
 
xnlock_get_irqsave(nklock, s);
appendq(nkpod-threadq, thread-glink);
-   nkpod-threadq_rev++;
+   xnvfile_touch_tag(nkpod-threadlist_tag);
xnpod_suspend_thread(thread, XNDORMANT | (attr-flags  XNSUSP), 
XN_INFINITE,
 XN_RELATIVE, NULL);
xnlock_put_irqrestore(nklock, s);
@@ -1174,7 +1174,7 @@ void xnpod_delete_thread(xnthread_t *thread)
   thread, xnthread_name(thread));
 
removeq(nkpod-threadq, thread-glink);
-   nkpod-threadq_rev++;
+   xnvfile_touch_tag(nkpod-threadlist_tag);
 
if (xnthread_test_state(thread, XNREADY)) {
XENO_BUGON(NUCLEUS, xnthread_test_state(thread, 
XNTHREAD_BLOCK_BITS));
@@ -3203,12 +3203,17 @@ static int version_read_proc(char *page,
return len;
 }
 
-void xnpod_init_proc(void)
+int xnpod_init_proc(void)
 {
+   int ret;
+
if (rthal_proc_root == NULL)
-   return;
+   return -ENOMEM;
+
+   ret = xnsched_init_proc();
+   if (ret)
+   return ret;
 
-   xnsched_init_proc();
xntbase_init_proc();
xntimer_init_proc();
xnheap_init_proc();
@@ -3226,6 +3231,7 @@ void xnpod_init_proc(void)
rthal_add_proc_leaf(lock, lock_read_proc, NULL, NULL,
rthal_proc_root);
 #endif /* XENO_DEBUG(XNLOCK) */
+   return 0;
 }
 
 void xnpod_cleanup_proc(void)
diff --git a/ksrc/nucleus/sched-idle.c b/ksrc/nucleus/sched-idle.c
index 39faa6a..124cd67 

[Xenomai-git] Philippe Gerum : nucleus/pod: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Wed Jun  9 18:36:17 2010 +0200

nucleus/pod: convert to vfile

---

 ksrc/nucleus/pod.c |  263 +++
 1 files changed, 180 insertions(+), 83 deletions(-)

diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 7e8a3b7..f346cf4 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -3094,16 +3094,13 @@ EXPORT_SYMBOL_GPL(xnpod_set_thread_tslice);
 
 #if XENO_DEBUG(XNLOCK)
 
-xnlockinfo_t xnlock_stats[RTHAL_NR_CPUS];
+xnlockinfo_t xnlock_stats[XNARCH_NR_CPUS];
+EXPORT_SYMBOL_GPL(xnlock_stats);
 
-static int lock_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
+static int lock_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
xnlockinfo_t lockinfo;
-   int cpu, len = 0;
-   char *p = page;
-   spl_t s;
+   int cpu;
 
for_each_online_cpu(cpu) {
 
@@ -3112,11 +3109,11 @@ static int lock_read_proc(char *page,
xnlock_put_irqrestore(nklock, s);
 
if (cpu  0)
-   p += sprintf(p, \n);
+   xnvfile_printf(it, \n);
 
-   p += sprintf(p, CPU%d:\n, cpu);
+   xnvfile_printf(it, CPU%d:\n, cpu);
 
-   p += sprintf(p,
+   xnvfile_printf(it,
   longest locked section: %llu ns\n
   spinning time: %llu ns\n
   section entry: %s:%d (%s)\n,
@@ -3125,90 +3122,183 @@ static int lock_read_proc(char *page,
 lockinfo.file, lockinfo.line, lockinfo.function);
}
 
-   len = p - page - off;
+   return 0;
+}
 
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+static struct xnvfile_regular_ops lock_vfile_ops = {
+   .show = lock_vfile_show,
+};
 
-   return len;
-}
-EXPORT_SYMBOL_GPL(xnlock_stats);
+static struct xnvfile_regular lock_vfile = {
+   .ops = lock_vfile_ops,
+};
 
 #endif /* XENO_DEBUG(XNLOCK) */
 
-static int latency_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static int latency_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
-   int len;
-
-   len = sprintf(page, %Lu\n, xnarch_tsc_to_ns(nklatency));
-   len -= off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
-
-   return len;
+   xnvfile_printf(it, %Lu\n, xnarch_tsc_to_ns(nklatency));
+
+   return 0;
 }
 
-static int latency_write_proc(struct file *file,
- const char __user * buffer,
- unsigned long count, void *data)
+static ssize_t latency_vfile_store(struct xnvfile_input *input)
 {
-   char *end, buf[16];
-   long ns;
-   int n;
+   ssize_t ret;
+   long val;
 
-   n = count  sizeof(buf) - 1 ? sizeof(buf) - 1 : count;
+   ret = xnvfile_get_integer(input, val);
+   if (ret  0)
+   return ret;
 
-   if (copy_from_user(buf, buffer, n))
-   return -EFAULT;
+   nklatency = xnarch_ns_to_tsc(val);
 
-   buf[n] = '\0';
-   ns = simple_strtol(buf, end, 0);
+   return ret;
+}
 
-   if ((*end != '\0'  !isspace(*end)) || ns  0)
-   return -EINVAL;
+static struct xnvfile_regular_ops latency_vfile_ops = {
+   .show = latency_vfile_show,
+   .store = latency_vfile_store,
+};
 
-   nklatency = xnarch_ns_to_tsc(ns);
+static struct xnvfile_regular latency_vfile = {
+   .ops = latency_vfile_ops,
+};
+
+static int version_vfile_show(struct xnvfile_regular_iterator *it, void *data)
+{
+   xnvfile_printf(it, %s\n, XENO_VERSION_STRING);
 
-   return count;
+   return 0;
 }
 
-static int version_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static struct xnvfile_regular_ops version_vfile_ops = {
+   .show = version_vfile_show,
+};
+
+static struct xnvfile_regular version_vfile = {
+   .ops = version_vfile_ops,
+};
+
+static int faults_vfile_show(struct xnvfile_regular_iterator *it, void *data)
 {
-   int len;
-
-   len = sprintf(page, %s\n, XENO_VERSION_STRING);
-   len -= off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   

[Xenomai-git] Philippe Gerum : nucleus/timebase: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 10 12:22:48 2010 +0200

nucleus/timebase: convert to vfile

---

 include/nucleus/timebase.h |   14 ++-
 ksrc/nucleus/timebase.c|  345 
 ksrc/nucleus/timer.c   |   51 +++
 3 files changed, 189 insertions(+), 221 deletions(-)

diff --git a/include/nucleus/timebase.h b/include/nucleus/timebase.h
index 5c8678e..40dc54a 100644
--- a/include/nucleus/timebase.h
+++ b/include/nucleus/timebase.h
@@ -30,6 +30,8 @@
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
+#include nucleus/vfile.h
+
 struct xntimer;
 
 typedef struct xntbops {
@@ -75,9 +77,9 @@ typedef struct xntbase {
 #define link2tbase(ln) container_of(ln, xntbase_t, link)
 
 #ifdef CONFIG_XENO_OPT_STATS
-   xnqueue_t timerq;   /* ! Timer holder in timebase. */
-
-   int timerq_rev; /* ! Revision (for non-atomic list walks). */
+   struct xnvfile_snapshot vfile;  /* ! Virtual file for access. */
+   struct xnvfile_rev_tag revtag; /* ! Revision (for non-atomic list 
walks). */
+   struct xnqueue timerq;  /* ! Timer holder in timebase. */
 #endif /* CONFIG_XENO_OPT_STATS */
 
 } xntbase_t;
@@ -322,8 +324,6 @@ do {\
removeq(nktimebaseq, nktbase.link);   \
 } while (0)
 
-#endif /* __KERNEL__ || __XENO_SIM__ */
-
 void xntbase_init_proc(void);
 
 void xntbase_cleanup_proc(void);
@@ -336,6 +336,10 @@ static inline void xntbase_declare_proc(xntbase_t *base) { 
}
 static inline void xntbase_remove_proc(xntbase_t *base) { }
 #endif /* !CONFIG_XENO_OPT_STATS */
 
+extern struct xnvfile_rev_tag tbaselist_tag;
+
+#endif /* __KERNEL__ || __XENO_SIM__ */
+
 /*...@}*/
 
 #endif /* !_XENO_NUCLEUS_TIMEBASE_H */
diff --git a/ksrc/nucleus/timebase.c b/ksrc/nucleus/timebase.c
index 48be711..d648fe1 100644
--- a/ksrc/nucleus/timebase.c
+++ b/ksrc/nucleus/timebase.c
@@ -165,6 +165,7 @@ int xntbase_alloc(const char *name, u_long period, u_long 
flags,
xntbase_declare_proc(base);
xnlock_get_irqsave(nklock, s);
appendq(nktimebaseq, base-link);
+   xnvfile_touch_tag(tbaselist_tag);
xnlock_put_irqrestore(nklock, s);
 
xnarch_declare_tbase(base);
@@ -209,6 +210,7 @@ void xntbase_free(xntbase_t *base)
 
xnlock_get_irqsave(nklock, s);
removeq(nktimebaseq, base-link);
+   xnvfile_touch_tag(tbaselist_tag);
xnlock_put_irqrestore(nklock, s);
 
xnarch_free_host_mem(base, sizeof(*base));
@@ -620,256 +622,225 @@ EXPORT_SYMBOL_GPL(xntbase_adjust_time);
 
 #ifdef CONFIG_PROC_FS
 
-#include linux/proc_fs.h
+struct xnvfile_rev_tag tbaselist_tag;
 
-#ifdef CONFIG_XENO_OPT_STATS
+static struct xnvfile_snapshot_ops tbase_vfile_ops;
 
-#include linux/seq_file.h
-
-static struct proc_dir_entry *tmstat_proc_root;
-
-struct tmstat_seq_iterator {
-   int nentries;
-   struct tmstat_seq_info {
-   int cpu;
-   unsigned int scheduled;
-   unsigned int fired;
-   xnticks_t timeout;
-   xnticks_t interval;
-   xnflags_t status;
-   char handler[12];
-   char name[XNOBJECT_NAME_LEN];
-   } stat_info[1];
+struct tbase_vfile_priv {
+   struct xnholder *curr;
 };
 
-static void *tmstat_seq_start(struct seq_file *seq, loff_t *pos)
-{
-   struct tmstat_seq_iterator *iter = seq-private;
+struct tbase_vfile_data {
+   unsigned int enabled : 1;
+   unsigned int set : 1;
+   unsigned int isolated : 1;
+   unsigned int periodic : 1;
+   xnticks_t jiffies;
+   unsigned long tickvalue;
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   if (*pos  iter-nentries)
-   return NULL;
+static struct xnvfile_snapshot tbase_vfile = {
+   .privsz = sizeof(struct tbase_vfile_priv),
+   .datasz = sizeof(struct tbase_vfile_data),
+   .tag = tbaselist_tag,
+   .ops = tbase_vfile_ops,
+};
 
-   if (*pos == 0)
-   return SEQ_START_TOKEN;
+static int tbase_vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct tbase_vfile_priv *priv = xnvfile_iterator_priv(it);
+
+   priv-curr = getheadq(nktimebaseq);
 
-   return iter-stat_info + *pos - 1;
+   return countq(nktimebaseq);
 }
 
-static void *tmstat_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+static int tbase_vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
 {
-   struct tmstat_seq_iterator *iter = seq-private;
+   struct tbase_vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct tbase_vfile_data *p = data;
+   struct xntbase *base;
 
-   ++*pos;
+   if (priv-curr == NULL)
+   return 0;
 
-   if (*pos  iter-nentries)
-   return 

[Xenomai-git] Philippe Gerum : nucleus/intr: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 10 12:23:12 2010 +0200

nucleus/intr: convert to vfile

---

 ksrc/nucleus/intr.c |  155 ---
 1 files changed, 72 insertions(+), 83 deletions(-)

diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index a6de4ea..300251e 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -983,28 +983,27 @@ int xnintr_query_next(int irq, xnintr_iterator_t 
*iterator, char *name_buf)
 
 #ifdef CONFIG_PROC_FS
 
-#include linux/proc_fs.h
-#include linux/ctype.h
+#include nucleus/vfile.h
 
-static int format_irq_proc(unsigned int irq, char *str)
+static inline int format_irq_proc(unsigned int irq,
+ struct xnvfile_regular_iterator *it)
 {
-   xnintr_t *intr;
-   char *p = str;
+   struct xnintr *intr;
spl_t s;
 
if (rthal_virtual_irq_p(irq)) {
-   p += sprintf(p,  [virtual]);
-   return p - str;
+   xnvfile_puts(it,  [virtual]);
+   return 0;
} else if (irq == XNARCH_TIMER_IRQ) {
-   p += sprintf(p,  [timer]);
-   return p - str;
+   xnvfile_puts(it,  [timer]);
+   return 0;
 #ifdef CONFIG_SMP
} else if (irq == RTHAL_SERVICE_IPI0) {
-   p += sprintf(p,  [IPI]);
-   return p - str;
+   xnvfile_puts(it,  [IPI]);
+   return 0;
} else if (irq == RTHAL_CRITICAL_IPI) {
-   p += sprintf(p,  [critical sync]);
-   return p - str;
+   xnvfile_puts(it,  [critical sync]);
+   return 0;
 #endif /* CONFIG_SMP */
}
 
@@ -1012,134 +1011,124 @@ static int format_irq_proc(unsigned int irq, char 
*str)
 
intr = xnintr_shirq_first(irq);
if (intr) {
-   strcpy(p, ); p += 8;
+   xnvfile_puts(it, );
 
do {
-   *p = ' '; p += 1;
-   strcpy(p, intr-name); p += strlen(intr-name);
-
+   xnvfile_putc(it, ' ');
+   xnvfile_puts(it, intr-name);
intr = xnintr_shirq_next(intr);
} while (intr);
}
 
xnlock_put_irqrestore(intrlock, s);
 
-   return p - str;
+   return 0;
 }
 
-static int irq_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
+static int irq_vfile_show(struct xnvfile_regular_iterator *it,
+ void *data)
 {
-   int len = 0, cpu, irq;
-   char *p = page;
+   int cpu, irq;
 
-   p += sprintf(p, IRQ );
+   /* FIXME: We assume the entire output fits in a single page. */
 
-   for_each_online_cpu(cpu) {
-   p += sprintf(p, CPU%d, cpu);
-   }
+   xnvfile_puts(it, IRQ );
+
+   for_each_online_cpu(cpu)
+   xnvfile_printf(it, CPU%d, cpu);
 
for (irq = 0; irq  XNARCH_NR_IRQS; irq++) {
if (rthal_irq_handler(rthal_domain, irq) == NULL)
continue;
 
-   p += sprintf(p, \n%3d:, irq);
+   xnvfile_printf(it, \n%3d:, irq);
 
for_each_online_cpu(cpu) {
-   p += sprintf(p, %12lu,
-rthal_cpudata_irq_hits(rthal_domain, cpu,
-   irq));
+   xnvfile_printf(it, %12lu,
+  rthal_cpudata_irq_hits(rthal_domain, 
cpu,
+ irq));
}
 
-   p += format_irq_proc(irq, p);
+   format_irq_proc(irq, it);
}
 
-   p += sprintf(p, \n);
+   xnvfile_putc(it, '\n');
 
-   len = p - page - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
-
-   return len;
+   return 0;
 }
 
+static struct xnvfile_regular_ops irq_vfile_ops = {
+   .show = irq_vfile_show,
+};
+
+static struct xnvfile_regular irq_vfile = {
+   .ops = irq_vfile_ops,
+};
+
 #ifdef CONFIG_SMP
-static int affinity_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
+
+static int affinity_vfile_show(struct xnvfile_regular_iterator *it,
+  void *data)
 {
unsigned long val = 0;
-   int len, cpu;
+   int cpu;
 
-   for (cpu = 0; cpu  sizeof(val) * 8; 

[Xenomai-git] Philippe Gerum : native: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Apr 29 18:22:32 2010 +0200

native: convert to vfile

---

 ksrc/nucleus/heap.c|2 +-
 ksrc/skins/native/alarm.c  |  127 +-
 ksrc/skins/native/buffer.c |  168 +++-
 ksrc/skins/native/cond.c   |  110 +
 ksrc/skins/native/event.c  |  132 ++-
 ksrc/skins/native/heap.c   |  142 +++--
 ksrc/skins/native/intr.c   |  137 ++--
 ksrc/skins/native/module.c |9 +--
 ksrc/skins/native/mutex.c  |  147 --
 ksrc/skins/native/pipe.c   |   40 +++
 ksrc/skins/native/queue.c  |  139 -
 ksrc/skins/native/sem.c|  124 +
 12 files changed, 792 insertions(+), 485 deletions(-)

diff --git a/ksrc/nucleus/heap.c b/ksrc/nucleus/heap.c
index 2b148fc..a7e3ae4 100644
--- a/ksrc/nucleus/heap.c
+++ b/ksrc/nucleus/heap.c
@@ -144,7 +144,7 @@ static int vfile_show(struct xnvfile_snapshot_iterator *it, 
void *data)
   p-usable_mem,
   p-used_mem,
   p-page_size,
-  sizeof(p-label),
+  (int)sizeof(p-label),
   p-label);
return 0;
 }
diff --git a/ksrc/skins/native/alarm.c b/ksrc/skins/native/alarm.c
index 1130dfb..eeb714a 100644
--- a/ksrc/skins/native/alarm.c
+++ b/ksrc/skins/native/alarm.c
@@ -45,67 +45,98 @@
 
 #ifdef CONFIG_PROC_FS
 
-static int __alarm_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
-{
-   RT_ALARM *alarm = (RT_ALARM *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   struct xnpholder *curr;
+   RTIME interval;
+   unsigned long expiries;
+};
 
-   xnlock_get_irqsave(nklock, s);
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   p += sprintf(p, interval=%Lu:expiries=%lu\n,
-rt_timer_tsc2ns(xntimer_interval(alarm-timer_base)),
-alarm-expiries);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   RT_ALARM *alarm = xnvfile_priv(it-vfile);
 
-#ifdef CONFIG_XENO_OPT_PERVASIVE
-   {
-   xnpholder_t *holder =
-   getheadpq(xnsynch_wait_queue(alarm-synch_base));
-
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(alarm-synch_base),
-  holder);
-   }
-   }
-#endif /* CONFIG_XENO_OPT_PERVASIVE */
+   alarm = xeno_h2obj_validate(alarm, XENO_ALARM_MAGIC, RT_ALARM);
+   if (alarm == NULL)
+   return -EIDRM;
 
-   xnlock_put_irqrestore(nklock, s);
+   priv-curr = getheadpq(xnsynch_wait_queue(alarm-synch_base));
+   priv-interval = rt_timer_tsc2ns(xntimer_interval(alarm-timer_base));
+   priv-expiries = alarm-expiries;
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   return xnsynch_nsleepers(alarm-synch_base);
+}
 
-   return len;
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   RT_ALARM *alarm = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(alarm-synch_base),
+   priv-curr);
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+
+   return 1;
 }
 
-extern xnptree_t __native_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, %8s  %s\n, INTERVAL, EXPIRIES);
+   xnvfile_printf(it, %8Lu  %lu\n,
+  

[Xenomai-git] Philippe Gerum : rtai: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun  7 19:41:15 2010 +0200

rtai: convert to vfile

---

 ksrc/skins/rtai/fifo.c   |   78 ++--
 ksrc/skins/rtai/module.c |9 +
 ksrc/skins/rtai/shm.c|   81 +++---
 3 files changed, 95 insertions(+), 73 deletions(-)

diff --git a/ksrc/skins/rtai/fifo.c b/ksrc/skins/rtai/fifo.c
index d2724ff..3c0dd88 100644
--- a/ksrc/skins/rtai/fifo.c
+++ b/ksrc/skins/rtai/fifo.c
@@ -27,49 +27,63 @@ static RT_FIFO __fifo_table[CONFIG_XENO_OPT_PIPE_NRDEV];
 
 #ifdef CONFIG_PROC_FS
 
-extern xnptree_t __rtai_ptree;
+struct vfile_priv {
+   size_t bufsz;
+   size_t fillsz;
+   void *handler;
+   int refcnt;
+};
 
-static int __fifo_read_proc(char *page,
-   char **start,
-   off_t off, int count, int *eof, void *data)
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   RT_FIFO *p = data;
-   char *ptrW = page;
-   int len;
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   RT_FIFO *fifo = xnvfile_priv(it-vfile);
+
+   priv-bufsz = fifo-bufsz;
+   priv-fillsz = fifo-fillsz;
+   priv-handler = fifo-handler;
+   priv-refcnt = fifo-refcnt;
+
+   return 0;
+}
 
-   ptrW += sprintf(ptrW, Size - Written  - F - Handler  - Ref\n);
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
 
+   xnvfile_printf(it, Size - Written  - F - Handler  - Ref\n);
/* Output buffer:  xnpipe_mh_t *buffer; */
-   ptrW += sprintf(ptrW, %08zX - %08zX - %p - %i\n,
-   p-bufsz, p-fillsz, p-handler, p-refcnt);
-
-   len = ptrW - page - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
-
-   return len;
+   xnvfile_printf(it, %08zX - %08zX - %p - %i\n,
+  priv-bufsz, priv-fillsz, priv-handler, priv-refcnt);
+
+   return 0;
 }
 
-static xnpnode_t __fifo_pnode = {
+static struct xnvfile_snapshot_ops vfile_ops = {
+   .rewind = vfile_rewind,
+   .show = vfile_show,
+};
 
-   .dir = NULL,
-   .type = fifo,
-   .entries = 0,
-   .read_proc = __fifo_read_proc,
-   .write_proc = NULL,
-   .root = __rtai_ptree,
+extern struct xnptree __rtai_ptree;
+
+static struct xnpnode_file __fifo_pnode = {
+   .node = {
+   .dirname = fifo,
+   .root = __rtai_ptree,
+   .ops = xnregistry_vfile_ops,
+   },
+   .vfile = {
+   .privsz = sizeof(struct vfile_priv),
+   .ops = vfile_ops,
+   },
 };
 
 #else /* !CONFIG_PROC_FS */
 
-static xnpnode_t __fifo_pnode = {
-
-   .type = fifo
+static struct xnpnode_file __fifo_pnode = {
+   .node = {
+   .dirname = fifo,
+   },
 };
 
 #endif /* !CONFIG_PROC_FS */
@@ -240,7 +254,7 @@ int rtf_create(unsigned minor, int size)
 
fifo-handle = 0;
snprintf(fifo-name, sizeof(fifo-name), rtf%u, minor);
-   xnregistry_enter(fifo-name, fifo, fifo-handle, __fifo_pnode);
+   xnregistry_enter(fifo-name, fifo, fifo-handle, __fifo_pnode.node);
 
return minor;
 
diff --git a/ksrc/skins/rtai/module.c b/ksrc/skins/rtai/module.c
index 13367b5..32e35bb 100644
--- a/ksrc/skins/rtai/module.c
+++ b/ksrc/skins/rtai/module.c
@@ -42,14 +42,7 @@ MODULE_PARM_DESC(sync_time, Set non-zero to synchronize on 
master time base);
 
 xntbase_t *rtai_tbase;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __rtai_ptree = {
-
-   .dir = NULL,
-   .name = rtai,
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__rtai_ptree, rtai);
 
 static void rtai_shutdown(int xtype)
 {
diff --git a/ksrc/skins/rtai/shm.c b/ksrc/skins/rtai/shm.c
index 96b7ae1..32508c4 100644
--- a/ksrc/skins/rtai/shm.c
+++ b/ksrc/skins/rtai/shm.c
@@ -55,47 +55,62 @@ xnqueue_t xnshm_allocq;
 
 #ifdef CONFIG_PROC_FS
 
-extern xnptree_t __rtai_ptree;
+struct vfile_priv {
+   int size;
+   char szName[6];
+   unsigned long name;
+   unsigned int refcnt;
+};
 
-static int __shm_read_proc(char *page,
-  char **start,
-  off_t off, int count, int *eof, void *data)
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
 {
-   xnshm_a_t *p = data;
-   char *ptrW = page;
-   int len;
-
-   ptrW += sprintf(ptrW, Name   - Ptr  - Size - Ref\n);
-   ptrW += sprintf(ptrW, %s - %08lX - %08X - %i\n,
-   p-szName, p-name, p-size, p-ref);
-
-   len = ptrW - page - off;
-  

[Xenomai-git] Philippe Gerum : vxworks: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jun  6 19:06:33 2010 +0200

vxworks: convert to vfile

---

 ksrc/skins/vxworks/module.c  |9 +--
 ksrc/skins/vxworks/msgQLib.c |  133 --
 ksrc/skins/vxworks/semLib.c  |  147 +++---
 ksrc/skins/vxworks/wdLib.c   |  121 ++-
 4 files changed, 256 insertions(+), 154 deletions(-)

diff --git a/ksrc/skins/vxworks/module.c b/ksrc/skins/vxworks/module.c
index 830df76..632f5d2 100644
--- a/ksrc/skins/vxworks/module.c
+++ b/ksrc/skins/vxworks/module.c
@@ -39,14 +39,7 @@ xntbase_t *wind_tbase;
 
 wind_rholder_t __wind_global_rholder;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __vxworks_ptree = {
-
-   .dir = NULL,
-   .name = vxworks,
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__vxworks_ptree, vxworks);
 
 int SKIN_INIT(vxworks)
 {
diff --git a/ksrc/skins/vxworks/msgQLib.c b/ksrc/skins/vxworks/msgQLib.c
index 0acb574..f762635 100644
--- a/ksrc/skins/vxworks/msgQLib.c
+++ b/ksrc/skins/vxworks/msgQLib.c
@@ -24,69 +24,102 @@ static int msgq_destroy_internal(wind_msgq_t *queue);
 
 #ifdef CONFIG_PROC_FS
 
-static int msgq_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   wind_msgq_t *queue = (wind_msgq_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
-
-   p += sprintf(p, porder=%s:mlength=%u:mcount=%d\n,
-xnsynch_test_flags(queue-synchbase,
-   XNSYNCH_PRIO) ? prio : fifo,
-queue-msg_length, countq(queue-msgq));
-
-   xnlock_get_irqsave(nklock, s);
-
-   if (xnsynch_nsleepers(queue-synchbase)  0) {
-   xnpholder_t *holder;
+struct vfile_priv {
+   struct xnpholder *curr;
+   int flags;
+   unsigned int mlength;
+   int mcount;
+};
 
-   /* Pended queue -- dump waiters. */
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   holder = getheadpq(xnsynch_wait_queue(queue-synchbase));
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   wind_msgq_t *q = xnvfile_priv(it-vfile);
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(queue-synchbase),
-  holder);
-   }
-   }
+   q = wind_h2obj_active((MSG_Q_ID)q, WIND_MSGQ_MAGIC, wind_msgq_t);
+   if (q == NULL)
+   return -EIDRM;
 
-   xnlock_put_irqrestore(nklock, s);
+   priv-curr = getheadpq(xnsynch_wait_queue(q-synchbase));
+   priv-flags = xnsynch_test_flags(q-synchbase, XNSYNCH_PRIO);
+   priv-mlength = q-msg_length;
+   priv-mcount = countq(q-msgq);
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   return xnsynch_nsleepers(q-synchbase);
+}
 
-   return len;
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   wind_msgq_t *q = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(q-synchbase),
+   priv-curr);
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+
+   return 1;
 }
 
-extern xnptree_t __vxworks_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, 
+  porder=%s:mlength=%u:mcount=%d\n,
+  priv-flags ? prio : fifo,
+  priv-mlength,
+  priv-mcount);
+   if (it-nrdata  0)
+   /* Queue is pended -- dump waiters */
+   xnvfile_printf(it, 
---\n);
+   } else
+   xnvfile_printf(it, %.*s\n,

[Xenomai-git] Philippe Gerum : uitron: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Jun  1 16:47:00 2010 +0200

uitron: convert to vfile

---

 ksrc/skins/uitron/flag.c   |  123 ---
 ksrc/skins/uitron/mbx.c|  119 +++
 ksrc/skins/uitron/module.c |9 +---
 ksrc/skins/uitron/sem.c|  118 +++---
 4 files changed, 231 insertions(+), 138 deletions(-)

diff --git a/ksrc/skins/uitron/flag.c b/ksrc/skins/uitron/flag.c
index c7f3c0d..ad9d85e 100644
--- a/ksrc/skins/uitron/flag.c
+++ b/ksrc/skins/uitron/flag.c
@@ -25,65 +25,102 @@ static xnmap_t *ui_flag_idmap;
 
 #ifdef CONFIG_PROC_FS
 
-static int __flag_read_proc(char *page,
-   char **start,
-   off_t off, int count, int *eof, void *data)
-{
-   uiflag_t *flag = (uiflag_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   struct xnpholder *curr;
+   unsigned long value;
+};
 
-   xnlock_get_irqsave(nklock, s);
+struct vfile_data {
+   UINT wfmode;
+   UINT waiptn;
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   p += sprintf(p, =0x%x, attr=%s\n, flag-flgvalue,
-flag-flgatr  TA_WMUL ? TA_WMUL : TA_WSGL);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct uiflag *flag = xnvfile_priv(it-vfile);
 
-   if (xnsynch_nsleepers(flag-synchbase)  0) {
-   xnpholder_t *holder;
+   priv-curr = getheadpq(xnsynch_wait_queue(flag-synchbase));
+   priv-value = flag-flgvalue;
 
-   /* Pended flag -- dump waiters. */
+   return xnsynch_nsleepers(flag-synchbase);
+}
 
-   holder = getheadpq(xnsynch_wait_queue(flag-synchbase));
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct uiflag *flag = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+   struct uitask *task;
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder = nextpq(xnsynch_wait_queue(flag-synchbase), 
holder);
-   }
-   }
+   priv-value = flag-flgvalue; /* Refresh as we collect. */
 
-   xnlock_put_irqrestore(nklock, s);
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(flag-synchbase),
+   priv-curr);
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+   task = thread2uitask(thread);
+   p-wfmode = task-wargs.flag.wfmode;
+   p-waiptn = task-wargs.flag.waiptn;
 
-   return len;
+   return 1;
 }
 
-extern xnptree_t __uitron_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   /* Always dump current flag value. */
+   xnvfile_printf(it, =0x%lx\n, priv-value);
+   if (it-nrdata  0)
+   xnvfile_printf(it, \n%10s  %4s  %s\n,
+  WAITPN, WFMODE, WAITER);
+   } else
+   xnvfile_printf(it, 0x%-8x  %4s  %.*s\n,
+  p-waiptn,
+  p-wfmode  TWF_ORW ? OR : AND,
+  (int)sizeof(p-name), p-name);
+
+   return 0;
+}
 
-static xnpnode_t __flag_pnode = {
+static struct xnvfile_snapshot_ops vfile_ops = {
+   .rewind = vfile_rewind,
+   .next = vfile_next,
+   .show = vfile_show,
+};
 
-   .dir = NULL,
-   .type = flags,
-   .entries = 0,
-   .read_proc = __flag_read_proc,
-   .write_proc = NULL,
-   .root = __uitron_ptree,
+extern struct xnptree __uitron_ptree;
+
+static struct xnpnode_file __flag_pnode = {
+   .node = {
+   .dirname = flags,
+   .root = __uitron_ptree,
+   .ops = xnregistry_vfile_ops,
+   },
+   .vfile = {
+   .privsz = sizeof(struct vfile_priv),
+   

[Xenomai-git] Philippe Gerum : hal: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 10 12:23:58 2010 +0200

hal: convert to vfile

Moved all vfiles to the nucleus.

---

 include/asm-generic/hal.h |   40 +++-
 ksrc/arch/generic/hal.c   |  222 +---
 ksrc/arch/generic/nmi.c   |   99 -
 3 files changed, 38 insertions(+), 323 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index f90cafa..5ff7fb0 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -420,6 +420,13 @@ struct rthal_calibration_data {
unsigned long clock_freq;
 };
 
+struct rthal_apc_desc {
+   void (*handler)(void *cookie);
+   void *cookie;
+   const char *name;
+   unsigned long hits[RTHAL_NR_CPUS];
+};
+
 typedef int (*rthal_trap_handler_t)(unsigned trapno,
unsigned domid,
void *data);
@@ -438,7 +445,11 @@ extern volatile int rthal_sync_op;
 
 extern rthal_trap_handler_t rthal_trap_handler;
 
-extern unsigned rthal_realtime_faults[RTHAL_NR_CPUS][RTHAL_NR_FAULTS];
+extern unsigned int rthal_realtime_faults[RTHAL_NR_CPUS][RTHAL_NR_FAULTS];
+
+extern unsigned long rthal_apc_map;
+
+extern struct rthal_apc_desc rthal_apc_table[RTHAL_NR_APCS];
 
 extern int rthal_arch_init(void);
 
@@ -452,7 +463,7 @@ void rthal_critical_exit(unsigned long flags);
 
 #ifdef CONFIG_XENO_HW_NMI_DEBUG_LATENCY
 
-extern unsigned rthal_maxlat_us;
+extern unsigned int rthal_maxlat_us;
 
 extern unsigned long rthal_maxlat_tsc;
 
@@ -466,15 +477,11 @@ void rthal_nmi_arm(unsigned long delay);
 
 void rthal_nmi_disarm(void);
 
-void rthal_nmi_proc_register(void);
-
-void rthal_nmi_proc_unregister(void);
+void rthal_nmi_set_maxlat(unsigned int maxlat_us);
 
 #else /* !CONFIG_XENO_HW_NMI_DEBUG_LATENCY */
 #define rthal_nmi_init(efn)do { } while(0)
 #define rthal_nmi_release()do { } while(0)
-#define rthal_nmi_proc_register()  do { } while(0)
-#define rthal_nmi_proc_unregister()do { } while(0)
 #endif /* CONFIG_XENO_HW_NMI_DEBUG_LATENCY */
 
 /* Public interface */
@@ -561,25 +568,8 @@ static inline int rthal_cpu_supported(int cpu)
 }
 #endif /* !CONFIG_SMP */
 
-#ifdef CONFIG_PROC_FS
-
-#include linux/proc_fs.h
-
-extern struct proc_dir_entry *rthal_proc_root;
-
-struct proc_dir_entry *rthal_add_proc_leaf(const char *name,
-  read_proc_t rdproc,
-  write_proc_t wrproc,
-  void *data,
-  struct proc_dir_entry *parent);
-
-struct proc_dir_entry *rthal_add_proc_seq(const char *name,
- struct file_operations *fops,
- size_t size,
- struct proc_dir_entry *parent);
-#endif /* CONFIG_PROC_FS */
-
 #ifdef CONFIG_IPIPE_TRACE
+
 #include linux/ipipe_trace.h
 
 static inline int rthal_trace_max_begin(unsigned long v)
diff --git a/ksrc/arch/generic/hal.c b/ksrc/arch/generic/hal.c
index 8a5ec39..6239b0f 100644
--- a/ksrc/arch/generic/hal.c
+++ b/ksrc/arch/generic/hal.c
@@ -42,12 +42,7 @@
 #endif
 #include asm/system.h
 #include asm/irq.h
-#include asm/uaccess.h
-#include asm/unistd.h
 #include asm/xenomai/hal.h
-#ifdef CONFIG_PROC_FS
-#include linux/proc_fs.h
-#endif /* CONFIG_PROC_FS */
 #include stdarg.h
 
 MODULE_LICENSE(GPL);
@@ -69,21 +64,10 @@ cpumask_t rthal_supported_cpus;
 EXPORT_SYMBOL(rthal_supported_cpus);
 #endif /* CONFIG_SMP */
 
-static struct {
-
-void (*handler) (void *cookie);
-void *cookie;
-const char *name;
-unsigned long hits[RTHAL_NR_CPUS];
-
-} rthal_apc_table[RTHAL_NR_APCS];
-
 static int rthal_init_done;
 
 static unsigned rthal_apc_virq;
 
-static unsigned long rthal_apc_map;
-
 static unsigned long rthal_apc_pending[RTHAL_NR_CPUS];
 
 static rthal_spinlock_t rthal_apc_lock = RTHAL_SPIN_LOCK_UNLOCKED;
@@ -98,6 +82,10 @@ rthal_trap_handler_t rthal_trap_handler;
 
 unsigned rthal_realtime_faults[RTHAL_NR_CPUS][RTHAL_NR_FAULTS];
 
+unsigned long rthal_apc_map;
+
+struct rthal_apc_desc rthal_apc_table[RTHAL_NR_APCS];
+
 volatile int rthal_sync_op;
 
 unsigned long rthal_critical_enter(void (*synch) (void))
@@ -615,190 +603,6 @@ int rthal_apc_schedule(int apc)
 return 0;
 }
 
-#ifdef CONFIG_PROC_FS
-
-struct proc_dir_entry *rthal_proc_root;
-
-static int hal_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-int len, major, minor, patchlevel;
-
-major = IPIPE_MAJOR_NUMBER;
-minor = IPIPE_MINOR_NUMBER;
-patchlevel = IPIPE_PATCH_NUMBER;
-
-len = sprintf(page, 

[Xenomai-git] Philippe Gerum : rtdm: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 17 12:27:42 2010 +0200

rtdm: convert to vfile

---

 include/rtdm/rtdm_driver.h |8 +-
 ksrc/skins/rtdm/device.c   |   17 +-
 ksrc/skins/rtdm/internal.h |   24 ++-
 ksrc/skins/rtdm/module.c   |   10 -
 ksrc/skins/rtdm/proc.c |  523 ++--
 5 files changed, 343 insertions(+), 239 deletions(-)

diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h
index fd41690..4b1d054 100644
--- a/include/rtdm/rtdm_driver.h
+++ b/include/rtdm/rtdm_driver.h
@@ -39,6 +39,7 @@
 #include nucleus/pod.h
 #include nucleus/synch.h
 #include nucleus/select.h
+#include nucleus/vfile.h
 #include rtdm/rtdm.h
 
 /* debug support */
@@ -517,8 +518,11 @@ struct rtdm_device {
 
/** Name of /proc entry for the device, must not be NULL */
const char *proc_name;
-   /** Set to device's /proc root entry after registration, do not modify 
*/
-   struct proc_dir_entry *proc_entry;
+#ifdef CONFIG_PROC_FS
+   /** Set to device's vfile data after registration, do not modify */
+   struct xnvfile_directory vfroot;
+   struct xnvfile_regular info_vfile;
+#endif
 
/** Driver definable device ID */
int device_id;
diff --git a/ksrc/skins/rtdm/device.c b/ksrc/skins/rtdm/device.c
index 3acc5ee..af097fb 100644
--- a/ksrc/skins/rtdm/device.c
+++ b/ksrc/skins/rtdm/device.c
@@ -213,7 +213,7 @@ int rtdm_dev_register(struct rtdm_device *device)
 
/* Sanity check: proc_name specified? */
XENO_ASSERT(RTDM, device-proc_name,
-   xnlogerr(RTDM: no /proc entry name specified\n);
+   xnlogerr(RTDM: no vfile (/proc) name specified\n);
return -EINVAL;);
 
switch (device-device_flags  RTDM_DEVICE_TYPE_MASK) {
@@ -310,10 +310,9 @@ int rtdm_dev_register(struct rtdm_device *device)
}
}
 
-#ifdef CONFIG_PROC_FS
-   if ((ret = rtdm_proc_register_device(device))  0)
+   ret = rtdm_proc_register_device(device);
+   if (ret)
goto err;
-#endif /* CONFIG_PROC_FS */
 
xnlock_get_irqsave(rt_dev_lock, s);
list_add_tail(device-reserved.entry,
@@ -350,10 +349,9 @@ int rtdm_dev_register(struct rtdm_device *device)
}
}
 
-#ifdef CONFIG_PROC_FS
-   if ((ret = rtdm_proc_register_device(device))  0)
+   ret = rtdm_proc_register_device(device);
+   if (ret)
goto err;
-#endif /* CONFIG_PROC_FS */
 
xnlock_get_irqsave(rt_dev_lock, s);
list_add_tail(device-reserved.entry,
@@ -443,10 +441,7 @@ int rtdm_dev_unregister(struct rtdm_device *device, 
unsigned int poll_delay)
 
xnlock_put_irqrestore(rt_dev_lock, s);
 
-#ifdef CONFIG_PROC_FS
-   remove_proc_entry(information, device-proc_entry);
-   remove_proc_entry(device-proc_name, rtdm_proc_root);
-#endif /* CONFIG_PROC_FS */
+   rtdm_proc_unregister_device(device);
 
up(nrt_dev_lock);
 
diff --git a/ksrc/skins/rtdm/internal.h b/ksrc/skins/rtdm/internal.h
index a05cd7d..74abed2 100644
--- a/ksrc/skins/rtdm/internal.h
+++ b/ksrc/skins/rtdm/internal.h
@@ -61,7 +61,6 @@ extern unsigned int devname_hashtab_size;
 extern unsigned int protocol_hashtab_size;
 extern struct list_head *rtdm_named_devices;
 extern struct list_head *rtdm_protocol_devices;
-extern struct proc_dir_entry *rtdm_proc_root;
 
 #ifdef MODULE
 #define rtdm_initialised 1
@@ -82,9 +81,28 @@ static inline void rtdm_dereference_device(struct 
rtdm_device *device)
 int __init rtdm_dev_init(void);
 void rtdm_dev_cleanup(void);
 
-int rtdm_proc_register_device(struct rtdm_device *device);
-int __init rtdm_proc_init(void);
+#ifdef CONFIG_PROC_FS
+int rtdm_proc_init(void);
 void rtdm_proc_cleanup(void);
+int rtdm_proc_register_device(struct rtdm_device *device);
+void rtdm_proc_unregister_device(struct rtdm_device *device);
+#else
+static inline int rtdm_proc_init(void)
+{
+   return 0;
+}
+void rtdm_proc_cleanup(void)
+{
+}
+static int rtdm_proc_register_device(struct rtdm_device *device)
+{
+   return 0;
+}
+static void rtdm_proc_unregister_device(struct rtdm_device *device)
+{
+}
+#endif
+
 void rtdm_apc_handler(void *cookie);
 
 #endif /* _RTDM_INTERNAL_H */
diff --git a/ksrc/skins/rtdm/module.c b/ksrc/skins/rtdm/module.c
index b5120e4..2ff8d7a 100644
--- a/ksrc/skins/rtdm/module.c
+++ b/ksrc/skins/rtdm/module.c
@@ -48,11 +48,7 @@ MODULE_PARM_DESC(tick_arg, Fixed clock tick value (us), 0 
for tick-less mode);
 static void __exit rtdm_skin_shutdown(int xtype)
 {
rtdm_dev_cleanup();
-
-#ifdef CONFIG_PROC_FS
rtdm_proc_cleanup();
-#endif /* 

[Xenomai-git] Philippe Gerum : vrtx: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Tue Jun  8 08:43:19 2010 +0200

vrtx: convert to vfile

---

 ksrc/skins/vrtx/event.c  |  130 --
 ksrc/skins/vrtx/heap.c   |   75 +++---
 ksrc/skins/vrtx/mb.c |  111 ---
 ksrc/skins/vrtx/module.c |9 +---
 ksrc/skins/vrtx/mx.c |  129 --
 ksrc/skins/vrtx/pt.c |   77 ---
 ksrc/skins/vrtx/queue.c  |  115 +---
 ksrc/skins/vrtx/sem.c|  112 ---
 8 files changed, 457 insertions(+), 301 deletions(-)

diff --git a/ksrc/skins/vrtx/event.c b/ksrc/skins/vrtx/event.c
index d0d30ec..402a6e0 100644
--- a/ksrc/skins/vrtx/event.c
+++ b/ksrc/skins/vrtx/event.c
@@ -27,72 +27,102 @@ static xnqueue_t vrtx_event_q;
 
 #ifdef CONFIG_PROC_FS
 
-static int __event_read_proc(char *page,
-char **start,
-off_t off, int count, int *eof, void *data)
-{
-   vrtxevent_t *evgroup = (vrtxevent_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
+struct vfile_priv {
+   struct xnpholder *curr;
+   int value;
+};
 
-   xnlock_get_irqsave(nklock, s);
+struct vfile_data {
+   int opt;
+   int mask;
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   p += sprintf(p, =0x%x\n, evgroup-events);
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vrtxevent *evgroup = xnvfile_priv(it-vfile);
 
-   if (xnsynch_nsleepers(evgroup-synchbase)  0) {
-   xnpholder_t *holder;
+   priv-curr = getheadpq(xnsynch_wait_queue(evgroup-synchbase));
+   priv-value = evgroup-events;
 
-   /* Pended event -- dump waiters. */
+   return xnsynch_nsleepers(evgroup-synchbase);
+}
 
-   holder = getheadpq(xnsynch_wait_queue(evgroup-synchbase));
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vrtxevent *evgroup = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+   struct vrtxtask *task;
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   vrtxtask_t *task = thread2vrtxtask(sleeper);
-   const char *mode =
-   (task-waitargs.evgroup.
-opt  1) ? all : any;
-   int mask = task-waitargs.evgroup.mask;
-   p += sprintf(p, +%s (mask=0x%x, %s)\n,
-xnthread_name(sleeper), mask, mode);
-   holder =
-   nextpq(xnsynch_wait_queue(evgroup-synchbase),
-  holder);
-   }
-   }
+   priv-value = evgroup-events; /* Refresh as we collect. */
 
-   xnlock_put_irqrestore(nklock, s);
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(evgroup-synchbase),
+   priv-curr);
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+   task = thread2vrtxtask(thread);
+   p-opt = task-waitargs.evgroup.opt;
+   p-mask = task-waitargs.evgroup.mask;
 
-   return len;
+   return 1;
 }
 
-extern xnptree_t __vrtx_ptree;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   /* Always dump current event mask value. */
+   xnvfile_printf(it, =0x%x\n, priv-value);
+   if (it-nrdata  0)
+   xnvfile_printf(it, \n%10s  %4s  %s\n,
+  MASK, MODE, WAITER);
+   } else
+   xnvfile_printf(it, 0x%-8x  %4s  %.*s\n,
+  p-mask,
+  p-opt  1 ? all : any,
+  (int)sizeof(p-name), p-name);
+
+   return 0;
+}
 
-static xnpnode_t __event_pnode = {
+static struct 

[Xenomai-git] Philippe Gerum : psos: convert to vfile

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

Author: Philippe Gerum r...@xenomai.org
Date:   Mon Jun  7 19:41:23 2010 +0200

psos: convert to vfile

---

 ksrc/skins/psos+/module.c |9 +---
 ksrc/skins/psos+/queue.c  |  131 
 ksrc/skins/psos+/rn.c |  122 +++---
 ksrc/skins/psos+/sem.c|  117 +---
 4 files changed, 236 insertions(+), 143 deletions(-)

diff --git a/ksrc/skins/psos+/module.c b/ksrc/skins/psos+/module.c
index bdba58b..33ac213 100644
--- a/ksrc/skins/psos+/module.c
+++ b/ksrc/skins/psos+/module.c
@@ -52,14 +52,7 @@ xntbase_t *psos_tbase;
 
 psos_rholder_t __psos_global_rholder;
 
-#ifdef CONFIG_PROC_FS
-xnptree_t __psos_ptree = {
-
-   .dir = NULL,
-   .name = psos,
-   .entries = 0,
-};
-#endif /* CONFIG_PROC_FS */
+DEFINE_XNPTREE(__psos_ptree, psos);
 
 void k_fatal(u_long err_code, u_long flags)
 {
diff --git a/ksrc/skins/psos+/queue.c b/ksrc/skins/psos+/queue.c
index 703ca3b..beb776f 100644
--- a/ksrc/skins/psos+/queue.c
+++ b/ksrc/skins/psos+/queue.c
@@ -31,67 +31,102 @@ static u_long q_destroy_internal(psosqueue_t *queue);
 
 #ifdef CONFIG_PROC_FS
 
-static int msgq_read_proc(char *page,
- char **start,
- off_t off, int count, int *eof, void *data)
-{
-   psosqueue_t *queue = (psosqueue_t *)data;
-   char *p = page;
-   int len;
-   spl_t s;
-
-   p += sprintf(p, maxnum=%lu:maxlen=%lu:mcount=%d\n,
-queue-maxnum, queue-maxlen, countq(queue-inq));
+struct vfile_priv {
+   struct xnpholder *curr;
+   unsigned long maxnum;
+   unsigned long maxlen;
+   int msgcount;
+};
 
-   xnlock_get_irqsave(nklock, s);
+struct vfile_data {
+   char name[XNOBJECT_NAME_LEN];
+};
 
-   if (xnsynch_nsleepers(queue-synchbase)  0) {
-   xnpholder_t *holder;
+static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   psosqueue_t *queue = xnvfile_priv(it-vfile);
 
-   /* Pended queue -- dump waiters. */
+   queue = psos_h2obj_active((u_long)queue, PSOS_QUEUE_MAGIC, psosqueue_t);
+   if (queue == NULL)
+   return -EIDRM;
 
-   holder = getheadpq(xnsynch_wait_queue(queue-synchbase));
+   priv-curr = getheadpq(xnsynch_wait_queue(queue-synchbase));
+   priv-maxnum = queue-maxnum;
+   priv-maxlen = queue-maxlen;
+   priv-msgcount = countq(queue-inq);
 
-   while (holder) {
-   xnthread_t *sleeper = link2thread(holder, plink);
-   p += sprintf(p, +%s\n, xnthread_name(sleeper));
-   holder =
-   nextpq(xnsynch_wait_queue(queue-synchbase),
-  holder);
-   }
-   }
+   return xnsynch_nsleepers(queue-synchbase);
+}
 
-   xnlock_put_irqrestore(nklock, s);
+static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   psosqueue_t *queue = xnvfile_priv(it-vfile);
+   struct vfile_data *p = data;
+   struct xnthread *thread;
+
+   if (priv-curr == NULL)
+   return 0;   /* We are done. */
+
+   /* Fetch current waiter, advance list cursor. */
+   thread = link2thread(priv-curr, plink);
+   priv-curr = nextpq(xnsynch_wait_queue(queue-synchbase),
+   priv-curr);
+   /* Collect thread name to be output in -show(). */
+   strncpy(p-name, xnthread_name(thread), sizeof(p-name));
+
+   return 1;
+}
 
-   len = (p - page) - off;
-   if (len = off + count)
-   *eof = 1;
-   *start = page + off;
-   if (len  count)
-   len = count;
-   if (len  0)
-   len = 0;
+static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
+{
+   struct vfile_priv *priv = xnvfile_iterator_priv(it);
+   struct vfile_data *p = data;
+
+   if (p == NULL) {/* Dump header. */
+   xnvfile_printf(it, 
+  maxnum=%lu:maxlen=%lu:mcount=%d\n,
+  priv-maxnum,
+  priv-maxlen,
+  priv-msgcount);
+   if (it-nrdata  0)
+   /* Queue is pended -- dump waiters */
+   xnvfile_printf(it, 
---\n);
+   } else
+   xnvfile_printf(it, %.*s\n,
+  (int)sizeof(p-name), p-name);
 
-   return len;
+   return 0;
 }
 
-extern xnptree_t __psos_ptree;
-
-static xnpnode_t msgq_pnode = {
+static struct 

[Xenomai-git] Philippe Gerum : powerpc: upgrade I-pipe support to 2.6.34-powerpc-2.10-02

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 17 14:33:02 2010 +0200

powerpc: upgrade I-pipe support to 2.6.34-powerpc-2.10-02

---

 ...ch = adeos-ipipe-2.6.34-powerpc-2.10-02.patch} |   29 +++-
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-01.patch 
b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-02.patch
similarity index 99%
rename from ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-01.patch
rename to ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-02.patch
index ba5e550..8f27969 100644
--- a/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-01.patch
+++ b/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.34-powerpc-2.10-02.patch
@@ -262,7 +262,7 @@ index bd100fc..8fa1901 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..4bb5021
+index 000..8aa91f0
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,277 @@
@@ -313,10 +313,10 @@ index 000..4bb5021
 +#include asm/paca.h
 +#endif
 +
-+#define IPIPE_ARCH_STRING 2.10-01
++#define IPIPE_ARCH_STRING 2.10-02
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER10
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_PATCH_NUMBER2
 +
 +#ifdef CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH
 +
@@ -6074,10 +6074,10 @@ index 000..fa1a951
 +#endif/* !__LINUX_IPIPE_BASE_H */
 diff --git a/include/linux/ipipe_lock.h b/include/linux/ipipe_lock.h
 new file mode 100644
-index 000..73ed46a
+index 000..032080f
 --- /dev/null
 +++ b/include/linux/ipipe_lock.h
-@@ -0,0 +1,215 @@
+@@ -0,0 +1,230 @@
 +/*   -*- linux-c -*-
 + *   include/linux/ipipe_lock.h
 + *
@@ -6143,6 +6143,19 @@ index 000..73ed46a
 +  __ret__;\
 +   })
 +
++#define PICK_SPINTRYLOCK_IRQ(lock)\
++  ({  \
++  int __ret__;\
++  if (ipipe_spinlock_p(lock)) \
++  __ret__ = 
__ipipe_spin_trylock_irq(ipipe_spinlock(lock)); \
++  else if (std_spinlock_raw_p(lock))  
\
++  __ret__ = 
__real_raw_spin_trylock_irq(std_spinlock_raw(lock)); \
++  else if (std_spinlock_p(lock))  \
++  __ret__ = 
__real_raw_spin_trylock_irq(std_spinlock(lock)-rlock); \
++  else __bad_lock_type(); \
++  __ret__;\
++   })
++
 +#define PICK_SPINUNLOCK_IRQRESTORE(lock, flags)   
\
 +  do {\
 +  if (ipipe_spinlock_p(lock)) \
@@ -6238,6 +6251,8 @@ index 000..73ed46a
 +
 +void __ipipe_spin_lock_irq(ipipe_spinlock_t *lock);
 +
++int __ipipe_spin_trylock_irq(ipipe_spinlock_t *lock);
++
 +void __ipipe_spin_unlock_irq(ipipe_spinlock_t *lock);
 +
 +unsigned long __ipipe_spin_lock_irqsave(ipipe_spinlock_t *lock);
@@ -6774,7 +6789,7 @@ index 2b7b81d..05cbf77 100644
   * tasks can access tsk-flags in readonly mode for example
   * with tsk_used_math (like during threaded core dumping).
 diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
-index 89fac6a..771e701 100644
+index 89fac6a..6135280 100644
 --- a/include/linux/spinlock.h
 +++ b/include/linux/spinlock.h
 @@ -88,10 +88,12 @@
@@ -6875,7 +6890,7 @@ index 89fac6a..771e701 100644
 +  __real_raw_spin_trylock(lock) ? \
1 : ({ local_irq_enable(); 0;  }); \
  })
-+#define raw_spin_trylock_irq(lock)PICK_SPINOP(_trylock_irq, lock)
++#define raw_spin_trylock_irq(lock)PICK_SPINTRYLOCK_IRQ(lock)
  
 -#define raw_spin_trylock_irqsave(lock, flags) \
 +#define __real_raw_spin_trylock_irqsave(lock, flags) \


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : x86: upgrade I-pipe support to 2.6.34-x86-2.7-02

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 17 14:33:34 2010 +0200

x86: upgrade I-pipe support to 2.6.34-x86-2.7-02

---

 ...1.patch = adeos-ipipe-2.6.34-x86-2.7-02.patch} |   29 +++-
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-01.patch 
b/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-02.patch
similarity index 99%
rename from ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-01.patch
rename to ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-02.patch
index d214c88..5f37be9 100644
--- a/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-01.patch
+++ b/ksrc/arch/x86/patches/adeos-ipipe-2.6.34-x86-2.7-02.patch
@@ -168,7 +168,7 @@ index 0b72282..6574056 100644
  /*
 diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h
 new file mode 100644
-index 000..ef806d7
+index 000..8e5c394
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,181 @@
@@ -199,10 +199,10 @@ index 000..ef806d7
 +#ifdef CONFIG_IPIPE
 +
 +#ifndef IPIPE_ARCH_STRING
-+#define IPIPE_ARCH_STRING 2.7-01
++#define IPIPE_ARCH_STRING 2.7-02
 +#define IPIPE_MAJOR_NUMBER2
 +#define IPIPE_MINOR_NUMBER7
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_PATCH_NUMBER2
 +#endif
 +
 +DECLARE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
@@ -5708,10 +5708,10 @@ index 000..fa1a951
 +#endif/* !__LINUX_IPIPE_BASE_H */
 diff --git a/include/linux/ipipe_lock.h b/include/linux/ipipe_lock.h
 new file mode 100644
-index 000..73ed46a
+index 000..032080f
 --- /dev/null
 +++ b/include/linux/ipipe_lock.h
-@@ -0,0 +1,215 @@
+@@ -0,0 +1,230 @@
 +/*   -*- linux-c -*-
 + *   include/linux/ipipe_lock.h
 + *
@@ -5777,6 +5777,19 @@ index 000..73ed46a
 +  __ret__;\
 +   })
 +
++#define PICK_SPINTRYLOCK_IRQ(lock)\
++  ({  \
++  int __ret__;\
++  if (ipipe_spinlock_p(lock)) \
++  __ret__ = 
__ipipe_spin_trylock_irq(ipipe_spinlock(lock)); \
++  else if (std_spinlock_raw_p(lock))  
\
++  __ret__ = 
__real_raw_spin_trylock_irq(std_spinlock_raw(lock)); \
++  else if (std_spinlock_p(lock))  \
++  __ret__ = 
__real_raw_spin_trylock_irq(std_spinlock(lock)-rlock); \
++  else __bad_lock_type(); \
++  __ret__;\
++   })
++
 +#define PICK_SPINUNLOCK_IRQRESTORE(lock, flags)   
\
 +  do {\
 +  if (ipipe_spinlock_p(lock)) \
@@ -5872,6 +5885,8 @@ index 000..73ed46a
 +
 +void __ipipe_spin_lock_irq(ipipe_spinlock_t *lock);
 +
++int __ipipe_spin_trylock_irq(ipipe_spinlock_t *lock);
++
 +void __ipipe_spin_unlock_irq(ipipe_spinlock_t *lock);
 +
 +unsigned long __ipipe_spin_lock_irqsave(ipipe_spinlock_t *lock);
@@ -6408,7 +6423,7 @@ index 2b7b81d..05cbf77 100644
   * tasks can access tsk-flags in readonly mode for example
   * with tsk_used_math (like during threaded core dumping).
 diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
-index 89fac6a..771e701 100644
+index 89fac6a..6135280 100644
 --- a/include/linux/spinlock.h
 +++ b/include/linux/spinlock.h
 @@ -88,10 +88,12 @@
@@ -6509,7 +6524,7 @@ index 89fac6a..771e701 100644
 +  __real_raw_spin_trylock(lock) ? \
1 : ({ local_irq_enable(); 0;  }); \
  })
-+#define raw_spin_trylock_irq(lock)PICK_SPINOP(_trylock_irq, lock)
++#define raw_spin_trylock_irq(lock)PICK_SPINTRYLOCK_IRQ(lock)
  
 -#define raw_spin_trylock_irqsave(lock, flags) \
 +#define __real_raw_spin_trylock_irqsave(lock, flags) \


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : blackfin: upgrade I-pipe support to 2.6.34-blackfin-1. 14-02

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

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Jun 17 23:56:54 2010 +0200

blackfin: upgrade I-pipe support to 2.6.34-blackfin-1.14-02

---

 ...h = adeos-ipipe-2.6.34-blackfin-1.14-02.patch} |   24 ---
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git 
a/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-01.patch 
b/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-02.patch
similarity index 99%
rename from ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-01.patch
rename to ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-02.patch
index d62e225..1668422 100644
--- a/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-01.patch
+++ b/ksrc/arch/blackfin/patches/adeos-ipipe-2.6.34-blackfin-1.14-02.patch
@@ -12,7 +12,7 @@ index c078849..799b1c0 100644
  
  choice
 diff --git a/arch/blackfin/include/asm/ipipe.h 
b/arch/blackfin/include/asm/ipipe.h
-index d3b4044..331ef0b 100644
+index d3b4044..4530dfa 100644
 --- a/arch/blackfin/include/asm/ipipe.h
 +++ b/arch/blackfin/include/asm/ipipe.h
 @@ -34,11 +34,12 @@
@@ -22,12 +22,12 @@ index d3b4044..331ef0b 100644
 +#include asm/bitsperlong.h
  
 -#define IPIPE_ARCH_STRING 1.12-00
-+#define IPIPE_ARCH_STRING 1.14-01
++#define IPIPE_ARCH_STRING 1.14-02
  #define IPIPE_MAJOR_NUMBER1
 -#define IPIPE_MINOR_NUMBER12
 -#define IPIPE_PATCH_NUMBER0
 +#define IPIPE_MINOR_NUMBER14
-+#define IPIPE_PATCH_NUMBER1
++#define IPIPE_PATCH_NUMBER2
  
  #ifdef CONFIG_SMP
  #error I-pipe/blackfin: SMP not implemented
@@ -256,7 +256,7 @@ index 1a496cd..d953572 100644
  
  void __ipipe_disable_root_irqs_hw(void)
 diff --git a/arch/blackfin/mach-common/ints-priority.c 
b/arch/blackfin/mach-common/ints-priority.c
-index 7ad8878..33f1253 100644
+index 7ad8878..8400131 100644
 --- a/arch/blackfin/mach-common/ints-priority.c
 +++ b/arch/blackfin/mach-common/ints-priority.c
 @@ -15,6 +15,7 @@
@@ -294,17 +294,23 @@ index 7ad8878..33f1253 100644
  
if (likely(vec == EVT_IVTMR_P))
irq = IRQ_CORETMR;
-@@ -1436,6 +1436,18 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs 
*regs)
+@@ -1436,6 +1436,24 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs 
*regs)
__ipipe_handle_irq(irq, regs);
ipipe_trace_irq_exit(irq);
  
 +  if (user_mode(regs) 
++  !ipipe_test_foreign_stack() 
 +  (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).
++   * Testing for user_regs() does NOT fully eliminate
++   * foreign stack contexts, because of the forged
++   * interrupt returns we do through
++   * __ipipe_call_irqtail. In that case, we might have
++   * preempted a foreign stack context in a high
++   * priority domain, with a single interrupt level now
++   * pending after the irqtail unwinding is done. In
++   * which case user_mode() is now true, and the event
++   * gets dispatched spuriously.
 +   */
 +  current-ipipe_flags = ~PF_EVTRET;
 +  __ipipe_dispatch_event(IPIPE_EVENT_RETURN, regs);


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git