Some six months ago the x86 version of switch_to macro changed not to
explicitly push and pop esi and edi. Below is pasted the current
version, it does save esi and edi through inline assembly magic but
never restores them....?
Also, not saving ebx has been dicussed before, afair, but couldn't
remember/find the exact reason (other than by luck ebx isn't used by
schedule() in such a way that would need it). Anyone put some light on this?
#define switch_to(prev,next,last) do { \
unsigned long esi,edi; \
asm volatile("pushfl\n\t" \
"pushl %%ebp\n\t" \
"movl %%esp,%0\n\t" /* save ESP */ \
"movl %5,%%esp\n\t" /* restore ESP */ \
"movl $1f,%1\n\t" /* save EIP */ \
"pushl %6\n\t" /* restore EIP */ \
"jmp __switch_to\n" \
"1:\t" \
"popl %%ebp\n\t" \
"popfl" \
:"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
"=a" (last),"=S" (esi),"=D" (edi) \
:"m" (next->thread.esp),"m" (next->thread.eip), \
"2" (prev), "d" (next)); \
} while (0)
--Mika