projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
run_tests: Nicer output, configurable verbosity.
[bertos.git]
/
bertos
/
kern
/
monitor.c
diff --git
a/bertos/kern/monitor.c
b/bertos/kern/monitor.c
index d46c750a0ed14540bf9aa4cf2f3fa4af75d02a80..0c48ed5c9d46a419735497a61a1a5dd255ea4277 100644
(file)
--- a/
bertos/kern/monitor.c
+++ b/
bertos/kern/monitor.c
@@
-42,9
+42,10
@@
#if CONFIG_KERN_MONITOR
#include "proc_p.h"
#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 <drv/timer.h>
#include <kern/proc.h>
+#include <cpu/frame.h> /* CPU_STACK_GROWS_UPWARD */
#include <cfg/macros.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
@@
-82,16
+83,18
@@
size_t monitor_checkStack(cpustack_t *stack_base, size_t stack_size)
cpustack_t *beg;
cpustack_t *cur;
cpustack_t *end;
cpustack_t *beg;
cpustack_t *cur;
cpustack_t *end;
+ int inc;
size_t sp_free;
size_t sp_free;
+
beg = stack_base;
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)
{
if (CPU_STACK_GROWS_UPWARD)
{
- cur = beg;
- beg = end;
- end = cur;
+ SWAP(beg, end);
+ inc = -1;
}
cur = beg;
}
cur = beg;
@@
-100,10
+103,7
@@
size_t monitor_checkStack(cpustack_t *stack_base, size_t stack_size)
if (*cur != CONFIG_KERN_STACKFILLCODE)
break;
if (*cur != CONFIG_KERN_STACKFILLCODE)
break;
- if (CPU_STACK_GROWS_UPWARD)
- cur--;
- else
- cur++;
+ cur += inc;
}
sp_free = ABS(cur - beg) * sizeof(cpustack_t);
}
sp_free = ABS(cur - beg) * sizeof(cpustack_t);
@@
-126,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);
{
Process *p = containerof(node, Process, monitor.link);
size_t free = monitor_checkStack(p->stack_base, p->stack_size);
- kprintf("%-8p%-8p%-8
lu%-8l
u %s\n",
+ kprintf("%-8p%-8p%-8
zu%-8z
u %s\n",
p, p->stack_base, p->stack_size, free, p->monitor.name);
}
proc_permit();
p, p->stack_base, p->stack_size, free, p->monitor.name);
}
proc_permit();