summaryrefslogtreecommitdiff
path: root/frontends/kolibrios/kolibri_debug.c
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-04-05 21:39:01 +0200
committerAshish Gupta <ashmew2@gmail.com>2017-06-10 08:24:39 +0200
commit6fd280bb5b27842a0ef2977798566c37bd4e1d0e (patch)
tree8e5dd8aa1adf8c6550b955d130c81c36b3db9ea5 /frontends/kolibrios/kolibri_debug.c
parent9bf5ecfa87d022645e986249270c5a89e27f46fe (diff)
downloadnetsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.gz
netsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.bz2
Add kolibrios/ dir : Step 1 towards porting this to Kolibri OS
Diffstat (limited to 'frontends/kolibrios/kolibri_debug.c')
-rw-r--r--frontends/kolibrios/kolibri_debug.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/frontends/kolibrios/kolibri_debug.c b/frontends/kolibrios/kolibri_debug.c
new file mode 100644
index 000000000..5e97d40e0
--- /dev/null
+++ b/frontends/kolibrios/kolibri_debug.c
@@ -0,0 +1,28 @@
+#include "kolibrios/kolibri_debug.h"
+#include <stdarg.h>
+
+/* Write a printf() like function (variable argument list) for
+ writing to debug board TODO*/
+
+void debug_board_write_byte(const char ch){
+ __asm__ __volatile__(
+ "int $0x40"
+ :
+ :"a"(63), "b"(1), "c"(ch));
+}
+
+void debug_board_write_str(const char* str){
+ while(*str)
+ debug_board_write_byte(*str++);
+}
+
+void debug_board_printf(const char *format,...)
+{
+ va_list ap;
+ char log_board[300];
+
+ va_start (ap, format);
+ vsprintf(log_board, format, ap);
+ va_end(ap);
+ debug_board_write_str(log_board);
+}