4 * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See README.devlib for information.
8 * \brief Monitor to check for stack overflows
12 * \author Giovanni Bajo <rasky@develer.com>
17 *#* Revision 1.3 2005/11/04 16:20:02 bernie
18 *#* Fix reference to README.devlib in header.
20 *#* Revision 1.2 2005/04/11 19:10:28 bernie
21 *#* Include top-level headers from cfg/ subdir.
23 *#* Revision 1.1 2004/10/03 20:39:03 bernie
26 *#* Revision 1.1 2004/09/30 23:19:30 rasky
27 *#* Estratto il monitor degli stack da proc.c in due file a parte: monitor.c/h
28 *#* Rinominata monitor_debug_stacks in monitor_report
32 #ifndef KERN_MONITOR_H
33 #define KERN_MONITOR_H
36 #include <cfg/config_kern.h>
38 #if CONFIG_KERN_MONITOR
41 * Start the kernel monitor. It is a special process which checks every second the stacks of the
42 * running processes trying to detect stack overflows.
44 * \param stacksize Size of stack in chars
45 * \param stack Pointer to the stack that will be used by the monitor
47 * \note The stack is provided by the caller so that there is no wasted space if the monitor
50 void monitor_start(size_t stacksize, cpustack_t *stack);
54 * Manually check if a given stack has overflown. This is used to check for stacks
55 * of processes handled externally form the kernel, or for other stacks (for instance
56 * the interrupt supervisor stack).
58 * \note For this function to work, the stack must have been filled at startup with
59 * CONFIG_KERN_STACKFILLCODE.
61 size_t monitor_check_stack(cpustack_t* stack_base, size_t stack_size);
64 /*! Print a report of the stack status through kdebug */
65 void monitor_report(void);
68 #endif /* CONFIG_KERN_MONITOR */
69 #endif /* KERN_MONITOR_H */