Module: xenomai-forge
Branch: next
Commit: fbc462d265d9f153eb3f95578e62ff63851a8ad3
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=fbc462d265d9f153eb3f95578e62ff63851a8ad3

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon May 26 15:11:39 2014 +0200

cobalt/shadow: tag Cobalt-originated SIGXCPU(SIGDEBUG) signal values

---

 include/cobalt/kernel/shadow.h |    2 +-
 include/cobalt/uapi/signal.h   |    3 +++
 kernel/cobalt/shadow.c         |   10 +++++-----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/cobalt/kernel/shadow.h b/include/cobalt/kernel/shadow.h
index fa7e724..db61116 100644
--- a/include/cobalt/kernel/shadow.h
+++ b/include/cobalt/kernel/shadow.h
@@ -109,7 +109,7 @@ void xnshadow_send_sig(struct xnthread *thread,
                       int sig,
                       int arg);
 
-void xnshadow_call_mayday(struct xnthread *thread, int sigtype);
+void xnshadow_call_mayday(struct xnthread *thread, int reason);
 
 void __xnshadow_kick(struct xnthread *thread);
 
diff --git a/include/cobalt/uapi/signal.h b/include/cobalt/uapi/signal.h
index a99fd45..2508008 100644
--- a/include/cobalt/uapi/signal.h
+++ b/include/cobalt/uapi/signal.h
@@ -46,6 +46,9 @@
 #define SIGDEBUG                       SIGXCPU
 #define sigdebug_code(si)              ((si)->si_value.sival_int)
 #define sigdebug_reason(si)            (sigdebug_code(si) & 0xff)
+#define sigdebug_marker                        0xfccf0000
+#define sigdebug_marked(si)            \
+       ((sigdebug_code(si) & 0xffff0000) == sigdebug_marker)
 
 /* Possible values of sigdebug_reason() */
 #define SIGDEBUG_UNDEFINED             0
diff --git a/kernel/cobalt/shadow.c b/kernel/cobalt/shadow.c
index c6889a6..465715a 100644
--- a/kernel/cobalt/shadow.c
+++ b/kernel/cobalt/shadow.c
@@ -579,7 +579,7 @@ void xnshadow_relax(int notify, int reason)
                        memset(&si, 0, sizeof(si));
                        si.si_signo = SIGDEBUG;
                        si.si_code = SI_QUEUE;
-                       si.si_int = reason;
+                       si.si_int = reason | sigdebug_marker;
                        send_sig_info(SIGDEBUG, &si, p);
                }
                xnsynch_detect_claimed_relax(thread);
@@ -819,7 +819,7 @@ static inline int disable_ondemand_memory(void)
                memset(&si, 0, sizeof(si));
                si.si_signo = SIGDEBUG;
                si.si_code = SI_QUEUE;
-               si.si_int = SIGDEBUG_NOMLOCK;
+               si.si_int = SIGDEBUG_NOMLOCK | sigdebug_marker;
                send_sig_info(SIGDEBUG, &si, p);
                return 0;
        }
@@ -1170,14 +1170,14 @@ static unsigned long map_mayday_page(struct task_struct 
*p)
 }
 
 /* nklock locked, irqs off */
-void xnshadow_call_mayday(struct xnthread *thread, int sigtype)
+void xnshadow_call_mayday(struct xnthread *thread, int reason)
 {
        struct task_struct *p = xnthread_host_task(thread);
 
        /* Mayday traps are available to userland threads only. */
        XENO_BUGON(NUCLEUS, !xnthread_test_state(thread, XNUSER));
        xnthread_set_info(thread, XNKICKED);
-       xnshadow_send_sig(thread, SIGDEBUG, sigtype);
+       xnshadow_send_sig(thread, SIGDEBUG, reason);
        xnarch_call_mayday(p);
 }
 EXPORT_SYMBOL_GPL(xnshadow_call_mayday);
@@ -1651,7 +1651,7 @@ void xnshadow_send_sig(struct xnthread *thread, int sig, 
int arg)
                },
                .task = xnthread_host_task(thread),
                .signo = sig,
-               .sigval = arg,
+               .sigval = sig == SIGDEBUG ? arg | sigdebug_marker : arg,
        };
 
        trace_cobalt_lostage_request("signal", sigwork.task);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to