On Sat, Oct 07, 2017 at 07:22:49PM +0530, Ketan Singh wrote: > I want to know where the kernel stores it's registers while performing > a context switch on x86 architecture. In ARM I can see struct > cpu_context_save in arch/arm/include/asm/thread_info.h but what about > x86/x86_64? Are you talking about context switches between two different threads? If so, on x86, EIP and other CPU registers are saved onto the kernel stack of the thread, then ESP is saved in the thread_struct structure which is itself included in task_struct. The kernel function that handles that is switch_to(), you might want to take a look at it. If you were talking about switches between kernel and user modes, on x86 it is managed like interrupts, on x86_64 you should read about the task state segment (TSS). Hope this helps, Thibaut _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies