}
-void monitor_add(Process* proc, const char* name, cpustack_t* stack_base, size_t stack_size)
+void monitor_add(Process *proc, const char *name)
{
proc->monitor.name = name;
- proc->monitor.stack_base = stack_base;
- proc->monitor.stack_size = stack_size;
ADDTAIL(&MonitorProcs, &proc->monitor.link);
}
REMOVE(&proc->monitor.link);
}
-void monitor_rename(Process *proc, const char* name)
+void monitor_rename(Process *proc, const char *name)
{
proc->monitor.name = name;
}
#define MONITOR_NODE_TO_PROCESS(node) \
(struct Process *)((intptr_t)(node) - offsetof(struct Process, monitor.link))
-size_t monitor_checkStack(cpustack_t* stack_base, size_t stack_size)
+size_t monitor_checkStack(cpustack_t *stack_base, size_t stack_size)
{
cpustack_t* beg;
cpustack_t* cur;
p->monitor.link.succ;
p = MONITOR_NODE_TO_PROCESS(p->monitor.link.succ))
{
- size_t free = monitor_checkStack(p->monitor.stack_base, p->monitor.stack_size);
+ size_t free = monitor_checkStack(p->stack_base, p->stack_size);
kprintf("%-24s%-8p%-8p%-8lu%-8lu\n",
- p->monitor.name, p, p->monitor.stack_base, p->monitor.stack_size, free);
+ p->monitor.name, p, p->stack_base, p->stack_size, free);
}
}
p->monitor.link.succ;
p = MONITOR_NODE_TO_PROCESS(p->monitor.link.succ))
{
- size_t free = monitor_checkStack(p->monitor.stack_base, p->monitor.stack_size);
+ size_t free = monitor_checkStack(p->stack_base, p->stack_size);
if (free < 0x20)
kprintf("MONITOR: WARNING: Free stack for process '%s' is only %u chars\n",
proc_init_struct(proc);
proc->user_data = data;
-#if CONFIG_KERN_HEAP
+#if CONFIG_KERN_HEAP | CONFIG_KERN_MONITOR | (ARCH & ARCH_EMUL)
proc->stack_base = stack_base;
proc->stack_size = stack_size;
+ #if CONFIG_KERN_HEAP
if (free_stack)
proc->flags |= PF_FREESTACK;
+ #endif
#endif
/* Initialize process stack frame */
ATOMIC(SCHED_ENQUEUE(proc));
#if CONFIG_KERN_MONITOR
- monitor_add(proc, name, stack_base, stack_size);
+ monitor_add(proc, name);
#endif
return proc;
#if CONFIG_KERN_HEAP
uint16_t flags; /**< Flags */
+#endif
+
+#if CONFIG_KERN_HEAP | CONFIG_KERN_MONITOR | (ARCH & ARCH_EMUL)
cpustack_t *stack_base; /**< Base of process stack */
size_t stack_size; /**< Size of process stack */
#endif
{
Node link;
const char *name;
- cpustack_t *stack_base;
- size_t stack_size;
} monitor;
#endif
void monitor_init(void);
/** Register a process into the monitor */
- void monitor_add(Process *proc, const char *name, cpustack_t *stack, size_t stacksize);
+ void monitor_add(Process *proc, const char *name);
/** Unregister a process from the monitor */
void monitor_remove(Process *proc);
/** Rename a process */
- void monitor_rename(Process *proc, const char* name);
+ void monitor_rename(Process *proc, const char *name);
#endif /* CONFIG_KERN_MONITOR */
#endif /* KERN_PROC_P_H */