Conversation
Edited 22 days ago
Reviewing what I learned about Linux context switching years ago because I forgot how it works.

A note for the next time I forget:

Context is switched from one kernel context to another. When a user process is going to be rescheduled, it first switches from user context to its kernel context after storing the registers on the kernel stack (pt_regs) due to a scheduler tick.

When switching between kernel contexts, only callee-saved registers are restored (from cpu_context in thread_struct), as the other registers should have been stored on the kernel stack (by the calling convention) before calling __switch_to()->cpu_switch_to() (on ARM64).
0
0
4