operating systems – How is switching between user-level threads performed in user space?

This is for user-level threads where the kernel only knows the process as a whole, and threads are created and maintained in the user space. Each thread has its PC, registers, stack and thread control block. To my knowledge, the update of the computer (or any system registry) or access to the code segment can only be performed in kernel mode (since it must be protected from outside access). If this is true, how can user-level threads keep (or update) their status information (PCs, other registers, thread control block, etc.) at the user level instead of the level? the kernel?

To sum it up, can anyone explain what's really going on under the hood and how do thread-level context changes happen at the user level?