switch_to() x86 changes

From: Mika Penttilä (mika.penttila@kolumbus.fi)
Date: Sat Aug 02 2003 - 14:47:01 EST


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:19 EST