mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jamie Lokier <lk@tantalophile.demon.co.uk>
To: Parity Error <bootup@mail.ru>
Cc: linux-kernel@vger.kernel.org
Subject: Re: switch_to()/doesnt %esp get replaced with %ebp on ret
Date: Mon, 19 Mar 2001 15:04:25 +0100	[thread overview]
Message-ID: <20010319150425.D19104@pcep-jamie.cern.ch> (raw)
In-Reply-To: <E14ezYx-000J2L-00@f6.mail.ru>
In-Reply-To: <E14ezYx-000J2L-00@f6.mail.ru>; from bootup@mail.ru on Mon, Mar 19, 2001 at 04:19:09PM +0300

That's not nice code from the compiler (suboptimal), but it'll work.
leal -24(%ebp),%esp is perfectly ok in the epilogue of a function.
You're right that %esp is lost -- in this case, %ebp has effectively the
same information.

Think like this: a perfectly normal function (without switch_to) can
have this:

f: pushl %ebp
   movl %esp,%ebp
   pushl %ebx
   ... do stuff, decrement %esp a lot to call functions etc. etc. ...
   movl -4(%ebp),%esp
   popl %ebx
   popl %ebp
   ret

Parity Error wrote:
> in schedule(), switch_to() macro changes esp to
> the new process's stack. But, on exit frm schedule,
> how come it does not get overwritten with  ebp-24,
> as the dissasembled code shows. The code was compiled
> without the -fomit-frame-pointer.
> 
>         pushl 508(%ecx)
>         jmp __switch_to
> 1:      popl %ebp
>         popl %edi
>         popl %esi
> 
>         jmp .L1180
> 
> .L1180: 
> 	leal -24(%ebp),%esp
>         popl %ebx
>         popl %esi
>         popl %edi
>         movl %ebp,%esp
>         popl %ebp
>         ret

  reply	other threads:[~2001-03-19 14:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-19 13:19 Parity Error
2001-03-19 14:04 ` Jamie Lokier [this message]
2001-03-20 10:51   ` Re[2]: " Parity Error
2001-03-20 11:23     ` Jamie Lokier

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=20010319150425.D19104@pcep-jamie.cern.ch \
    --to=lk@tantalophile.demon.co.uk \
    --cc=bootup@mail.ru \
    --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®