BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / 57c37224fcb74856e64ac9e2421bff651e95e84a

// Related

Nucleus

Barry debug printf system call 57c3722 (3 years, 2 months ago)
diff --git a/include/nucleus/panic.h b/include/nucleus/panic.h
index 27eea94..e51df78 100644
--- a/include/nucleus/panic.h
+++ b/include/nucleus/panic.h
@@ -3,6 +3,7 @@
 
 int sprintf(char *buf, char *fmt, ...);
 void kprintf(char *fmt, ...);
+void dbgprintf(char *msg);
 _Noreturn void panic(char *fmt, ...);
 
 #define ASSERT(c) ({ \
diff --git a/lib/printf.c b/lib/printf.c
index de1a729..006ef40 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -7,7 +7,9 @@
 
 #include <stdint.h>
 #include <stdarg.h>
+#include <string.h>
 #include <io.h>
+#include <nucleus/task.h>
 
 #define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
 
@@ -280,6 +282,19 @@ kprintf(char *fmt, ...)
 	outb(0xE9, '\n');
 }
 
+/* Debug print */
+void
+dbgprintf(char *msg)
+{
+	size_t len = 1024;
+	if (!msg || !verify_access(msg, strnlen(msg, len), PROT_READ))
+		return;
+
+	/* Print to debug port */
+	kprintf("\033[93;01m(%d:%d): \033[0m%s",
+	        current->tgid, current->tid, msg);
+}
+
 /* Kernel panic */
 _Noreturn void
 panic(char *fmt, ...)