Module: xenomai-head
Branch: master
Commit: de232a7744cd2069a70727d57e91fb033686d606
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=de232a7744cd2069a70727d57e91fb033686d606

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Jun 19 13:30:24 2011 +0200

nucleus: move mayday addr to sys_ppd only

---

 include/nucleus/ppd.h     |    3 ---
 include/nucleus/sys_ppd.h |    4 +++-
 ksrc/nucleus/shadow.c     |   34 +++++++++++++++++++---------------
 3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/include/nucleus/ppd.h b/include/nucleus/ppd.h
index 972b0f2..85971f0 100644
--- a/include/nucleus/ppd.h
+++ b/include/nucleus/ppd.h
@@ -14,9 +14,6 @@ typedef struct xnshadow_ppd_key {
 typedef struct xnshadow_ppd_t {
     xnshadow_ppd_key_t key;
     xnholder_t link;
-#ifdef XNARCH_HAVE_MAYDAY
-    unsigned long mayday_addr;
-#endif
 #define link2ppd(ln)   container_of(ln, xnshadow_ppd_t, link)
 } xnshadow_ppd_t;
 
diff --git a/include/nucleus/sys_ppd.h b/include/nucleus/sys_ppd.h
index 8f8cb44..3ae8581 100644
--- a/include/nucleus/sys_ppd.h
+++ b/include/nucleus/sys_ppd.h
@@ -7,7 +7,9 @@
 struct xnsys_ppd {
        xnshadow_ppd_t ppd;
        xnheap_t sem_heap;
-
+#ifdef XNARCH_HAVE_MAYDAY
+       unsigned long mayday_addr;
+#endif
 #define ppd2sys(addr) container_of(addr, struct xnsys_ppd, ppd)
 };
 
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index f6e0893..e5dd421 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1632,11 +1632,11 @@ static inline void do_mayday_event(struct pt_regs *regs)
 {
        struct xnthread *thread = xnshadow_thread(current);
        struct xnarchtcb *tcb = xnthread_archtcb(thread);
-       struct xnshadow_ppd_t *sys_ppd;
+       struct xnsys_ppd *sys_ppd;
 
        /* We enter the event handler with hw IRQs off. */
        xnlock_get(&nklock);
-       sys_ppd = xnshadow_ppd_get(0);
+       sys_ppd = xnsys_ppd_get(0);
        xnlock_put(&nklock);
        XENO_BUGON(NUCLEUS, sys_ppd == NULL);
 
@@ -1754,16 +1754,6 @@ static int xnshadow_sys_bind(struct pt_regs *regs)
 
        sys_ppd->key.muxid = 0;
        sys_ppd->key.mm = current->mm;
-#ifdef XNARCH_HAVE_MAYDAY
-       sys_ppd->mayday_addr = map_mayday_page(current);
-       if (sys_ppd->mayday_addr == 0) {
-               printk(KERN_WARNING
-                      "Xenomai: %s[%d] cannot map MAYDAY page\n",
-                      current->comm, current->pid);
-               err = -ENOMEM;
-               goto fail_destroy_sys_ppd;
-       }
-#endif /* XNARCH_HAVE_MAYDAY */
 
        if (ppd_insert(sys_ppd) == -EBUSY) {
                /* In case of concurrent binding (which can not happen with
@@ -2109,12 +2099,26 @@ static void *xnshadow_sys_event(int event, void *data)
                err = xnheap_init_mapped(&p->sem_heap,
                                         CONFIG_XENO_OPT_SEM_HEAPSZ * 1024,
                                         XNARCH_SHARED_HEAP_FLAGS);
-               if (err) {
+               if (err)
+                       goto err_free_host_mem;
+
+               xnheap_set_label(&p->sem_heap,
+                                "private sem heap [%d]", current->pid);
+
+#ifdef XNARCH_HAVE_MAYDAY
+               p->mayday_addr = map_mayday_page(current);
+               if (p->mayday_addr == 0) {
+                       printk(KERN_WARNING
+                              "Xenomai: %s[%d] cannot map MAYDAY page\n",
+                              current->comm, current->pid);
+                       err = -ENOMEM;
+
+                 err_free_host_mem:
                        xnarch_free_host_mem(p, sizeof(*p));
                        return ERR_PTR(err);
                }
-               xnheap_set_label(&p->sem_heap,
-                                "private sem heap [%d]", current->pid);
+#endif /* XNARCH_HAVE_MAYDAY */
+
                xnarch_atomic_inc(&muxtable[0].refcnt);
                return &p->ppd;
 


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

Reply via email to