run_tests: Nicer output, configurable verbosity.
[bertos.git] / bertos / kern / monitor.c
index 1f9ee7919acd1032afda8724ad3b459f884b567b..0c48ed5c9d46a419735497a61a1a5dd255ea4277 100644 (file)
@@ -42,7 +42,7 @@
 #if CONFIG_KERN_MONITOR
 
 #include "proc_p.h"
-#include <mware/list.h>
+#include <struct/list.h>
 #include <drv/timer.h>
 #include <kern/proc.h>
 #include <cpu/frame.h> /* CPU_STACK_GROWS_UPWARD */
@@ -83,16 +83,18 @@ size_t monitor_checkStack(cpustack_t *stack_base, size_t stack_size)
        cpustack_t *beg;
        cpustack_t *cur;
        cpustack_t *end;
+       int inc;
        size_t sp_free;
 
+
        beg = stack_base;
-       end = stack_base + stack_size / sizeof(cpustack_t) - 1;
+       end = stack_base + stack_size / sizeof(cpustack_t);
+       inc = +1;
 
        if (CPU_STACK_GROWS_UPWARD)
        {
-               cur = beg;
-               beg = end;
-               end = cur;
+               SWAP(beg, end);
+               inc = -1;
        }
 
        cur = beg;
@@ -101,10 +103,7 @@ size_t monitor_checkStack(cpustack_t *stack_base, size_t stack_size)
                if (*cur != CONFIG_KERN_STACKFILLCODE)
                        break;
 
-               if (CPU_STACK_GROWS_UPWARD)
-                       cur--;
-               else
-                       cur++;
+               cur += inc;
        }
 
        sp_free = ABS(cur - beg) * sizeof(cpustack_t);