diff --git a/kernel/src/log/Log.cpp b/kernel/src/log/Log.cpp index e8e9e31f..6faf779b 100644 --- a/kernel/src/log/Log.cpp +++ b/kernel/src/log/Log.cpp @@ -2,6 +2,7 @@ #include "io/Serial.h" #include "std/stdio.h" #include "thread/PIT.h" +#include "thread/Scheduler.h" #include static int level_mask = 15; @@ -22,7 +23,13 @@ static void log_backend_serial(const char* function, LogLevel level, const char* va_list ap; va_copy(ap, origin); Serial::reset_color(); - printf("[%ld.%ld] %s: ", PIT::ms_since_boot / 1000, PIT::ms_since_boot % 1000, function); + if (Scheduler::current_task() && Scheduler::current_task()->id) + { + Task* current_task = Scheduler::current_task(); + printf("[%ld.%ld] (%s %ld) %s: ", PIT::ms_since_boot / 1000, PIT::ms_since_boot % 1000, current_task->name, + current_task->id, function); + } + else { printf("[%ld.%ld] (kernel) %s: ", PIT::ms_since_boot / 1000, PIT::ms_since_boot % 1000, function); } switch (level) { case LogLevel::WARN: Serial::set_color(Color::Yellow); break; diff --git a/kernel/src/thread/Scheduler.cpp b/kernel/src/thread/Scheduler.cpp index b3e8c746..8b86f274 100644 --- a/kernel/src/thread/Scheduler.cpp +++ b/kernel/src/thread/Scheduler.cpp @@ -91,6 +91,8 @@ void Scheduler::init() idle_task.user_task = false; idle_task.state = idle_task.Idle; + strlcpy(idle_task.name, "[cpu-idle]", sizeof(idle_task.name)); + sched_current_task = &idle_task; frequency = 1000 / PIT::frequency();