00001
00007
00008 #ifndef __L4_KDEBUG_H__
00009 #define __L4_KDEBUG_H__
00010
00011 #include <l4/sys/compiler.h>
00012
00020 #define enter_kdebug(text) \
00021 asm(\
00022 "int $3 \n\t"\
00023 "jmp 1f \n\t"\
00024 ".ascii \""text "\"\n\t"\
00025 "1: \n\t"\
00026 )
00027
00035 #define asm_enter_kdebug(text) \
00036 "int $3 \n\t"\
00037 "jmp 1f \n\t"\
00038 ".ascii \""text "\"\n\t"\
00039 "1: \n\t"
00040
00048 #define kd_display(text) \
00049 asm(\
00050 "int $3 \n\t"\
00051 "nop \n\t"\
00052 "jmp 1f \n\t"\
00053 ".ascii \""text "\"\n\t"\
00054 "1: \n\t"\
00055 )
00056
00064 #define ko(c) \
00065 asm( \
00066 "int $3 \n\t" \
00067 "cmpb %0,%%al \n\t" \
00068 : \
00069 : "N" (c) \
00070 )
00071
00072
00073
00074
00075
00082 L4_INLINE void
00083 outchar(char c);
00084
00091 L4_INLINE void
00092 outstring(const char * text);
00093
00101 L4_INLINE void
00102 outnstring(char const *text, unsigned len);
00103
00110 L4_INLINE void
00111 outhex32(int number);
00112
00119 L4_INLINE void
00120 outhex20(int number);
00121
00128 L4_INLINE void
00129 outhex16(int number);
00130
00137 L4_INLINE void
00138 outhex12(int number);
00139
00146 L4_INLINE void
00147 outhex8(int number);
00148
00155 L4_INLINE void
00156 outdec(int number);
00157
00164 L4_INLINE char
00165 l4kd_inchar(void);
00166
00171 L4_INLINE void
00172 fiasco_profile_start(void);
00173
00178 L4_INLINE void
00179 fiasco_profile_stop_and_dump(void);
00180
00185 L4_INLINE void
00186 fiasco_profile_stop(void);
00187
00192 L4_INLINE void
00193 fiasco_watchdog_enable(void);
00194
00199 L4_INLINE void
00200 fiasco_watchdog_disable(void);
00201
00208 L4_INLINE void
00209 fiasco_watchdog_takeover(void);
00210
00215 L4_INLINE void
00216 fiasco_watchdog_giveback(void);
00217
00224 L4_INLINE void
00225 fiasco_watchdog_touch(void);
00226
00227
00228
00229
00230
00231
00232 L4_INLINE void
00233 outchar(char c)
00234 {
00235 asm(
00236 "int $3 \n\t"
00237 "cmpb $0,%%al \n\t"
00238 :
00239 : "a" (c)
00240 );
00241 }
00242
00243
00244 L4_INLINE void
00245 outstring(const char *text)
00246 {
00247 asm volatile (
00248 "int $3 \n\t"
00249 "cmpb $2,%%al \n\t"
00250 :
00251 : "a" (text)
00252 : "memory"
00253 );
00254 }
00255
00256
00257 L4_INLINE void
00258 outnstring(char const *text, unsigned len)
00259 {
00260 asm volatile (
00261 "pushl %%ebx \n\t"
00262 "movl %%ecx, %%ebx \n\t"
00263 "int $3 \n\t"
00264 "cmpb $1,%%al \n\t"
00265 "popl %%ebx \n\t"
00266 :
00267 : "a" (text), "c"(len)
00268 : "memory"
00269 );
00270 }
00271
00272 L4_INLINE void
00273 outhex32(int number)
00274 {
00275 asm(
00276 "int $3 \n\t"
00277 "cmpb $5,%%al \n\t"
00278 :
00279 : "a" (number)
00280 );
00281 }
00282
00283 L4_INLINE void
00284 outhex20(int number)
00285 {
00286 asm(
00287 "int $3 \n\t"
00288 "cmpb $6,%%al \n\t"
00289 :
00290 : "a" (number)
00291 );
00292 }
00293
00294 L4_INLINE void
00295 outhex16(int number)
00296 {
00297 asm(
00298 "int $3 \n\t"
00299 "cmpb $7, %%al\n\t"
00300 :
00301 : "a" (number)
00302 );
00303 }
00304
00305 L4_INLINE void
00306 outhex12(int number)
00307 {
00308 asm(
00309 "int $3 \n\t"
00310 "cmpb $8, %%al\n\t"
00311 :
00312 : "a" (number)
00313 );
00314 }
00315
00316 L4_INLINE void
00317 outhex8(int number)
00318 {
00319 asm(
00320 "int $3 \n\t"
00321 "cmpb $9, %%al\n\t"
00322 :
00323 : "a" (number)
00324 );
00325 }
00326
00327 L4_INLINE void
00328 outdec(int number)
00329 {
00330 asm(
00331 "int $3 \n\t"
00332 "cmpb $11, %%al\n\t"
00333 :
00334 : "a" (number)
00335 );
00336 }
00337
00338 L4_INLINE char
00339 l4kd_inchar(void)
00340 {
00341 char c;
00342 asm volatile ("int $3; cmpb $13, %%al" : "=a" (c));
00343 return c;
00344 }
00345
00346 L4_INLINE void
00347 fiasco_profile_start(void)
00348 {
00349 asm("int $3; cmpb $24, %al");
00350 }
00351
00352 L4_INLINE void
00353 fiasco_profile_stop_and_dump(void)
00354 {
00355 asm("int $3; cmpb $25, %al");
00356 }
00357
00358 L4_INLINE void
00359 fiasco_profile_stop(void)
00360 {
00361 asm("int $3; cmpb $26, %al");
00362 }
00363
00364 L4_INLINE void
00365 fiasco_watchdog_enable(void)
00366 {
00367 asm("int $3; cmpb $31, %%al" : : "c" (1));
00368 }
00369
00370 L4_INLINE void
00371 fiasco_watchdog_disable(void)
00372 {
00373 asm("int $3; cmpb $31, %%al" : : "c" (2));
00374 }
00375
00376 L4_INLINE void
00377 fiasco_watchdog_takeover(void)
00378 {
00379 asm("int $3; cmpb $31, %%al" : : "c" (3));
00380 }
00381
00382 L4_INLINE void
00383 fiasco_watchdog_giveback(void)
00384 {
00385 asm("int $3; cmpb $31, %%al" : : "c" (4));
00386 }
00387
00388 L4_INLINE void
00389 fiasco_watchdog_touch(void)
00390 {
00391 asm("int $3; cmpb $31, %%al" : : "c" (5));
00392 }
00393
00394 #endif