linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* switch_to() x86 changes
@ 2003-08-02 19:47 Mika Penttilä
  0 siblings, 0 replies; only message in thread
From: Mika Penttilä @ 2003-08-02 19:47 UTC (permalink / raw)
  To: linux-kernel


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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-02 19:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-02 19:47 switch_to() x86 changes Mika Penttilä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).