1 /*****************************************************************************/
4 * \brief Kernel debugger macros
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>,
10 * Björn Döbel <doebel@os.inf.tu-dresden.de>,
11 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
12 * economic rights: Technische Universität Dresden (Germany)
14 * This file is part of TUD:OS and distributed under the terms of the
15 * GNU General Public License 2.
16 * Please see the COPYING-GPL-2 file for details.
18 * As a special exception, you may use this file as part of a free software
19 * library without restriction. Specifically, if other files instantiate
20 * templates or use macros or inline functions from this file, or you compile
21 * this file and link it with other files to produce an executable, this
22 * file does not by itself cause the resulting executable to be covered by
23 * the GNU General Public License. This exception does not however
24 * invalidate any other reasons why the executable file might be covered by
25 * the GNU General Public License.
27 /*****************************************************************************/
28 #ifndef __L4_KDEBUG_H__
29 #define __L4_KDEBUG_H__
31 #include <l4/sys/compiler.h>
34 * Enter L4 kernel debugger
35 * \ingroup l4_debugger_api
38 * \param text Text to be shown at kernel debugger prompt
41 #define enter_kdebug(text) \
45 ".ascii \"" text "\"\n\t"\
49 #define enter_kdebug(text) \
57 * Enter L4 kernel debugger (plain assembler version)
58 * \ingroup l4_debugger_api
61 * \param text Text to be shown at kernel debugger prompt
63 #define asm_enter_kdebug(text) \
66 ".ascii \"" text "\"\n\t"\
70 * Show message with L4 kernel debugger, but do not enter debugger
71 * \ingroup l4_debugger_api
74 * \param text Text to be shown
76 #define kd_display(text) \
81 ".ascii \"" text "\"\n\t"\
86 * Output character with L4 kernel debugger
87 * \ingroup l4_debugger_api
90 * \param c Character to be shown
100 /*****************************************************************************
102 *****************************************************************************/
104 #ifndef __ASSEMBLER__
108 * \ingroup l4_debugger_api
113 outchar(char c) L4_NOTHROW;
116 * Print character string
117 * \ingroup l4_debugger_api
119 * \param text Character string
122 outstring(const char * text) L4_NOTHROW;
125 * Print character string
126 * \ingroup l4_debugger_api
128 * \param text Character string
129 * \param len Number of characters
132 outnstring(char const *text, unsigned len) L4_NOTHROW;
135 * Print 32 bit number (hexadecimal)
136 * \ingroup l4_debugger_api
138 * \param number 32 bit number
141 outhex32(int number) L4_NOTHROW;
144 * Print 20 bit number (hexadecimal)
145 * \ingroup l4_debugger_api
147 * \param number 20 bit number
150 outhex20(int number) L4_NOTHROW;
153 * Print 16 bit number (hexadecimal)
154 * \ingroup l4_debugger_api
156 * \param number 16 bit number
159 outhex16(int number) L4_NOTHROW;
162 * Print 12 bit number (hexadecimal)
163 * \ingroup l4_debugger_api
165 * \param number 12 bit number
168 outhex12(int number) L4_NOTHROW;
171 * Print 8 bit number (hexadecimal)
172 * \ingroup l4_debugger_api
174 * \param number 8 bit number
177 outhex8(int number) L4_NOTHROW;
180 * Print number (decimal)
181 * \ingroup l4_debugger_api
183 * \param number Number
186 outdec(int number) L4_NOTHROW;
189 * Read character from console, non blocking
190 * \ingroup l4_debugger_api
192 * \return Input character, -1 if no character to read
195 l4kd_inchar(void) L4_NOTHROW;
199 * \ingroup api_calls_fiasco
202 fiasco_profile_start(void) L4_NOTHROW;
205 * Stop profiling and dump result to console
206 * \ingroup api_calls_fiasco
209 fiasco_profile_stop_and_dump(void) L4_NOTHROW;
213 * \ingroup api_calls_fiasco
216 fiasco_profile_stop(void) L4_NOTHROW;
219 * Enable Fiasco watchdog
220 * \ingroup api_calls_fiasco
223 fiasco_watchdog_enable(void) L4_NOTHROW;
226 * Disable Fiasco watchdog
227 * \ingroup api_calls_fiasco
230 fiasco_watchdog_disable(void) L4_NOTHROW;
233 * Disable automatic resetting of watchdog. User is responsible to call
234 * \c fiasco_watchdog_touch from time to time to ensure that the watchdog
236 * \ingroup api_calls_fiasco
239 fiasco_watchdog_takeover(void) L4_NOTHROW;
242 * Reenable automatic resetting of watchdog.
243 * \ingroup api_calls_fiasco
246 fiasco_watchdog_giveback(void) L4_NOTHROW;
249 * Reset watchdog from user land. This function \b must be called from time
250 * to time to prevent the watchdog from triggering if the watchdog is
251 * activated and if \c fiasco_watchdog_takeover was performed.
252 * \ingroup api_calls_fiasco
255 fiasco_watchdog_touch(void) L4_NOTHROW;
258 /*****************************************************************************
260 *****************************************************************************/
263 outchar(char c) L4_NOTHROW
273 /* actually outstring is outcstring */
275 outstring(const char *text) L4_NOTHROW
286 /* actually outstring is outcstring */
288 outnstring(char const *text, unsigned len) L4_NOTHROW
292 "mov %%rcx, %%rbx \n\t"
297 : "a" (text), "c"(len)
303 outhex32(int number) L4_NOTHROW
314 outhex20(int number) L4_NOTHROW
325 outhex16(int number) L4_NOTHROW
336 outhex12(int number) L4_NOTHROW
347 outhex8(int number) L4_NOTHROW
358 outdec(int number) L4_NOTHROW
369 l4kd_inchar(void) L4_NOTHROW
372 asm volatile ("int $3; cmpb $13, %%al" : "=a" (c));
377 fiasco_profile_start(void) L4_NOTHROW
379 asm("int $3; cmpb $24, %al");
383 fiasco_profile_stop_and_dump(void) L4_NOTHROW
385 asm("int $3; cmpb $25, %al");
389 fiasco_profile_stop(void) L4_NOTHROW
391 asm("int $3; cmpb $26, %al");
395 fiasco_watchdog_enable(void) L4_NOTHROW
397 asm("int $3; cmpb $31, %%al" : : "c" (1));
401 fiasco_watchdog_disable(void) L4_NOTHROW
403 asm("int $3; cmpb $31, %%al" : : "c" (2));
407 fiasco_watchdog_takeover(void) L4_NOTHROW
409 asm("int $3; cmpb $31, %%al" : : "c" (3));
413 fiasco_watchdog_giveback(void) L4_NOTHROW
415 asm("int $3; cmpb $31, %%al" : : "c" (4));
419 fiasco_watchdog_touch(void) L4_NOTHROW
421 asm("int $3; cmpb $31, %%al" : : "c" (5));
424 #endif /* __ASSEMBLER__ */
426 #endif /* __L4_KDEBUG_H__ */