[kernel] Make scheduler run queue's prev be an id, not a pointer

This would lead to errors in GDB's j6threads when the previous thread
had already exited.
This commit is contained in:
Justin C. Miller
2023-03-16 19:37:49 -07:00
parent 9fa588566f
commit 201e7191ef
2 changed files with 9 additions and 8 deletions

View File

@@ -237,11 +237,7 @@ class GetThreadsCommand(gdb.Command):
self.print_cpudata(cpu)
previous = int(gdb.parse_and_eval(f"{runlist}.prev"))
if previous != 0:
tcb = f"((TCB*){previous:#x})"
thread = f"({tcb}->thread)"
koid = int(gdb.parse_and_eval(f"{thread}->m_obj_id"))
print(f" prev: {koid:x}")
print(f" prev: {previous:x}")
print()
for pri in range(8):
@@ -332,8 +328,13 @@ class DumpLogCommand(gdb.Command):
end += self.base_addr
while addr < end:
entry = self.get_entry(addr)
if entry.bytes < 8:
print(f"Bad log header size: {entry.bytes}")
break
addr += entry.bytes
area = self.areas[entry.area]
area = "??"
if entry.area < len(self.areas):
area = self.areas[entry.area]
level = self.level_names[entry.severity]
print(f"{area:>7}:{level:7} {entry.message}")

View File

@@ -28,7 +28,7 @@ scheduler *scheduler::s_instance = nullptr;
struct run_queue
{
tcb_node *current = nullptr;
tcb_node *prev = nullptr;
uint64_t prev = 0;
tcb_list ready[scheduler::num_priorities];
tcb_list blocked;
@@ -310,7 +310,7 @@ scheduler::schedule()
return;
}
queue.prev = queue.current;
queue.prev = queue.current->thread->obj_id();
thread *next_thread = next->thread;
cpu.thread = next_thread;