According to ARM documentation, the thread ID registers like TPIDR_EL0 or TPIDR_EL1,
Provide locations to store the IDs of software threads and processes for OS management purposes. These registers have no effect on processor behavior.
Why would someone want to store the thread ID in a special register? Do ARM processors require threads to have special structures in memory just like the MMU has? Is a Thread something special to ARM, something ARM expect to find somewhere? Or can I implement threads (efficiently) without using this register at all?
I'm asking because I found this code on the Zircon Kernel from Fuchsia OS:
static inline void arch_set_current_thread(Thread* t) {
__arm_wsr64("tpidr_el1", (uint64_t)&t->arch_.thread_pointer_location);
__isb(ARM_MB_SY);
}
Right at boot it creates a thread and stores its pointer in tpidr_el1