You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/12/06 11:52:25 UTC

[mynewt-core] branch master updated (8615b0d -> 13423bd)

This is an automated email from the ASF dual-hosted git repository.

andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


    from 8615b0d  sys/console: Clean up syscfg value names
     new daeb23b  kernel/os: Add os_task_stacktop_get
     new 13423bd  kernel/os: Fix invalid stacktop references

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 kernel/os/include/os/os_task.h | 9 +++++++++
 kernel/os/src/os_sched.c       | 6 +++---
 kernel/os/src/os_stacktrace.c  | 6 ++++--
 kernel/os/src/os_task.c        | 8 +++++++-
 4 files changed, 23 insertions(+), 6 deletions(-)


[mynewt-core] 02/02: kernel/os: Fix invalid stacktop references

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 13423bde3b2a8177431b740e4e61f93beac1faf1
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Dec 5 10:40:32 2019 +0100

    kernel/os: Fix invalid stacktop references
---
 kernel/os/src/os_sched.c      | 6 +++---
 kernel/os/src/os_stacktrace.c | 6 ++++--
 kernel/os/src/os_task.c       | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/kernel/os/src/os_sched.c b/kernel/os/src/os_sched.c
index 1a468b2..151079e 100644
--- a/kernel/os/src/os_sched.c
+++ b/kernel/os/src/os_sched.c
@@ -77,12 +77,12 @@ os_sched_ctx_sw_hook(struct os_task *next_t)
     uint32_t ticks;
 
 #if MYNEWT_VAL(OS_CTX_SW_STACK_CHECK)
-    os_stack_t *top;
+    os_stack_t *stack;
     int i;
 
-    top = g_current_task->t_stacktop - g_current_task->t_stacksize;
+    stack = g_current_task->t_stackbottom;
     for (i = 0; i < MYNEWT_VAL(OS_CTX_SW_STACK_GUARD); i++) {
-        assert(top[i] == OS_STACK_PATTERN);
+        assert(stack[i] == OS_STACK_PATTERN);
     }
 #endif
     next_t->t_ctx_sw_cnt++;
diff --git a/kernel/os/src/os_stacktrace.c b/kernel/os/src/os_stacktrace.c
index 91a3bc4..33e0453 100644
--- a/kernel/os/src/os_stacktrace.c
+++ b/kernel/os/src/os_stacktrace.c
@@ -78,14 +78,16 @@ os_stacktrace(uintptr_t sp)
     uintptr_t addr;
     uintptr_t end;
     struct os_task *t;
+    os_stack_t *stacktop;
 
     sp &= ~(sizeof(uintptr_t) - 1);
     end = sp + OS_STACK_DEPTH_MAX;
 
     if (g_os_started && g_current_task) {
         t = g_current_task;
-        if (sp > (uintptr_t)t->t_stacktop && end > (uintptr_t)t->t_stacktop) {
-            end = (uintptr_t)t->t_stacktop;
+        stacktop = os_task_stacktop_get(t);
+        if (end > (uintptr_t)stacktop) {
+            end = (uintptr_t)stacktop;
         }
     } else {
         t = NULL;
diff --git a/kernel/os/src/os_task.c b/kernel/os/src/os_task.c
index 2129493..7fbeeef 100644
--- a/kernel/os/src/os_task.c
+++ b/kernel/os/src/os_task.c
@@ -95,7 +95,7 @@ os_task_init(struct os_task *t, const char *name, os_task_func_t func,
     _clear_stack(stack_bottom, stack_size);
     t->t_stackbottom = stack_bottom;
     t->t_stacksize = stack_size;
-    t->t_stackptr = os_arch_task_stack_init(t, &stack_bottom[stack_size],
+    t->t_stackptr = os_arch_task_stack_init(t, os_task_stacktop_get(t),
                                             t->t_stacksize);
 
     STAILQ_FOREACH(task, &g_os_task_list, t_os_task_list) {


[mynewt-core] 01/02: kernel/os: Add os_task_stacktop_get

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit daeb23b029b292fdf318fb466a3d1753dbe16759
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Dec 5 10:40:06 2019 +0100

    kernel/os: Add os_task_stacktop_get
---
 kernel/os/include/os/os_task.h | 9 +++++++++
 kernel/os/src/os_task.c        | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/kernel/os/include/os/os_task.h b/kernel/os/include/os/os_task.h
index 83022e4..b42f51c 100644
--- a/kernel/os/include/os/os_task.h
+++ b/kernel/os/include/os/os_task.h
@@ -172,6 +172,15 @@ int os_task_init(struct os_task *, const char *, os_task_func_t, void *,
 int os_task_remove(struct os_task *t);
 
 /**
+ * Return pointer to top of stack for given task
+ *
+ * @param t The task
+ *
+ * @return pointer to top of stack
+ */
+os_stack_t *os_task_stacktop_get(struct os_task *t);
+
+/**
  * Return the number of tasks initialized.
  *
  * @return number of tasks initialized
diff --git a/kernel/os/src/os_task.c b/kernel/os/src/os_task.c
index cea22dd..2129493 100644
--- a/kernel/os/src/os_task.c
+++ b/kernel/os/src/os_task.c
@@ -126,6 +126,12 @@ err:
     return (rc);
 }
 
+os_stack_t *
+os_task_stacktop_get(struct os_task *t)
+{
+    return &t->t_stackbottom[t->t_stacksize];
+}
+
 int
 os_task_remove(struct os_task *t)
 {