[util] Add thread id to kernel spinlocks

Expose a function __current_thread_id() and use it to record the thread
id on a spinlock waiter when called from the kernel.
This commit is contained in:
Justin C. Miller
2023-02-18 15:19:49 -08:00
parent 8817766469
commit 38ca7004a6
3 changed files with 25 additions and 2 deletions

View File

@@ -180,3 +180,10 @@ thread::create_idle_thread(process &kernel, uintptr_t rsp0)
}
} // namespace obj
uint32_t
__current_thread_id()
{
cpu_data &cpu = current_cpu();
return cpu.thread ? cpu.thread->obj_id() : -1u;
}

View File

@@ -207,3 +207,5 @@ private:
};
} // namespace obj
extern "C" uint32_t __current_thread_id();