summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-02-28 17:07:46 +0200
committerAndreas Kling <kling@serenityos.org>2020-03-02 22:23:39 +0100
commitdc01a71fac2cb6b596b864d9c135a163b3df7847 (patch)
tree396b73345e515c26f4884298affc2e5421061269
parent214f934465ff0f74e79aab2addc1e4b15fb3f533 (diff)
downloadserenity-dc01a71fac2cb6b596b864d9c135a163b3df7847.zip
LibBareMetal: Add support for kernel log stream
-rw-r--r--Libraries/LibBareMetal/Output/kprintf.cpp14
-rw-r--r--Libraries/LibBareMetal/Output/kstdio.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/Libraries/LibBareMetal/Output/kprintf.cpp b/Libraries/LibBareMetal/Output/kprintf.cpp
index e1a6f9ae3b..f064b49fd0 100644
--- a/Libraries/LibBareMetal/Output/kprintf.cpp
+++ b/Libraries/LibBareMetal/Output/kprintf.cpp
@@ -96,7 +96,7 @@ static void serial_putch(char ch)
was_cr = false;
}
-static void console_putch(char*&, char ch)
+static void console_out(char ch)
{
if (serial_debug)
serial_putch(ch);
@@ -110,6 +110,11 @@ static void console_putch(char*&, char ch)
}
}
+static void console_putch(char*&, char ch)
+{
+ console_out(ch);
+}
+
int kprintf(const char* fmt, ...)
{
color_on();
@@ -155,6 +160,13 @@ extern "C" int dbgputstr(const char* characters, int length)
return 0;
}
+extern "C" int kernelputstr(const char* characters, int length)
+{
+ for (int i = 0; i < length; ++i)
+ console_out(characters[i]);
+ return 0;
+}
+
extern "C" int dbgprintf(const char* fmt, ...)
{
color_on();
diff --git a/Libraries/LibBareMetal/Output/kstdio.h b/Libraries/LibBareMetal/Output/kstdio.h
index e5e0b2c1ae..2aa8355029 100644
--- a/Libraries/LibBareMetal/Output/kstdio.h
+++ b/Libraries/LibBareMetal/Output/kstdio.h
@@ -31,6 +31,7 @@
extern "C" {
int dbgprintf(const char* fmt, ...);
int dbgputstr(const char*, int);
+int kernelputstr(const char*, int);
int kprintf(const char* fmt, ...);
int sprintf(char* buf, const char* fmt, ...);
void set_serial_debug(bool on_or_off);