The iret is used when a process is returning from a syscall or interrupt. Thats because, when the process made the syscall or when the interrupt occured, its registers were stored in its kernel mode stack and so on return, the iret pops them into the right place. However, a process can be pre-empted when executing in userland too .. in which case, the scheduler (specifically the switch_to function) loads and saves the registers of the processes involved in the switch. Regards, Bijoy. ----- Original Message ----- From: jnf <lists@xxxxxxxxxxxxxxxxxx> Date: Wednesday, October 13, 2004 6:05 pm Subject: RE: scheduler question > > > The important thing happens during a process switch is the change of > > kernel mode stack of the process ( From previous process to the next > > process's stack ) and the rest of the thing follows. In simple > terms, a > > IRET instruction will cause the execution of the instruction X+1 > ( when > > that process was last interuppted ) because CPU is now working > with the > > next process stack. > > OK so its done through an IRET and thus operates like a function in > userspace. Makes sense. > > > Also, one important macro is "current" ( points to the > tast_struct of > > the running process ) which is actually derived from the stack > pointer> of the processor. > > Hrm I will look more into that exact portion of it- I knew what > currentwas, but never really thought about it- should prove > interesting either > way. When I get some time I'll sift through the code some, thanks. > > jnf > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/