I'm trying to grasp the theory of context switching in embedded systems. I understand that when an interrupt is triggered, the processor must immediately execute the Interrupt Service Routine (ISR). In a example where we have a main function and a timer interrupt configured to generate a 1 millisecond interrupt, it seems that when the processor is executing the main function and an interrupt occurs, it jumps to the ISR and then returns to the main function once the ISR is done. This transition from the main function to the ISR is often referred to as context switching.
However, I'm having trouble understanding the specifics of this process. How and where does the processor store the context of the main function before jumping to the ISR, and what exactly does this store? I've read further, but I'm still struggling to grasp.
However, I'm having trouble understanding the specifics of this process. How and where does the processor store the context of the main function before jumping to the ISR, and what exactly does this store? I've read further, but I'm still struggling to grasp.

