diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/cortex-m/task.c | 4 | ||||
-rw-r--r-- | core/cortex-m0/task.c | 4 | ||||
-rw-r--r-- | core/nds32/task.c | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index f9e4d11fdb..639cef9d48 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -177,6 +177,10 @@ inline int get_interrupt_context(void) task_id_t task_get_current(void) { +#ifdef CONFIG_DEBUG_BRINGUP + /* If we haven't done a context switch then our task ID isn't valid */ + ASSERT(current_task != (task_ *)scratchpad); +#endif return current_task - tasks; } diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c index 1ab82d7d24..9d9b049c37 100644 --- a/core/cortex-m0/task.c +++ b/core/cortex-m0/task.c @@ -164,6 +164,10 @@ inline int get_interrupt_context(void) task_id_t task_get_current(void) { +#ifdef CONFIG_DEBUG_BRINGUP + /* If we haven't done a context switch then our task ID isn't valid */ + ASSERT(current_task != (task_ *)scratchpad); +#endif return current_task - tasks; } diff --git a/core/nds32/task.c b/core/nds32/task.c index 1725f2b498..269513092b 100644 --- a/core/nds32/task.c +++ b/core/nds32/task.c @@ -171,6 +171,10 @@ inline int in_interrupt_context(void) task_id_t task_get_current(void) { +#ifdef CONFIG_DEBUG_BRINGUP + /* If we haven't done a context switch then our task ID isn't valid */ + ASSERT(current_task != (task_ *)scratchpad); +#endif return current_task - tasks; } |