Subversion Repositories Kolibri OS

Rev

Rev 6535 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6391 ashmew2 1
#ifndef KOLIBRI_DEBUG_H
2
#define KOLIBRI_DEBUG_H
3
 
6398 punk_joker 4
#include <_ansi.h>
5
#include 
6
#include 
7
#include 
8
 
6395 siemargl 9
/* Write a printf() like function (variable argument list) for
6391 ashmew2 10
   writing to debug board */
11
 
6612 siemargl 12
static inline void debug_board_write_byte(const char ch){
6391 ashmew2 13
    __asm__ __volatile__(
14
    "int $0x40"
15
    :
16
    :"a"(63), "b"(1), "c"(ch));
17
}
6395 siemargl 18
 
19
//added noninline because incofortabre stepping in in debugger
20
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
6391 ashmew2 21
  while(*str)
22
    debug_board_write_byte(*str++);
23
}
24
 
6612 siemargl 25
static inline void debug_board_printf(const char *format,...)
6398 punk_joker 26
{
27
	va_list ap;
28
	char log_board[300];
6535 siemargl 29
 
6398 punk_joker 30
	va_start (ap, format);
31
	vsprintf(log_board, format, ap);
32
	va_end(ap);
33
	debug_board_write_str(log_board);
34
}
6612 siemargl 35
 
36
__attribute__ ((noinline)) void trap(int n)
37
{
38
    // nothing todo, just see n in debugger. use "bp trap" command
39
    __asm__ __volatile__(
40
    "nop"
41
    :
42
    :"a"(n));
43
}
6391 ashmew2 44
 
45
#endif /* KOLIBRI_DEBUG_H */