feat: PCI bus probing
[lunaix-os.git] / lunaix-os / kernel / kprintf.c
index 374fff2993c8f6ef35376883f0a3e5265db18b3d..af47a8abae297a857d19405b775c75215fb0febd 100644 (file)
@@ -3,14 +3,13 @@
 #include <lunaix/syslog.h>
 #include <lunaix/tty/tty.h>
 
-#define MAX_KPRINTF_BUF_SIZE 1024
-#define MAX_XFMT_SIZE 1024
-
-static char buf[MAX_KPRINTF_BUF_SIZE];
+#define MAX_KPRINTF_BUF_SIZE 512
+#define MAX_XFMT_SIZE 512
 
 void
 __kprintf(const char* component, const char* fmt, va_list args)
 {
+    char buf[MAX_KPRINTF_BUF_SIZE];
     if (!fmt)
         return;
     char log_level = '0';
@@ -34,7 +33,7 @@ __kprintf(const char* component, const char* fmt, va_list args)
             // tty_set_theme(VGA_COLOR_BROWN, current_theme >> 12);
             snprintf(expanded_fmt,
                      MAX_XFMT_SIZE,
-                     "\x033[6;0m[%s] (%s) %s\x033[39;49m",
+                     "\033[6;0m[%s] (%s) %s\033[39;49m",
                      "WARN",
                      component,
                      fmt);
@@ -43,7 +42,7 @@ __kprintf(const char* component, const char* fmt, va_list args)
             // tty_set_theme(VGA_COLOR_LIGHT_RED, current_theme >> 12);
             snprintf(expanded_fmt,
                      MAX_XFMT_SIZE,
-                     "\x033[12;0m[%s] (%s) %s\x033[39;49m",
+                     "\033[12;0m[%s] (%s) %s\033[39;49m",
                      "EROR",
                      component,
                      fmt);
@@ -52,7 +51,7 @@ __kprintf(const char* component, const char* fmt, va_list args)
             // tty_set_theme(VGA_COLOR_LIGHT_BLUE, current_theme >> 12);
             snprintf(expanded_fmt,
                      MAX_XFMT_SIZE,
-                     "\x033[9;0m[%s] (%s) %s\x033[39;49m",
+                     "\033[9;0m[%s] (%s) %s\033[39;49m",
                      "DEBG",
                      component,
                      fmt);
@@ -74,16 +73,15 @@ __kprintf(const char* component, const char* fmt, va_list args)
 void
 kprint_panic(const char* fmt, ...)
 {
+    char buf[MAX_KPRINTF_BUF_SIZE];
     va_list args;
     va_start(args, fmt);
 
     tty_set_theme(VGA_COLOR_WHITE, VGA_COLOR_RED);
-    tty_clear_line(10);
-    tty_clear_line(11);
-    tty_clear_line(12);
+    tty_clear_line(24);
 
     __sprintf_internal(buf, fmt, MAX_KPRINTF_BUF_SIZE, args);
-    tty_put_str_at(buf, 0, 11);
+    tty_put_str_at(buf, 0, 24);
 
     va_end(args);
 }
\ No newline at end of file