mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mika.penttila@kolumbus.fi>
To: linux-kernel@vger.kernel.org
Subject: switch_to() x86 changes
Date: Sat, 02 Aug 2003 22:47:01 +0300	[thread overview]
Message-ID: <3F2C1535.9000203@kolumbus.fi> (raw)


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



                 reply	other threads:[~2003-08-02 19:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F2C1535.9000203@kolumbus.fi \
    --to=mika.penttila@kolumbus.fi \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®