[tools] Add j6threads gdb command

The j6threads command shows the current thread, ready threads, and
blocked threads for a given CPU.

To support this, TCB structs gained a pointer to their thread (instead
of trying to do offset magic) and threads gained a pointer to their
creator. Also removed thread::from_tcb() now that the TCB has a pointer.
This commit is contained in:
Justin C. Miller
2022-01-15 17:39:25 -08:00
parent 7bb6b21c65
commit 2dd78beb92
5 changed files with 115 additions and 46 deletions

View File

@@ -9,7 +9,9 @@
#include "idt.h"
#include "log.h"
#include "msr.h"
#include "objects/thread.h"
#include "objects/vm_area.h"
#include "scheduler.h"
#include "syscall.h"
#include "tss.h"
@@ -60,10 +62,6 @@ cpu_early_init(cpu_data *cpu)
// Install the GS base pointint to the cpu_data
wrmsr(msr::ia32_gs_base, reinterpret_cast<uintptr_t>(cpu));
// Set the initial process as the kernel "process"
extern process &g_kernel_process;
cpu->process = &g_kernel_process;
}
void
@@ -74,6 +72,18 @@ cpu_init(cpu_data *cpu, bool bsp)
cpu_early_init(cpu);
}
// Set the initial process as the kernel "process"
extern process &g_kernel_process;
cpu->process = &g_kernel_process;
thread *idle = thread::create_idle_thread(
g_kernel_process,
scheduler::max_priority,
cpu->rsp0);
cpu->thread = idle;
cpu->tcb = idle->tcb();
// Set up the syscall MSRs
syscall_enable();