monitor: Space pointers by one space to make the actuaqlly readable
[bertos.git] / bertos / kern / monitor.c
index 1f9ee7919acd1032afda8724ad3b459f884b567b..c055e2cee7f8896ffda30bb6c017f5fc121b9f5c 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);
@@ -117,7 +116,7 @@ void monitor_report(void)
        Node *node;
        int i;
 
-       kprintf("%-8s%-8s%-8s%-8s %s\n", "TCB", "SPbase", "SPsize", "SPfree", "Name");
+       kprintf("%-9s%-9s%-9s%-9s%s\n", "TCB", "SPbase", "SPsize", "SPfree", "Name");
        for (i = 0; i < 56; i++)
                kputchar('-');
        kputchar('\n');
@@ -127,7 +126,7 @@ void monitor_report(void)
        {
                Process *p = containerof(node, Process, monitor.link);
                size_t free = monitor_checkStack(p->stack_base, p->stack_size);
-               kprintf("%-8p%-8p%-8zu%-8zu %s\n",
+               kprintf("%-9p%-9p%-9zu%-9zu%s\n",
                        p, p->stack_base, p->stack_size, free, p->monitor.name);
        }
        proc_permit();