summaryrefslogtreecommitdiff
path: root/AK/Format.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-09-10 21:46:54 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-09-10 22:58:08 +0300
commit6348b63476b8534f2a6e443fe701641463adb4df (patch)
tree09e9637ac6a518e8aaf3d7a8e032f50d1cc417b1 /AK/Format.cpp
parent18d2a74e625ee00ddc506d493498160d15a886c3 (diff)
downloadserenity-6348b63476b8534f2a6e443fe701641463adb4df.zip
Kernel: Add kernelearlyputstr and use it in dbgln in very-early boot
This variant of dbgputstr does not lock the global log lock, as it is called before the current or any other processor was initialized, meaning that: A) The $gs base was not setup yet, so we cannot enter into critical sections, and as a result we cannot use SpinLocks B) No other processors may try to print at the same time anyway
Diffstat (limited to 'AK/Format.cpp')
-rw-r--r--AK/Format.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/Format.cpp b/AK/Format.cpp
index 36b2809e82..8e691a5e36 100644
--- a/AK/Format.cpp
+++ b/AK/Format.cpp
@@ -817,6 +817,14 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
const auto string = builder.string_view();
+#ifdef __serenity__
+# ifdef KERNEL
+ if (!Kernel::Processor::is_initialized()) {
+ kernelearlyputstr(string.characters_without_null_termination(), string.length());
+ return;
+ }
+# endif
+#endif
dbgputstr(string.characters_without_null_termination(), string.length());
}