Browse Source

Kernel: Remove debug printing of code segment

This allows us to use the same code for aarch64.
Timon Kruiper 2 years ago
parent
commit
5b06925b8a
2 changed files with 7 additions and 22 deletions
  1. 6 21
      Kernel/Scheduler.cpp
  2. 1 1
      Kernel/Thread.cpp

+ 6 - 21
Kernel/Scheduler.cpp

@@ -222,10 +222,10 @@ void Scheduler::pick_next()
 
     auto& thread_to_schedule = pull_next_runnable_thread();
     if constexpr (SCHEDULER_DEBUG) {
-        dbgln("Scheduler[{}]: Switch to {} @ {:#04x}:{:p}",
+        dbgln("Scheduler[{}]: Switch to {} @ {:p}",
             Processor::current_id(),
             thread_to_schedule,
-            thread_to_schedule.regs().cs, thread_to_schedule.regs().ip());
+            thread_to_schedule.regs().ip());
     }
 
     // We need to leave our first critical section before switching context,
@@ -270,11 +270,11 @@ void Scheduler::context_switch(Thread* thread)
         from_thread->set_state(Thread::State::Runnable);
 
 #ifdef LOG_EVERY_CONTEXT_SWITCH
-    auto const msg = "Scheduler[{}]: {} -> {} [prio={}] {:#04x}:{:p}";
+    auto const msg = "Scheduler[{}]: {} -> {} [prio={}] {:p}";
 
     dbgln(msg,
         Processor::current_id(), from_thread->tid().value(),
-        thread->tid().value(), thread->priority(), thread->regs().cs, thread->regs().ip());
+        thread->tid().value(), thread->priority(), thread->regs().ip());
 #endif
 
     auto& proc = Processor::current();
@@ -507,19 +507,6 @@ void dump_thread_list(bool with_stack_traces)
 {
     dbgln("Scheduler thread list for processor {}:", Processor::current_id());
 
-    auto get_cs = [](Thread& thread) -> u16 {
-#if ARCH(X86_64)
-        if (!thread.current_trap())
-            return thread.regs().cs;
-        return thread.get_register_dump_from_stack().cs;
-#elif ARCH(AARCH64)
-        (void)thread;
-        return 0;
-#else
-#    error Unknown architecture
-#endif
-    };
-
     auto get_eip = [](Thread& thread) -> u32 {
         if (!thread.current_trap())
             return thread.regs().ip();
@@ -530,20 +517,18 @@ void dump_thread_list(bool with_stack_traces)
         auto color = thread.process().is_kernel_process() ? "\x1b[34;1m"sv : "\x1b[33;1m"sv;
         switch (thread.state()) {
         case Thread::State::Dying:
-            dmesgln("  {}{:30}\x1b[0m @ {:04x}:{:08x} is {:14} (Finalizable: {}, nsched: {})",
+            dmesgln("  {}{:30}\x1b[0m @ {:08x} is {:14} (Finalizable: {}, nsched: {})",
                 color,
                 thread,
-                get_cs(thread),
                 get_eip(thread),
                 thread.state_string(),
                 thread.is_finalizable(),
                 thread.times_scheduled());
             break;
         default:
-            dmesgln("  {}{:30}\x1b[0m @ {:04x}:{:08x} is {:14} (Pr:{:2}, nsched: {})",
+            dmesgln("  {}{:30}\x1b[0m @ {:08x} is {:14} (Pr:{:2}, nsched: {})",
                 color,
                 thread,
-                get_cs(thread),
                 get_eip(thread),
                 thread.state_string(),
                 thread.priority(),

+ 1 - 1
Kernel/Thread.cpp

@@ -1212,7 +1212,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
     regs.set_flags(2 | (regs.rflags & ~safe_eflags_mask));
 #endif
 
-    dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:#04x}:{:p} to deliver {}", state_string(), m_regs.cs, m_regs.ip(), signal);
+    dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:p} to deliver {}", state_string(), m_regs.ip(), signal);
 
     return DispatchSignalResult::Continue;
 }