1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

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
This commit is contained in:
Idan Horowitz 2021-09-10 21:46:54 +03:00
parent 18d2a74e62
commit 6348b63476
Notes: sideshowbarker 2024-07-18 04:19:44 +09:00
3 changed files with 20 additions and 0 deletions

View file

@ -188,3 +188,14 @@ extern "C" void kernelcriticalputstr(const char* characters, size_t length)
for (size_t i = 0; i < length; ++i)
critical_console_out(characters[i]);
}
extern "C" void kernelearlyputstr(const char* characters, size_t length)
{
if (!characters)
return;
// NOTE: We do not lock the log lock here, as this function is called before this or any other processor was initialized, meaning:
// 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
for (size_t i = 0; i < length; ++i)
internal_dbgputch(characters[i]);
}