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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Jul 31 11:36:22 2013 +0200

cobalt/pod: drop the XNSTARTED bit from the thread state mask

Since XNDORMANT now exclusively means "never started", we don't need
the XNSTARTED bit anymore.

Strictly speaking, XNDORMANT == !XNSTARTED and conversely.

---

 include/cobalt/uapi/kernel/thread.h |   29 ++++++++++++++---------------
 kernel/cobalt/pod.c                 |    2 +-
 kernel/cobalt/sched.c               |    4 ++--
 kernel/cobalt/shadow.c              |    4 ++--
 4 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index 7913d82..069507b 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -35,21 +35,20 @@
 #define XNREADY   0x00000008 /**< Linked to the ready queue. */
 #define XNDORMANT 0x00000010 /**< Not started yet */
 #define XNZOMBIE  0x00000020 /**< Zombie thread in deletion process */
-#define XNSTARTED 0x00000040 /**< Thread has been started */
-#define XNMAPPED  0x00000080 /**< Thread is mapped to a linux task */
-#define XNRELAX   0x00000100 /**< Relaxed shadow thread (blocking bit) */
-#define XNMIGRATE 0x00000200 /**< Thread is currently migrating to another 
CPU. */
-#define XNHELD    0x00000400 /**< Thread is held to process emergency. */
+#define XNMAPPED  0x00000040 /**< Thread is mapped to a linux task */
+#define XNRELAX   0x00000080 /**< Relaxed shadow thread (blocking bit) */
+#define XNMIGRATE 0x00000100 /**< Thread is currently migrating to another 
CPU. */
+#define XNHELD    0x00000200 /**< Thread is held to process emergency. */
 
-#define XNBOOST   0x00000800 /**< Undergoes a PIP boost */
-#define XNDEBUG   0x00001000 /**< Hit a debugger breakpoint */
-#define XNLOCK    0x00002000 /**< Holds the scheduler lock (i.e. not 
preemptible) */
-#define XNRRB     0x00004000 /**< Undergoes a round-robin scheduling */
-#define XNTRAPSW  0x00008000 /**< Trap execution mode switches */
-#define XNFPU     0x00010000 /**< Thread uses FPU */
-#define XNROOT    0x00020000 /**< Root thread (that is, Linux/IDLE) */
-#define XNWEAK    0x00040000 /**< Non real-time shadow (from the WEAK class) */
-#define XNUSER    0x00080000 /**< Shadow thread running in userland */
+#define XNBOOST   0x00000400 /**< Undergoes a PIP boost */
+#define XNDEBUG   0x00000800 /**< Hit a debugger breakpoint */
+#define XNLOCK    0x00001000 /**< Holds the scheduler lock (i.e. not 
preemptible) */
+#define XNRRB     0x00002000 /**< Undergoes a round-robin scheduling */
+#define XNTRAPSW  0x00004000 /**< Trap execution mode switches */
+#define XNFPU     0x00008000 /**< Thread uses FPU */
+#define XNROOT    0x00010000 /**< Root thread (that is, Linux/IDLE) */
+#define XNWEAK    0x00020000 /**< Non real-time shadow (from the WEAK class) */
+#define XNUSER    0x00040000 /**< Shadow thread running in userland */
 
 /** @} */
 
@@ -91,7 +90,7 @@
  * 'r' -> Undergoes round-robin.
  * 't' -> Mode switches trapped.
  */
-#define XNTHREAD_STATE_LABELS  "SWDRU...X.HbTlrt...."
+#define XNTHREAD_STATE_LABELS  "SWDRU..X.HbTlrt...."
 
 /**
  * @brief Structure containing thread information.
diff --git a/kernel/cobalt/pod.c b/kernel/cobalt/pod.c
index 0071d96..0b35cb9 100644
--- a/kernel/cobalt/pod.c
+++ b/kernel/cobalt/pod.c
@@ -545,7 +545,7 @@ int xnpod_start_thread(struct xnthread *thread,
        }
 #endif /* CONFIG_SMP */
 
-       xnthread_set_state(thread, (attr->mode & (XNTHREAD_MODE_BITS | XNSUSP)) 
| XNSTARTED);
+       xnthread_set_state(thread, attr->mode & (XNTHREAD_MODE_BITS | XNSUSP));
        thread->imode = (attr->mode & XNTHREAD_MODE_BITS);
        thread->entry = attr->entry;
        thread->cookie = attr->cookie;
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index c353674..342fd00 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -153,7 +153,7 @@ void xnsched_init(struct xnsched *sched, int cpu)
        xntimer_set_sched(&sched->htimer, sched);
        sched->zombie = NULL;
 
-       attr.flags = XNROOT | XNSTARTED | XNFPU;
+       attr.flags = XNROOT | XNFPU;
        attr.name = root_name;
        attr.personality = &generic_personality;
        param.idle.prio = XNSCHED_IDLE_PRIO;
@@ -367,7 +367,7 @@ int xnsched_set_policy(struct xnthread *thread,
        if (xnthread_test_state(thread, XNREADY))
                xnsched_enqueue(thread);
 
-       if (xnthread_test_state(thread, XNSTARTED))
+       if (!xnthread_test_state(thread, XNDORMANT))
                xnsched_set_resched(thread->sched);
 
        return 0;
diff --git a/kernel/cobalt/shadow.c b/kernel/cobalt/shadow.c
index bfffef1..9efd929 100644
--- a/kernel/cobalt/shadow.c
+++ b/kernel/cobalt/shadow.c
@@ -1010,7 +1010,7 @@ int xnshadow_map_kernel(struct xnthread *thread, struct 
completion *done)
         * Make sure xnpod_start_thread() did not slip in from another
         * CPU while we were back from wakeup_parent().
         */
-       if (xnthread_test_state(thread, XNSTARTED) == 0)
+       if (thread->entry == NULL)
                xnpod_suspend_thread(thread, XNDORMANT,
                                     XN_INFINITE, XN_RELATIVE, NULL);
        xnlock_put_irqrestore(&nklock, s);
@@ -2261,7 +2261,7 @@ no_ptrace:
                            * Allow ptraced threads to run shortly in order to
                            * properly recover from a stopped state.
                            */
-                          xnthread_test_state(next, XNSTARTED)
+                          !xnthread_test_state(next, XNDORMANT)
                           && xnthread_test_state(next, XNPEND)) {
                        xntrace_panic_freeze();
                        show_stack(xnthread_host_task(next), NULL);


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

Reply via email to