1 /*****************************************************************************/
4 * \brief Kernel debugger macros
8 * (c) 2008-2009 Technische Universität Dresden
9 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU General Public License 2.
11 * Please see the COPYING-GPL-2 file for details.
13 * As a special exception, you may use this file as part of a free software
14 * library without restriction. Specifically, if other files instantiate
15 * templates or use macros or inline functions from this file, or you compile
16 * this file and link it with other files to produce an executable, this
17 * file does not by itself cause the resulting executable to be covered by
18 * the GNU General Public License. This exception does not however
19 * invalidate any other reasons why the executable file might be covered by
20 * the GNU General Public License.
22 /*****************************************************************************/
23 #ifndef __L4_KDEBUG_H__
24 #define __L4_KDEBUG_H__
26 #include <l4/sys/compiler.h>
29 * Enter L4 kernel debugger
30 * \ingroup l4_debugger_api
33 * \param text Text to be shown at kernel debugger prompt
36 #define enter_kdebug(text) \
40 ".ascii \""text "\"\n\t"\
44 #define enter_kdebug(text) \
52 * Enter L4 kernel debugger (plain assembler version)
53 * \ingroup l4_debugger_api
56 * \param text Text to be shown at kernel debugger prompt
58 #define asm_enter_kdebug(text) \
61 ".ascii \""text "\"\n\t"\
65 * Show message with L4 kernel debugger, but do not enter debugger
66 * \ingroup l4_debugger_api
69 * \param text Text to be shown
71 #define kd_display(text) \
76 ".ascii \""text "\"\n\t"\
81 * Output character with L4 kernel debugger
82 * \ingroup l4_debugger_api
85 * \param c Character to be shown
95 /*****************************************************************************
97 *****************************************************************************/
103 * \ingroup l4_debugger_api
108 outchar(char c) L4_NOTHROW;
111 * Print character string
112 * \ingroup l4_debugger_api
117 outstring(const char * text) L4_NOTHROW;
120 * Print character string
121 * \ingroup l4_debugger_api
124 * \param len Number of characters
127 outnstring(char const *text, unsigned len) L4_NOTHROW;
130 * Print 32 bit number (hexadecimal)
131 * \ingroup l4_debugger_api
133 * \param number 32 bit number
136 outhex32(int number) L4_NOTHROW;
139 * Print 20 bit number (hexadecimal)
140 * \ingroup l4_debugger_api
142 * \param number 20 bit number
145 outhex20(int number) L4_NOTHROW;
148 * Print 16 bit number (hexadecimal)
149 * \ingroup l4_debugger_api
151 * \param number 16 bit number
154 outhex16(int number) L4_NOTHROW;
157 * Print 12 bit number (hexadecimal)
158 * \ingroup l4_debugger_api
160 * \param number 12 bit number
163 outhex12(int number) L4_NOTHROW;
166 * Print 8 bit number (hexadecimal)
167 * \ingroup l4_debugger_api
169 * \param number 8 bit number
172 outhex8(int number) L4_NOTHROW;
175 * Print number (decimal)
176 * \ingroup l4_debugger_api
178 * \param number Number
181 outdec(int number) L4_NOTHROW;
184 * Read character from console, non blocking
185 * \ingroup l4_debugger_api
187 * \return Input character, -1 if no character to read
190 l4kd_inchar(void) L4_NOTHROW;
194 * \ingroup api_calls_fiasco
197 fiasco_profile_start(void) L4_NOTHROW;
200 * Stop profiling and dump result to console
201 * \ingroup api_calls_fiasco
204 fiasco_profile_stop_and_dump(void) L4_NOTHROW;
208 * \ingroup api_calls_fiasco
211 fiasco_profile_stop(void) L4_NOTHROW;
214 * Enable Fiasco watchdog
215 * \ingroup api_calls_fiasco
218 fiasco_watchdog_enable(void) L4_NOTHROW;
221 * Disable Fiasco watchdog
222 * \ingroup api_calls_fiasco
225 fiasco_watchdog_disable(void) L4_NOTHROW;
228 * Disable automatic resetting of watchdog. User is responsible to call
229 * \c fiasco_watchdog_touch from time to time to ensure that the watchdog
231 * \ingroup api_calls_fiasco
234 fiasco_watchdog_takeover(void) L4_NOTHROW;
237 * Reenable automatic resetting of watchdog.
238 * \ingroup api_calls_fiasco
241 fiasco_watchdog_giveback(void) L4_NOTHROW;
244 * Reset watchdog from user land. This function \b must be called from time
245 * to time to prevent the watchdog from triggering if the watchdog is
246 * activated and if \c fiasco_watchdog_takeover was performed.
247 * \ingroup api_calls_fiasco
250 fiasco_watchdog_touch(void) L4_NOTHROW;
253 /*****************************************************************************
255 *****************************************************************************/
258 outchar(char c) L4_NOTHROW
268 /* actually outstring is outcstring */
270 outstring(const char *text) L4_NOTHROW
281 /* actually outstring is outcstring */
283 outnstring(char const *text, unsigned len) L4_NOTHROW
287 "movl %%ecx, %%ebx \n\t"
292 : "a" (text), "c"(len)
298 outhex32(int number) L4_NOTHROW
309 outhex20(int number) L4_NOTHROW
320 outhex16(int number) L4_NOTHROW
331 outhex12(int number) L4_NOTHROW
342 outhex8(int number) L4_NOTHROW
353 outdec(int number) L4_NOTHROW
364 l4kd_inchar(void) L4_NOTHROW
367 asm volatile ("int $3; cmpb $13, %%al" : "=a" (c));
372 fiasco_profile_start(void) L4_NOTHROW
374 asm("int $3; cmpb $24, %al");
378 fiasco_profile_stop_and_dump(void) L4_NOTHROW
380 asm("int $3; cmpb $25, %al");
384 fiasco_profile_stop(void) L4_NOTHROW
386 asm("int $3; cmpb $26, %al");
390 fiasco_watchdog_enable(void) L4_NOTHROW
392 asm("int $3; cmpb $31, %%al" : : "c" (1));
396 fiasco_watchdog_disable(void) L4_NOTHROW
398 asm("int $3; cmpb $31, %%al" : : "c" (2));
402 fiasco_watchdog_takeover(void) L4_NOTHROW
404 asm("int $3; cmpb $31, %%al" : : "c" (3));
408 fiasco_watchdog_giveback(void) L4_NOTHROW
410 asm("int $3; cmpb $31, %%al" : : "c" (4));
414 fiasco_watchdog_touch(void) L4_NOTHROW
416 asm("int $3; cmpb $31, %%al" : : "c" (5));
419 #endif /* __ASSEMBLER__ */
421 #endif /* __L4_KDEBUG_H__ */